BO1
1
I am trying to create template sensor using an OR operator and my template does not work as I think it should
{{((states('binary_sensor.door_sensor_laundry')) or (states('input_text.front_door_status') !='Locked- (Manual)'))}}
while testing individual values, the first value returns off and the second returns ‘True’
I was expecting the whole template with OR to return True (or ON), but in my case it returns ‘off’
Can someone point me to what I am doing wrong?
calisro
(Rob)
2
I changed it to this:
{{ is_state('binary_sensor.door_sensor_laundry','on') or not is_state('input_text.front_door_status','Locked- (Manual)')
What does
{{ states('input_text.front_door_status') }}
{{ states('binary_sensor.door_sensor_laundry') }}
return in the developer tab?
Your ‘states(‘binary_sensor.door_sensor_laundry’)’ won’t return a boolean. Its returning a string of off/on. Use is_state to get a boolean.
Here’s an example:
{% if states('binary_sensor.door_sensor_laundry') %}
yes
{% endif %}
{% if is_state('binary_sensor.door_sensor_laundry','on') %}
yes
{% endif %}
Notice that returns yes regardless. It has a value. While the second is off when the door is closed.