Hi, I am trying to pass a state value (on/off) of my yeelight lamp from an automation to a script. The script first changes the color of the lamp to yellow for 1s and then, based on previously passed state value either changes the color back to a previous one and leaves the lamp turned on (if the state before running the script was “off”) or turns off the lamp (if the state was “off”).
The problem is I do not know how to test the passed variable in a condition statement.
The automation.yaml part looks like:
action:
service: script.blink_lamp
data:
lamp_state: states('light.lamp_bedroom')
The scripts.yaml part looks like:
'blink_lamp':
sequence:
- service: light.turn_on
data:
entity_id: light.lamp_bedroom
RGBTransition: [255, 215, 0, 1000, 1]
- condition: template
value_template: {{ lamp_state == 'on' }}
- service: light.turn_on
data:
entity_id: light.lamp_bedroom
RGBTransition: [255, 64, 0, 1000, 1]
I am getting the parsing error:
Error loading /config/configuration.yaml: invalid key: "OrderedDict([("stav_lampicky == 'on'", None)])"
in "/config/scripts.yaml", line 9, column 0