I’m trying to write a script and then add it to my configuration using script: !include scripts.yaml
I’m having a problem understanding the syntax that my scripts.yaml file needs to take.
So far I’ve written the following:
hot_water_script:
- if:
- alias: "If hot water on"
condition: state
entity_id: sensor.wiser_hot_water
state: On
then:
- alias: "Override"
service: button.press
target:
entity_id: button.wiser_cancel_hot_water_overrides
else:
- service: button.press
target:
entity_id: button.wiser_boost_hot_water
The aim is to have a script which I can then use to get different actions when tapping a button in Lovelace, so the script checks the state of a sensor and then calls a different button.press depending on the state.
I’ve tried a number of different syntax combinations and keep getting errors - can someone tell me what I’m doing wrong?