I’ve now found how to detect single / double / long clicks within node-red, rather than using the HomeAssistant automations.yaml file(s).
I found the answer over on this thread, but for simplicity, here’s a workflow that’ll detect a single xiaomi click event and toggle a smartbulb on/off:
You can easily recreate this flow in node-red by copying the below code and using Menu > Import > Clipboard
within node-red:
[{"id":"fff42ae9.58e918","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"4b2b46c8.9a9c28","type":"switch","z":"fff42ae9.58e918","name":"Xiaomi Button","property":"payload.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"binary_sensor.switch_158d000231fcc2","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":480,"y":200,"wires":[["e1aae596.8fe628"]]},{"id":"e1aae596.8fe628","type":"switch","z":"fff42ae9.58e918","name":"Button Click Type","property":"payload.event.click_type","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"double","vt":"str"},{"t":"eq","v":"long_click_press","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":707,"y":186,"wires":[["29d77911.472e96"],[],[]]},{"id":"cde4c62d.b0fb48","type":"server-events","z":"fff42ae9.58e918","name":"All HASS Events","server":"2366c39f.5e922c","x":200,"y":200,"wires":[["4b2b46c8.9a9c28"]]},{"id":"29d77911.472e96","type":"api-call-service","z":"fff42ae9.58e918","name":"Turn On Office Light","server":"2366c39f.5e922c","service_domain":"homeassistant","service":"toggle","data":"{\"entity_id\": \"light.office_lamp\"}","mergecontext":"","x":920,"y":160,"wires":[[]]},{"id":"2366c39f.5e922c","type":"server","z":"","name":"Home Assistant","url":"http://hassio/homeassistant","pass":"26fa4f45158b4a1391c988abdb08d507"}]
Hope this helps someone out there.