I have script that turns on some lights when a door is opened, the automation for it looks like this:
- alias: Plafondlamplamp aan bij nacht
trigger:
platform: state
entity_id: binary_sensor.deursensortrap_sensor
to: 'on'
action:
service: script.woonkamer_aan_bij_nacht
and the script looks like this:
woonkamer_aan_bij_nacht:
sequence:
- service: homeassistant.turn_on
entity_id: light.dimmerwoonkamer_level
data:
brightness: 110
- delay:
seconds: 60
- service: homeassistant.turn_off
entity_id: light.dimmerwoonkamer_level
As you can see, I’m currently using a delay of 60 seconds to turn the lights back off. Instead of that, I would like to turn the lights off when the door is opened for the second time.
I thought I would be able to use wait_template with a small delay (to wait for the closing of the door the first time), so I changed my script into this:
woonkamer_aan_bij_nacht:
sequence:
- service: homeassistant.turn_on
entity_id: light.dimmerwoonkamer_level
data:
brightness: 110
- delay:
seconds: 5
- wait_template: "{{ is_state('states.binary_sensor.deursensortrap_sensor','on') }}"
timeout: '00:01:00'
continue_on_timeout: 'false'
- service: homeassistant.turn_off
entity_id: light.dimmerwoonkamer_level
Unfortunately, I seem to be doing something wrong, because I’m getting this error:
2018-10-24 20:58:19 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: [wait_template] is an invalid option for [script]. Check: script->script->woonkamer_aan_bij_nacht->sequence->2->wait_template. (See /home/pi/.homeassistant/configuration.yaml, line 728). Please check the docs at https://home-assistant.io/components/script/
any idea where I’m going wrong?