Arg. Though I had a rather steep learning curve when switching from OpenHAB to HA, I now get to the limits of my understanding of HA. I try to use automations for Zigbee remote controls, and I don’t want to fill up everything with single automations for every single keypress of the remote.
So I thought I’d try to learn about templating. But, frankly, the documentation really sucks in this case. It seems to me as if knowledge of Yaml, Jinja and all those concepts is taken for granted and I’m missing a step-by-step guide to the ideas and concepts behind HA.
So I thought I’d ask the forum.
If I make one automation per keypress, it is simple:
id: '9593528121445'
alias: 'Remote Light 1 +'
trigger:
- event_data:
event: 11002
unique_id: xx:aa:9d:00:01:8b:ee:f3
event_type: deconz_event
platform: event
and then the “action:”, as I like it.
Now I’d like to start the automation only with the “unique_id:”, which identifies the remote, and use the “event” field, which describes, which button was pressed on this remote (and how), to “choose” between several actions. That means, that every keypress of a single remote is handled within one automation.
HA now has a “choose:” action. And I played around with “trigger.event” and “trigger.event.data” in order to differentiate between the keypresses. However, it does not work. And I don’t find any example which fits my needs. I don’t know if to use only trigger.event or states() or state_attr() or something else. I don’t know what exactly the {{ and {% constructs mean. And I don’t find an introduction to this concepts, only a bunch of examples, which, however, don’t seem to work when I try to adapt them to my needs.
So, can anybody point me to an example how I “choose” within an automation depending on the data attribute “event” of the triggering event? Thanks in advance!