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’) }}
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.
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’) }}