My automation triggers different actions based on a single, double or long button press. In the trigger section of my automation, this is configured using an MQTT device trigger for each subtype. Looking at the traces, this is working correctly. In the action section of my automation, I use a single 'choose' statement to decide what to do next based on the subtype. I do this as follows:
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.subtype == 'single' }}"
This seems to not be the right way, as the choose statement keeps going to the default action.
Now, looking at the 'trigger object', I actually do not see something called the 'trigger.subtype' but I do see a property called 'payload' which I guess I could be using here. I could also choose based on the id and idx fields, as both are different depending on the trigger ... triggered. None of these solution feel like they are the right thing to do here. I am after all defining 3 individual triggers with each a subtype explicitly added.
So I am wondering ... what is the right way of choosing based on trigger subtype?