As the title I had a working automation, tried to tweak it and now I’ve killed it.
The remains I have are:
- alias: Landing Light Working
id: '2536987512'
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d0001d694b2
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.landing_light
state: 'off'
- condition: state
entity_id: sensor.daylight
state: Dark
action:
- service: input_boolean.turn_on
entity_id: input_boolean.landing_light
- wait_template: '{% if states.binary_sensor.motion_sensor_158d0001d694b2.attributes[''''No
motion since''''] | int >= 60 and states.binary_sensor.motion_sensor_158d0001d694b2.state
== ''''off'''' %}True{% else %}False{% endif %}'
- condition: state
entity_id: input_boolean.landing_light
state: 'on'
- service: input_boolean.turn_off
entity_id: input_boolean.landing_light
I was certain this was what I had as a working version but clearly I’m wrong as I get this error now:
`[homeassistant.config] Invalid config for [automation]: [wait_template] is an invalid option for [automation]. Check: automation->action->1->wait_template.
Any ideas?
Further Info:
Swapping the input_boolean state turns my landing light on / off.
Dark is a valid state for sensor.daylight
Edit: The above works, I just messed up other parts of my config =/.
- wait_template: '{{ states.binary_sensor.motion_sensor_158d0001d694b2.attributes["No
motion since"] | int >= 60 and states.binary_sensor.motion_sensor_158d0001d694b2.state
== "off" }}'
you don’t need the if statement, but i don’t think that was the problem. Lines like this will evaluate true/false naturally, you don’t need to call it out. It just leads to typo’s because you have extra lines of crap to deal with.
Even without that change, i don’t see an issue with your automation. The only other thing it could be is the fact that your wait template isn’t in 1 line. Typically when I paste, it doesn’t have word wrap. That means you aren’t using word wrap and you’re adding the carriage returns. Keep it in one line.
If that’s not the case, then no clue what it could be. Looks good otherwise.
You’re absolutely right there was nothing wrong with it. As per 90% of my issues it was me messing around elsewhere. I decided to do a “re-haul” of all my lights (RF switches) and change them to template lights and implemented the automation again and it worked fine. It may have cost me a marriage staying up all night trying to figure out a non existent issue but at least it’s sorted now.
FYI, I just learned the other day that you don’t need to use an and condition. You can just make a list of condtions and it defaults to and. So his automation is correct because it’s using and without specifying it