I have a curtain something happened to and no open is closed and closed is open. I managed to add a template to my config, reverse the curtains BUT I haven’t managed to change the state. Whether it’s open or closed it remain “open”. I want the state changed to closed when the current_position is closed.
Everything i’ve done under value_template: and position_template: it doesn’t change the state. I’m sure i’m close… but so far. Can someone help please?
cover.lounge_blackout_curtain = curtain that needs to be reversed.
cover.lounge_blackout_curtainr = Reversed curtain from template.
cover:
- platform: template
covers:
lounge_blackout_curtainr:
friendly_name: "Lounge Blackout Curtainr"
device_class: curtain
value_template: >
{% if is_state('cover.lounge_blackout_curtain', 'closed') %}
open
{% else %}
closed'
{% endif %}
position_template: "{{ 100 - state_attr('cover.lounge_blackout_curtain', 'current_position') | int(100) }}"
open_cover:
service: cover.close_cover
target:
entity_id: cover.lounge_blackout_curtain
close_cover:
service: cover.open_cover
target:
entity_id: cover.lounge_blackout_curtain
stop_cover:
service: cover.stop_cover
target:
entity_id: cover.lounge_blackout_curtain
set_cover_position:
service: cover.set_cover_position
data:
position: "{{100-position}}"
entity_id: cover.lounge_blackout_curtain
icon_template: >-
{% if is_state('cover.lounge_blackout_curtain', 'closed') %}
mdi:curtains
{% else %}
mdi:curtains-closed
{% endif %}