Is_state always shows true 😭

Can anyone tell me why this always returns true , even when it’s not correct?

Individually, they all return the correct true or false

I would expect false for this as it’s Saturday, not a bank holiday and not a school holiday too, etc

{{ is_state(‘sensor.weekday’, ‘on’) or is_state(‘binary_sensor.weekend’, ‘off’) or is_state(‘binary_sensor.bank_holidays’, ‘off’) or is_state(‘calendar.school_holidays’, ‘off’) or is_state(‘input_boolean.vacation_mode’, ‘off’) }}

Trying to use this as a template helper


When you use or between all the clauses, only 1 needs to be true for the template to render true. In this case the most likely culprit is the calendar… off is the normal state when there is not an active calendar event. So, is_state('calendar.school_holidays', 'off') will be true except when a school holiday event is active.

Yeah, I use it for a few other templates and is always good.

This one doesn’t seem to like more than 1 entity in the template it seems for what I’m asking.

Anyone any idea what the best template for this query would be for an overall state of School is open ?


Try this (all is_states need to be true at the same time, not just one. So you need and, not or. I left the ‘not weekend’ bit out because that is already covered by is weekday):

{{ is_state(‘sensor.weekday’, ‘on’) and 
   is_state(‘binary_sensor.bank_holidays’, ‘off’) and
   is_state(‘calendar.school_holidays’, ‘off’) and
   is_state(‘input_boolean.vacation_mode’, ‘off’) }}