Is it possible to react with Pyscript to a long press at a switch? #529
-
Is it possible to react with Pyscript to a long press on a switch? Some additional info:
Any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can but you need to know what events your device is firing first. What's your event provider? Is it Zigbee HomeAssistant (zha)? In my case I was able to look at the event types coming from zha_event on this endpoint, http://homeassistant.local:8123/developer-tools/event and have my pyscript service fire on every event, then filter out the events I don't care about, and action on those I do care about. |
Beta Was this translation helpful? Give feedback.
You can but you need to know what events your device is firing first. What's your event provider? Is it Zigbee HomeAssistant (zha)?
In my case I was able to look at the event types coming from zha_event on this endpoint, http://homeassistant.local:8123/developer-tools/event and have my pyscript service fire on every event, then filter out the events I don't care about, and action on those I do care about.
This image shows the event fired from an Ikea Tradfri E1810 5 button remote.
I correlate remote to zha_event event via the device_id field, and the type of event (button up/down/press/hold) via a combination of command+args fields.