@FutureTense wrote:
I have the following binary sensor which should return true if the current time falls in between the values of two input_datetime entities. If I set the “end” input_datetime to the current time the sensor reports True as expected. However, when the time moves past the end time the sensor still reports true.
I actually have an additional input_boolean as part of this binary_sensor (not shown) and if I turn it off and on after the time progresses the sensor reports the correct value.
Why isn’t the sensor updating every time “now().strftime(’%H%M’)” changes? Any ideas on how I can fix this?
range_sensor: value_template: "{{ ((states.input_datetime.starttime.attributes.timestamp | timestamp_custom('%H%M', False) | int ) | int <= (now().strftime('%H%M') | timestamp_custom('%H%M', False) | int)) and ((states.input_datetime.endtime.attributes.timestamp | timestamp_custom('%H%M', False) | int ) | int >= (now().strftime('%H%M') | timestamp_custom('%H%M', False) | int)) }}"
Posts: 14
Participants: 4