Xiaomi wireless switch usage in Node-RED trough ZHA

Hello
I recently began to migrate my Mi buttons (WXKG01LM) directly to HA, but ended only on getting single click.
My problem is, that i don’t know what value to set to listen for double press and long press.
Tried double click, double_click, hold, etc etc…
Here’s my node with working only click:

[{"id":"d81428fa.669568","type":"switch","z":"a8f1c526.03ac38","name":"","property":"payload.event.command","propertyType":"msg","rules":[{"t":"eq","v":"click","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":360,"wires":[["3a0fdc50.5d8d94"]],"outputLabels":["Double Click"]},{"id":"63f23784.364d38","type":"server-events","z":"a8f1c526.03ac38","name":"zha_event","server":"666b1cf9.686414","event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":70,"y":360,"wires":[["7e362b8c.229c04"]]},{"id":"7e362b8c.229c04","type":"switch","z":"a8f1c526.03ac38","name":"lumi.switch","property":"payload.event.unique_id","propertyType":"msg","rules":[{"t":"eq","v":"00:15:8d:00:01:b1:87:dd:1:0x0006","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":360,"wires":[["d81428fa.669568"]]},{"id":"3a0fdc50.5d8d94","type":"api-call-service","z":"a8f1c526.03ac38","name":"living","server":"f9298d6e.8cb6c","version":1,"debugenabled":false,"service_domain":"light","service":"toggle","entityId":"light.living","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":540,"y":360,"wires":[[]]},{"id":"666b1cf9.686414","type":"server","name":"Home Assistant","addon":true},{"id":"f9298d6e.8cb6c","type":"server","name":"Home Assistant","addon":true}]

Put a debug node set to output the whole msg after the first switch node. Then start hitting buttons on your remote to see what comes out.

Tried this too, on long press i get:

object

event_type: “zha_event”

entity_id: undefined

event: object

device_ieee: “00:15:8d:00:01:b1:87:dd”

unique_id: “00:15:8d:00:01:b1:87:dd:1:0x0006”

device_id: “437a4991ac07831a54796fde66b56961”

endpoint_id: 1

cluster_id: 6

command: “click”

args: object

click_type: “double”

origin: “LOCAL”

time_fired: “2021-01-02T10:03:03.074628+00:00”

context: object

id: “f3e22691e2121424a398fd7f9fadc328”

parent_id: null

user_id: null

but problem is that using “double” value desn’t works

in your posted example you’re checking against msg.payload.event.command and double is under msg.payload.event.click_type

1 Like

Thanks!!
I am not as advacend, flow was used to work with sonoff buttons, xiao sends different messages.
Now a managed to get it working, but by using payload.event.args.click_type
Unforunatley long press still sends only single click just like click action