node-red-contrib-huemagic
node-red-contrib-huemagic copied to clipboard
Hue wall switch module outputs wrong payload when set to rocker_switch mode
Describe the bug
When set to "rocker switch" mode in the hue app, the wall switch module outputs the payload sequence of a "push button" configuration. After only a single flick of the switch into either position, the Hue Buttons node outputs two separate payloads within a fraction of a second:
-
payload.action: "left_press"
-
payload.action: "left_press_release"
(although there is no release on a rocker switch when you flick it into a position)
(notice, that this is the output sequence of a button press where you press the button down and release it after a certain time)
This output sequence is the same for both switch positions (on/off), which makes it unusable as a switch since you can not distingush if the switch is in "on" or "off" position.
Flow to Reproduce
[{"id":"9eaae750d4d6e0cf","type":"debug","z":"85268a1e5cd5777d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":2140,"wires":[]},{"id":"ab22d126097e7535","type":"hue-buttons","z":"85268a1e5cd5777d","name":"Hue wall switch module (set to rocker switch mode in app)","bridge":"3aef7858e3c99604","sensorid":"","skipevents":false,"initevents":false,"x":370,"y":2140,"wires":[["9eaae750d4d6e0cf"]]},{"id":"3aef7858e3c99604","type":"hue-bridge","name":"Hue-Holz Bridge","bridge":"192.168.188.55","key":"CgjlJYm7GTqPwJRlSVPn6JmdYNLw6Cu9r2od3f2R","worker":"100","disableupdates":false}]
Expected behavior
Hue Buttons node should output payloads, that distinguish between the two possible positions of a rocker switch
For the first channel
Flick the left switch into "off" position - payload.action: left_off
Flick the left switch into "on" position - payload.action: left_on
For the second channel:
Flick the right switch into "off" position - payload.action: right_off
Flick the right switch into "on" position - payload.action: right_on
Screenshots
This is the output for a single flick into "on" position:
This for a single flick into "off" position:
Please complete the following information:
- Node-RED version: 10.0.0
- NodeJS version: ?
- Device running Node-RED: Home Assistant 2022.2.6 in VM on Synology NAS-916
Additional context
Before writing this issue I tried to find my own solution to this problem. This involved paring a hue wall switch to my Dresden-Elektronik Conbee II Zigbee Coordinator with Zigbee2MQTT. There I encountered the exact same problem and wrote a issue on this topic aswell:
https://github.com/Koenkk/zigbee2mqtt/issues/11727
During my research I found another Thread where the same issue was mentioned:
https://discourse.nodered.org/t/hue-wall-switch-sends-on-and-off-status-at-every-toggle/55856
@KGS501
when I see your screenshot, it looks like that this is raw API V2 data, that comes directly from the bridge and isn't converted in a usable json format by HueMagic.
If you open the other arrows in the payload, probably last_state, there should be a difference for on / off. To make it usable you could use switches and change nodes, to send the information to the correct flow.
Well yes but the payload data itself is not a problem, since as you mentioned I can just extract the relevant path (in this case msg.payload.action or msg.lastState.payload.action) to see if the switch gives a initial_press
signal or short_release
. The problem is how the switch spits out data in the first place when set to rocker switch.
Maybe my first issue wasn't clear enough:
When I flick my switch into "on" position, which is only one physical move and results in the switch being permanently in this (on) position, I get a first payload with a "press" action, followed by a second payload with a "release" action, although with a rocker switch there is inherently no release motion and I didn't release anything. If I then flick the switch into the other (off) position I get the exact same output: A "press" followed by a "release". The payload does not differ in any form between these two actions.
This means there is no way for me to distinguish between the two positions of my rocker switch (on/off). With the data I get, I can only tell if the switch was flicked, not if it was flicked from on to off or vice versa. So I cant control devices based on the position of the physical switch which is sad, but I guess not a breaking bug.
I'm facing exactly the same issue. Did you find a solution by chance?
I'm facing exactly the same issue. Did you find a solution by chance?
@lober-io Ja, gibts :)
https://github.com/andesse/HUE-CLIP-API.Node-RED-Flows