Smartel
(Serge Martel)
1
Hello all,
Complete noob with templates, I would like this template
sensors:
garage_doors:
value_template: “{{
(states(‘sensor.temp_exterieur’) | float(0) < 0) and
(is_state(‘binary_sensor.some_sensor’, ‘on’)
or is_state(‘binary_sensor.some_othersensor’, ‘on’)
or is_state(‘binary_sensor.nspanel_left_button’,‘on’))
}}”
to show Open or Closed instead of true or false, tried with changing class with :
device_class: door
but with no sucess, i am unable to find the proper syntax to do like this example I found:
value_template: >-
{% if value is equalto 'false' %}
Closed
{% else %}Open
{% endif %}
Pointers are appreciated!
It’s because you are using the old style of template.
template:
binary_sensor:
- name: Garage Doors
state: >-
{{ (states(‘sensor.temp_exterieur’) | float(0) < 0) and
(is_state(‘binary_sensor.some_sensor’, ‘on’)
or is_state(‘binary_sensor.some_othersensor’, ‘on’)
or is_state(‘binary_sensor.nspanel_left_button’,‘on’))
}}
device_class: door
unique_id: garage-door-2ea65912-5789-4b7c-b327-b6d89c2fd294
Smartel
(Serge Martel)
3
Great thank you!
I had to change the order for it to be recognised but it works perfectly!
Thanks again
binary_sensor:
- name: Garage Doors
device_class: door
unique_id: garage-door-2ea65912-5789-4b7c-b327-b6d89c2fd294
state: >-
{{ (states(‘sensor.temp_exterieur’) | float(0) < 0) and
(is_state(‘binary_sensor.some_sensor’, ‘on’)
or is_state(‘binary_sensor.some_othersensor’, ‘on’)
or is_state(‘binary_sensor.nspanel_left_button’,‘on’))
}}
1 Like