Hi, @wired - this is weird. It works in the developer/template tool. I tried all kinds of perturbations ending with this one (that still didn’t work - but stick with me):
for:
hours: 0
minutes: >
{% set long_wait = 10.0|float %}
{% set short_wait = 1.0|float %}
{% if (now().hour >= 7 and now().hour <= 16) %} {{long_wait|float}}
{% else %} {{short_wait|float}}
{% endif %}
seconds: 0
As you can see, I made everything a float every opportunity I had. Still received the same error as you did when reloading the automations (but not in the configuration check).
On a whim, I changed the trigger section to:
- alias: Motion activated light (office)
description: ''
trigger:
- platform: state
entity_id: binary_sensor.master_bedroom_sensor_motion
to: 'on'
- platform: state
entity_id: binary_sensor.master_bedroom_sensor_motion
to: 'off'
for:
hours: 0
minutes: >
{% set long_wait = 10.0|float %}
{% set short_wait = 1.0|float %}
{% if (now().hour >= 7 and now().hour <= 16) %} {{long_wait|float}}
{% else %} {{short_wait|float}}
{% endif %}
seconds: 0
condition: []
action:
- service_template: 'light.turn_{{states(''binary_sensor.master_bedroom_sensor_motion'')}}'
entity_id: light.hue_color_lamp_2
All I did was change the platform to state
and then check for on
and off
conditions. It worked as it should.
Then I reverted the template to what you originally had (everything else the same as directly above):
{{ 10 if (now().hour >= 7 and now().hour <= 16) else 1 }}
And that worked, too. So… There must be a bug of some kind in the device
platform. I’m tagging a couple others to help (@pnbruckner, @123, @frenck) see where we go from here. But the above will work - just not with the device
platform.