Here is the problem :
I built a template for a cover according to an open/close sensor
cover:
- platform: template
covers:
portillon:
device_class: gate
friendly_name: "Portillon"
value_template: "{% if states('binary_sensor.openclose_portillon') == 'unavailable' %}unavailable
{% elif states('binary_sensor.openclose_portillon') == 'off' %}closed
{% elif states('binary_sensor.openclose_portillon') == 'on' %}open
{% else %}unknown{% endif %}"
open_cover:
service: switch.toggle
data:
entity_id: switch.portillon
close_cover:
service: switch.toggle
data:
entity_id: switch.portillon
stop_cover:
service: switch.toggle
data:
entity_id: switch.portillon
icon_template: >-
{% if is_state("cover.portillon", "open") %}
mdi:door-open
{% else %}
mdi:door
{% endif %}
It works great for closed and open states but when it comes to unavailable the fake cover never gets unavailable (or any other word for the unavailable state).
I verified my model in dev tools :
So it is supposed to work as it works in dev tools nevertheless…
Can someone explain this ?
Thanks for your help
Regards
V.