You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Z2M: serve both firmwares from one converter, keep press_action
The multistate presentValue does not mean the same thing on every firmware.
Without multi-press, a short press is PRESS (1) and that is the whole signal.
With multi-press, 1 is a transient superseded by a confirmed value once the
press count is known, so publishing on it fires an action on every tap and
then fires again with the real result.
Z2M loads one converter for all devices, so a single static mapping cannot
serve both: keep 1 and multi-press devices double-fire, drop it and devices
on older firmware report nothing at all on a short press.
Use numberOfStates to tell them apart — it is already an attribute, and it is
3 without multi-press versus 3 * max_press_count + 4 (7 at minimum) with it.
It is read during configure and consulted from the action handler; if it is
unavailable the legacy mapping is used, because an extra action is
recoverable and a silent button is not.
Both mappings share one action vocabulary, so `<switch>_single` means the
same gesture on either firmware and the split stays invisible to automations.
Also:
- Restore the press_action sensor, dropped in the multistate proposal. Its
lookup covers the new values. Existing setups are built on it, and it is
the only place the transient press/released states remain visible.
- Name actions after the endpoint (`switch_0_single`) rather than its ID
(`1_single`), matching every other entity on these devices and avoiding the
off-by-one where endpoint 1 is switch_0.
- confirm_release_ms now stops offering 0, which is the "use the default"
sentinel rather than zero delay, and both new settings describe the
latency trade-off they control.
Regenerating also picks up TS0002-N1J44RTH and TS0003-UWHJGNGJ, which were
already in device_db.yaml but missing from the committed converter.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments