Multistate actions proposal - #380
Conversation
|
WIP, need some tests on real device (TBD soon) |
|
Hi, I have some questions:
|
|
If we rework this, we should definitely switch to the cleaner mqtt events (actions), like all other remotes from Z2M.
Not sure how it would affect the firmware, this is mostly about the converter / UX. There would be one 'action' field per device, so the possible values would include the gang (1,2,3,4) corresponding to the button pressed.
Double/triple initial-press and hold are overkill imo, but I'm not totally against them.. And for rocker switches it would be just We must also keep in mind what happens if multiple buttons are pressed at once. |
I add a test for that, at last release (passing 200 ms timeout) only the the max bp action will be fired
I though that a flash led on bp event should be nice, to see that event are fired. But we can simplify. |
fully agreed with that but I was not able to deduce impact for users... Too risky for me as I'm not very familiar with usage of this firmware. |
I just added a test for that |
|
Hello, any progress on this? Would love to see this feature :) |
|
Picking up @andrei-lazarov's suggestion earlier in this thread about publishing button presses as a Z2M It might feel like a semantic matter, since the heavy lifting is already there thanks to @romasku's I know that dropping If you guys are up for it, I already have a tested implementation (real hardware, both publishing side by side with no interference) that I'd be glad to PR. |
Firmware compiled on GitHub Actions; committing artifacts here so the OTA index URLs resolve (the workflow's own push-back was blocked by the fork's read-only Actions token). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Following up on my comment above — I've now tested this on real hardware and wanted to share results. I built firmware from @RealByron's work in this PR (with a few tweaks) and flashed it onto two real BSEED TS0726 switches — a 4-gang (EC-GL86ZPCS41) and a 1-gang (EC-GL86ZPCS11) — then validated end to end:
On the Z2M side I kept It's all on a branch off this PR's work if any of it is useful: https://github.com/neneonline/tuya-zigbee-switch/tree/feat/multigesture-fixes Happy to open a PR against main, or to split it up however is least disruptive to @RealByron's PR — whatever you all prefer. Thanks @romasku for the |




Multi-press action reporting
Summary
Replaces the previous action-dispatch system (which hardcoded relay/binding actions per press count) with pure reporting: the firmware detects how many times a button was pressed and reports it as a multistate value. All automation logic lives in Z2M/ZHA.
This makes multi-press fully generic — supporting triple press (or more) requires zero firmware changes, just setting
max_press_count = 3via ZCL.New multistate values:
long_presssingle_presssingle_releasedouble_pressdouble_holddouble_releasetriple_pressmax_press_count=3)3n+1/3n+2/3n+3for n≥2New ZCL attributes (OnOff Switch Config cluster, per endpoint):
0xFF06confirm_release_ms— window after release before confirming press count (default 200 ms)0xFF07max_press_count— maximum press count to detect (default 2, set to 3 for triple-press)Both attributes are persisted in NVM and survive reboots.
Backward compatibility:
relay_mode,binded_mode, and the legacylong_press(value 2) are fully preserved.Changes
src/zigbee/switch_cluster.c— genericMULTISTATE_N_*formula, dynamicmultistate_num_of_states, removed action-dispatch systemsrc/zigbee/switch_cluster.h— removed 6 action fields, reducedattr_infos[16]→[10]src/zigbee/consts.h— removedSWITCH_ACTION_*enum andACTION_N_*attribute IDssrc/device_config/config_parser.c—Ihandler uses ordered counter for switch indicator assignment;relay_clustersassignment guarded byrelay_clusters_cnt > 0device_db.yaml—REMOTE_MOES_SWITCH_TS0044config_str updated (Stokens +BTC5)helper_scripts/templates/switch_custom.js.jinja— updatedpressActionlookup (up to triple press), addedconfirmReleaseMsandmaxPressCountconverter functionstests/— removed action-dispatch tests, addedsingle_press,double_press,triple_pressmultistate value tests