How to create double troggle switch?

Hi,
A newbe question
I have a zigbee aqara D1 (double push button)
When I push the left button it send "left". when I relase it, it send ""
When I push the right button it send "right". when I relase it, it send ""
I want to use it to troggle 2 light,. one with the left button, one with the right button.
How I can do that ?
Thanks

Why do you need to send a message on release?

Hi Colin,
I don't want to send a message, I only explain What's happening

Received 18:04:04
QoS: 0
Payload: action: right
battery: 100
linkquality: 86
voltage: 3075
Received 18:04:04
QoS: 0
Payload: action: ''
battery: 100
linkquality: 86
voltage: 3075
Received 18:04:06
QoS: 0
Payload: action: right
battery: 100
linkquality: 86
voltage: 3075
Received 18:04:06
QoS: 0
Payload: action: ''
battery: 100
linkquality: 86
voltage: 3075
Received 18:05:50
QoS: 0
Payload: action: right
battery: 100
linkquality: 84
voltage: 3075
Received 18:05:50
QoS: 0
Payload: action: ''
battery: 100
linkquality: 84
voltage: 3075
Received 18:05:52
QoS: 0
Payload: action: left
battery: 100
linkquality: 86
voltage: 3075
Received 18:05:52
QoS: 0
Payload: action: ''
battery: 100
linkquality: 86
voltage: 3075
Received 18:05:58
QoS: 0
Payload: action: left
battery: 100
linkquality: 86
voltage: 3075
Received 18:05:58
...

Sorry, that output conveys nothing to me.
You said

But now you say you don't want to send anything on release. If you don't want to send anything on release then just use two buttons.

Thank you Colin, I succeeded

[{"id":"3a3809e1.825fd6","type":"function","z":"13d63903.d702e7","name":"","func":"\nif (msg.payload == 1) {\n    context.set(\"previousState\",!context.get(\"previousState\"))\n    msg.payload = 1 * context.get(\"previousState\");\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":660,"wires":[["424467e5.d8b4b8"]]},{"id":"7ec246f4.2ce578","type":"server-state-changed","z":"13d63903.d702e7","name":"Chambre switch","server":"e7566847.ec76a8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.0x00158d0006b21e61_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":200,"y":720,"wires":[["69f57070.be045"]]},{"id":"69f57070.be045","type":"switch","z":"13d63903.d702e7","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"right","vt":"str"},{"t":"eq","v":"left","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":720,"wires":[["3fb03e63.4306b2"],["281f370c.23aab8"]]},{"id":"424467e5.d8b4b8","type":"debug","z":"13d63903.d702e7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":660,"wires":[]},{"id":"3fb03e63.4306b2","type":"change","z":"13d63903.d702e7","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":660,"wires":[["3a3809e1.825fd6"]]},{"id":"26274a69.cddde6","type":"function","z":"13d63903.d702e7","name":"","func":"\nif (msg.payload == 1) {\n    context.set(\"previousState\",!context.get(\"previousState\"))\n    msg.payload = 1 * context.get(\"previousState\");\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":760,"wires":[["8b9dcf63.88a75"]]},{"id":"8b9dcf63.88a75","type":"debug","z":"13d63903.d702e7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":760,"wires":[]},{"id":"281f370c.23aab8","type":"change","z":"13d63903.d702e7","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":760,"wires":[["26274a69.cddde6"]]},{"id":"e7566847.ec76a8","type":"server","name":"Home Assistant","addon":true}]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.