Hi,
I have my garage door set up as follows right now:
cover:
- platform: template
covers:
garage_door:
friendly_name: "Garage Door"
value_template: >-
{%- if is_state("binary_sensor.garage_door_state", "on") -%}
Open
{%- else -%}
Closed
{%- endif -%}
icon_template:
'{% if (states.cover.garage_door.state) == "closed" %}
mdi:garage
{% else %}
mdi:garage-open
{% endif %}'
open_cover:
service: homeassistant.turn_on
entity_id: switch.sonoff_100097dbf9
close_cover:
service: homeassistant.turn_on
entity_id: switch.sonoff_100097dbf9
stop_cover:
service: homeassistant.turn_on
entity_id: switch.sonoff_100097dbf9
I’d like the cover to use all 4 states (open/opening/closed/closing) instead of just 2 (open/closed) in order to display a correct status in HomeKit. Currently, with only 2 states, “closing” and “opening” states are displayed rather randomly in HomeKit.
To do so, I’ve installed 2 MQTT binary sensors which report all 4 states. However, I’m struggling to implement this properly in configuration.yaml. Essentially, I’d like each of the 4 states to be reported via MQTT, but operation commands (open, close, stop) to still be performed via a Sonoff switch (integrated via HACS Sonoff component). Here is the config I’ve tried:
cover:
- platform: mqtt
name: "Garage Door 2.0"
state_topic: "tele/RF_Bridge/RESULT"
qos: 0
retain: true
open_cover:
service: homeassistant.turn_on
entity_id: switch.sonoff_100097dbf9
close_cover:
service: homeassistant.turn_on
entity_id: switch.sonoff_100097dbf9
stop_cover:
service: homeassistant.turn_on
entity_id: switch.sonoff_100097dbf9
state_open: "066D39"
state_opening: "078FC3"
state_closed: "078FC9"
state_closing: "066D33"
optimistic: false
value_template: '{{ value.x }}'
This is the config validation error:
Invalid config for [cover.mqtt]: [open_cover] is an invalid option for [cover.mqtt]. Check: cover.mqtt->open_cover.
It appears that MQTT Cover doesn’t support commands that would let me directly call a service to turn on a Sonoff switch.
Is there a workaround that would let me use a Sonoff switch to control an MQTT cover? That is apart from flashing Tasmota on the Sonoff switch to turn it into an MQTT switch and just having a full-blown MQTT cover.
Thanks!