I’m trying to create a template binary sensor that checks if the current time is between between a specified on & off time. So if its after the start time the sensor is true but, once the off time is reached the sensor is off again.
However I only want this to work during workdays eg: The sensor is only on between 12:00 and 22:00hrs Mon -Fri. So, I added in what I thought was a simple “and” condition but this just sets the sensor to off 24/7.
Why? It’s checking if B is less than or equal to A twice.
In addition, that template contains one entity (an input_select). That means the template will be evaluated only when that one entity changes state. It won’t update for now() because it’s a function, not an entity. now() will not be used to evaluate (i.e. update/refresh) the template (actually, just once, at startup).
Thats just a typo, the first is actually on and the second instance off.
I suspect the real issue is that I’m not grabbing the state of the workday sensor. I keep making that same simple mistake. Thanks for the extra set of eyes!
Thanks, I’ll give it a go using the correct state code.
then the template will be evaluated every minute because sensor.time changes state every minute (this assumes you have already defined sensor.time in your config).