Transitioning away from MyQ to just zwave. Before making this template I had everything optional using a zwave tilt sensor (binary, on/off) and a zwave relay to momentarily press the remote button. All of that works fine, but wanted the more intuitive interface of using the cover template in the app.
Here is the code I added to my configuration.yaml:
cover:
- platform: template
covers:
garage_door:
device_class: garage
friendly_name: "Garage Door"
position_template: "{{ states('binary_sensor.door_sensor_sensor_state_any') }}"
open_cover:
- condition: state
entity_id: binary_sensor.door_sensor_sensor_state_any
state: "off"
- service: switch.turn_on
target:
entity_id: switch.relay_01_1
close_cover:
- condition: state
entity_id: binary_sensor.door_sensor_sensor_state_any
state: "on"
- service: switch.turn_off
target:
entity_id: switch.relay_01_1
stop_cover:
service: switch.turn_on
target:
entity_id: switch.relay_01_1
icon_template: >-
{% if states('binary_sensor.door_sensor_sensor_state_any')|float > 0 %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
After restart I have the cover section in interface, but it enables both open and close buttons and does not show current state.
What am I doing wrong here?