Skip to content

v5.4.1 - #1463

Merged
donavanbecker merged 1 commit into
latestfrom
beta-5.4.1
Nov 16, 2026
Merged

v5.4.1#1463
donavanbecker merged 1 commit into
latestfrom
beta-5.4.1

Conversation

@donavanbecker

Copy link
Copy Markdown
Contributor

homebridge-switchbot 5.4.1

Fixes Blind Tilts showing up as Switches (#1453, fixed in #1462):

  • Blind Tilt is created as a Window Covering again instead of a Switch that sent turnOn.
  • Blind Tilt position: 0–100% in Home now means closed → open. When closing, the blind goes to the side it was last on (down by default).
  • Relay Switch 1 / 1PM now get their own accessory class instead of the generic fallback. Their behaviour doesn't change.

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

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>
@donavanbecker donavanbecker added the patch patch version release label Nov 13, 2026 — with Claude
@donavanbecker
donavanbecker merged commit d617933 into latest Nov 16, 2026
23 checks passed
@donavanbecker
donavanbecker deleted the beta-5.4.1 branch November 16, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch patch version release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant