How to use a zigbee scene button as an automation trigger

hi all,
I have bought and setup a four button zigbee scene switch that i’d like to use to trigger some automations.

The switch is showing in HA as a device and the logbook records an entry every time i press (or double press/hold) a button. The logbook entries are " TS0044 27 fired event ‘4002’ "

I can see the automation trigger isn’t device type, and probably needs to be event, but i’m not sure of where to start with the YAML.

any pointers please?

thanks!

Maybe just use a blueprint:

https://community.home-assistant.io/t/zigbee2mqtt-tuya-4-button-scene-switch-ts0044

here’s my solution should it be useful to anyone searching in the future.

i’m using deconz as my zigbee adapter.

by using the developer tools, and listening for ‘deconz_events’ you will see each button press fires an event with the structure below:

event_type: deconz_event
data:
  id: ts0044_27
  unique_id: b4:e3:f9:ff:fe:15:12:f9
  event: 3002
  device_id: dff5506fd2471b020bdcf67f6cbdc31a
origin: LOCAL
time_fired: "2022-11-26T18:42:59.918906+00:00"
context:
  id: 01GJTKZYPE89B586STVYJ6TCNS
  parent_id: null
  user_id: null

once the above was identified, using the data makes a really simple automation trigger.

the automation trigger type is ‘event’ and the event type 'deconz_event'.

the event data field has:

unique_id: b4:e3:f9:ff:fe:15:12:f9
event: 4002

obviously the unique_id needs to match the unique_id for your switch that you’ll get from the event trace, and the event needs to match to the button press type you want (single press, double press, hold press)

that’s the trigger sorted for the automation which you can then programme as you would normally, enjoy!

1 Like

In the automation gui add a device trigger. Then choose the device. Below that the available triggers will appear, eg "button_4_double" action. Then choose conditions and actions.

that might work with some switches, but for this one - the only device action that appears relates to the battery percentage of the remote.

fortunately the fix above works reliably.