Hi,
A just shared a blueprint for 3 button switch without batteries using the new experimental events from z2m:
Hi,
A just shared a blueprint for 3 button switch without batteries using the new experimental events from z2m:
The input for the mode is very clever. I might steal that!
Minor suggestions. Things drift over time, and to prevent shenanigans I would suggest
condition:
- "{{ trigger.to_state.attributes.event_type != '' }}"
be
condition:
- "{{ trigger.to_state.attributes.event_type in ['on', 'off', 'recall_scene1']}}"
Then any stray junk including an empty set will be screened out and only the things you are testing for will get to the tests.
Plus if you move
action:
- variables:
event_type: "{{ trigger.to_state.attributes.event_type }}"
to
variables:
event_type: "{{ trigger.to_state.attributes.event_type }}"
action:
The context includes the condition statement (I’m pretty sure) and you can then use the variable like this in the condition:
condition:
- "{{ event_type in ['on', 'off', 'recall_scene1']}}"
I think the order of execution at the top code level is inputs, trigger variables, triggers, variables, conditions, actions, then anything under actions… The top variables and trigger variables are still there for actions to use.
Just makes maintenance easier and the code cleaner.
Awesome job and thanks for contributing a Blueprint to the community.
Hi @Sir_Goodenough I made all the changes suggested by you. It all made sense.