In the below, I am trying to develop logic so if the washing machine is not operational and solar surplus is > 2000 then the dishwasher turns on instantly. Otherwise, it will wait for the timeout of the two wait templates.
What I am finding is that even though the states of “sensor.washing_machine_operational” and “sensor.solar_power_surplus_2000” are False and True respectively the Dishwasher is not instantly turning on. What am I doing wrong with the wait templates?
- id: '1609363796977'
alias: 'ON: Dishwasher if Solar is available '
description: ''
trigger:
- entity_id: sensor.solar_power_surplus_2000
for: 0:05:00
from: 'False'
platform: state
to: 'True'
condition:
- condition: state
entity_id: sun.sun
state: above_horizon
action:
- wait_template: '''{{ is_state(''sensor.washing_machine_operational'', ''False'')
}}'''
timeout: 00:10:00
continue_on_timeout: true
- timeout: 00:20:00
wait_template: '''{{ is_state(''sensor.solar_power_surplus_2000'', ''True'') }}'''
continue_on_timeout: true
- data: {}
entity_id: switch.dishwasher
service: switch.turn_on
mode: single
initial_state: true
Well, it very wasteful of resources storing text values instead of 0 or 1
Your other wait statements look garbled too
Isn’t how I’d write it but looks okay, though verbose as continue_on_timeout: true is the default
Is just wrong, timeout is a child of wait_template not the other way round
And
Is just gui mangling, though the yaml is correct
Is setting up problems for the future as this implies you switch off automations (bad idea). But more importantly erases the automation last triggered attribute on a restart
I’ve worked out what the error is. I had single quotes in the gui around the wait_template. This translated to triple single quotes which I assume was treating everything as a string and not a template?