So I’m new to HA scripting, and I’m finding the documentation to be pretty lacking.
What I’m trying to do seems simple enough: at the start of the script, save the state of an entity (light) and, after all the other actions, restore that light to its previous state.
This is where I’m at:
example_script:
sequence:
- alias: "Set variables"
variables:
state_one:
value: light.one.state
And, at the end:
- alias: "Restore one"
service: light.turn_on
target:
entity_id: >
{% if state_one == 'on' %}
light.one
{% endif %}
I’m not even sure if I’m on the right track or not. Can anyone help, please?
Thank you.
1 post - 1 participant