Can’t find the right template to let the
Can’t find the right template to let my shade icon reflect the state (open/closed).
Tried different templates for state_open and state_closed but did not succeed.
configuration.yaml
mqtt:
cover:
- name: “Screen_1”
device_class: “shade”
state_topic: “rflink/BrelMotor-ef3119”
command_topic: “rflink/cmd”
payload_open: “10;BrelMotor;ef3119;71;UP;”
payload_close: “10;BrelMotor;ef3119;71;DOWN;”
payload_stop: “10;BrelMotor;ef3119;71;STOP;”
#state_open: “{{ value_json.SWITCH71 }}”
state_open: “{{ value_json.SWITCH71}} = ‘UP’”
#state_open: “{“SWITCH”:“71”,“CMD”:“UP”,“SWITCH”:“71”}”"
state_closed: “‘SWITCH’:‘71’,‘CMD’:‘DOWN’,‘SWITCH71’:‘DOWN’”
#state_closed: “{{ value_json.SWITCH71}} = ‘DOWN’”
optimistic: false
qos: 1
retain: false
MQTT JSON for closed:
{“SWITCH”:“71”,“CMD”:“DOWN”,“SWITCH71”:“DOWN”}
MQTT JSON for open:
{“SWITCH”:“71”,“CMD”:“UP”,“SWITCH71”:“UP”}
I would like to change icon depending on value belonging tot SWITCH71.
Think you have to use the position_template
position_template: '{% if is_state("binary_sensor.garage_door", "off") %}0{% else %}100{% endif %}'