I’m trying to pass the time from an input_select to an automation to turn a light on and off. Can’t seems to get any to work. Tried a binary sensor, but it doesn’t get updated, unless I change the time from the input_select.
tank_light_on:
value_template: >-
{% if states.input_select.tank_light_on.state <= now().strftime("%H:%M:%S") and states.input_select.tank_light_off.state >= now().strftime("%H:%M:%S") %}
on
{% else %}
off
{% endif %}
friendly_name: ‘Tank Light On’
Fixed using my original binary sensor. Had to change the from using now() to using a sensor that held the time. I think the binary sensor needs something in the value template that will trigger a state change so the binary sensor knows to update, now() doesn’t trigger this.
Hi there. Today I tried your automation to control the “light times” for my little fish tank. (THANKS for your idea).
At first I thought it isn’t working… I discovered a “problem” with the initial state of the binary sensor during my tests. I set a bunch of times and had to restart hass.io for every test. So, starting up hass.io the binary sensor always comes up with “off” state, and doesn’t turn on the switch because automation is not recognising the “change”. I needed a little time to understand that. Do you have an idea for that little thing, or am I “using it wrong…”