Repository navigation
v5.4.1 - #1463
Merged
Merged
v5.4.1#1463
Conversation
Fixes #1453. ## What was wrong Both platforms pass `createDevice` the type from `normalizeTypeForMatter`, which turns `Blind Tilt` into `blindtilt`. `DEVICE_CLASS_MAP` only had `blind tilt`, so a Blind Tilt became a `GenericDevice`. That class exposes a Switch, and tapping it sent `turnOn`. This matches the report: the log shows `type: "blindtilt"`, a slow `On` characteristic, and `unsupported command turn on for device blind tilt`. Relay Switch 1 and 1PM were affected the same way: `normalizeTypeForMatter` turns them into `relay`, which wasn't mapped either. They already behaved as switches, so nobody noticed. ## Changes - `src/deviceFactory.ts`: map `blindtilt` to `BlindTiltDevice` and `relay` to `RelaySwitchDevice`. - `src/devices/genericDevice.ts`: `BlindTiltDevice` now converts positions itself. Before, it inherited the Curtain's conversion. - A Blind Tilt's position is a tilt: 0 is closed down, 50 is open, 100 is closed up. This is pySwitchbot's scale, and node-switchbot's `setPosition` turns it into the OpenAPI `down;N` / `up;N`. - The Curtain's `100 - x` would have sent "100% open" as a fully closed tilt. Now HomeKit's 0–100% (closed to open) maps to tilt 0–50, and both closed ends show as 0%. - Closing goes towards the side the blind was last reported on: down by default, up if it was last tilted up. - The Curtain's conversion helpers changed from `private` to `protected` so the subclass can override them. Curtain behaviour is unchanged. - `test/device/blind-tilt.spec.ts`: new tests. - A Blind Tilt is created as a `WindowCovering` from both the configured type and the normalized type. - The position mapping works on both sides. - Normalizing a type in `DEVICE_TYPES` never drops it to `GenericDevice`. This would have caught the Blind Tilt and relay cases, and the earlier `waterdetector` one. No config migration is needed. Saved `configDeviceType: "Blind Tilt"` entries are unchanged. After updating, the accessory's service changes from Switch to Window Covering, so HomeKit may show it as a new tile in the default room. ## Not covered - Not tested on a real Blind Tilt. The OpenAPI `slidePosition` is assumed to use the same 0/50/100 scale that node-switchbot gives it. - The Matter descriptor still uses the inherited Curtain mapping. The reporter runs HAP. Matter tilt support can be a separate change. Build, test and lint pass locally. Targets `beta-5.4.1`, created from `latest`. The issue only has the `bug` label, so this is a patch after 5.4.0. --- _Generated by [Claude Code](https://claude.ai/code/session_01TYWa2RXoWsaUTWh76oNv8s)_ Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
homebridge-switchbot 5.4.1
Fixes Blind Tilts showing up as Switches (#1453, fixed in #1462):
turnOn.Published for testing as
5.4.1-beta.1. Hold this PR until the Blind Tilt fix is confirmed on real hardware.No config migration needed. Existing Blind Tilt accessories change from Switch to Window Covering, so HomeKit may list them as new tiles.
Generated by Claude Code