Like many, I have a MyQ integration but it seems to break frequently with API changes. I also have Homebridge running on my Synology in a Docker and found that one of the myQ plugins for that also has full MQTT support.
I have nearly everything working except for getting the current state of the doors (we have two).
In configuration.yaml, I have:
# MQTT Cover
- platform: mqtt
name: "My Garage"
command_topic: "myq/(serial)/garagedoor/set"
state_topic: "myq/(serial)/garagedoor"
qos: 0
retain: true
payload_open: "open"
payload_close: "close"
state_open: "open"
state_opening: "opening"
state_closed: "closed"
state_closing: "closing"
payload_available: "online"
payload_not_available: "offline"
optimistic: false
value_template: '{{ value.x }}'
# MQTT Cover
- platform: mqtt
name: "Wifes Garage"
command_topic: "myq/(serial)/garagedoor/set"
state_topic: "myq/(serial)/garagedoor"
qos: 0
retain: true
payload_open: "open"
payload_close: "close"
state_open: "open"
state_opening: "opening"
state_closed: "closed"
state_closing: "closing"
payload_available: "online"
payload_not_available: "offline"
optimistic: false
value_template: '{{ value.x }}'
I then have this as a Lovelace button:
type: button
tap_action:
action: toggle
entity: cover.my_garage
icon: 'hass:garage'
show_state: true
The button is able to initiate a toggle to open/close the garage door
BUT it is not able to read the state of the door.
I tried this but got an error message (failed to call service; required key not provided). Tried payload as true, ‘true’ and “true”
type: button
tap_action:
action: toggle
entity: cover.wifes_garage
icon: 'hass:garage'
show_state: true
hold_action:
action: call-service
service: mqtt.publish
topic: myq/(serial)/garagedoor/get
payload: 'true'
From the plugin:
Topics Published
The topics and messages that homebridge-myq
publishes are:
Topic | Message Published |
---|---|
garagedoor |
closed , closing , open , opening , when garage door state changes are detected. |
Messages are published to MQTT when an action occurs on a device that triggers the respective event, or when an MQTT message is received for one of the topics homebridge-myq
subscribes to.
Topics Subscribed
The topics that homebridge-myq
subscribes to are:
Topic | Message Expected |
---|---|
garagedoor/get |
true will request that the plugin publish the current state of the garage door to the garagedoor topic. |
garagedoor/set | One of close or open . This will send the respective command to the garage door. |
I went into Home Assistant’s MQTT and clicked configure then
Publish a packet
topic
myq/(serial)/garagedoor/get
Payload (template allowed)
1 true
And this showed the state as open when listening using #
So, wondering what I am missing from the above in order to get the current state of the garage doors and, ideally, have that state be available even after restart (currently have to cycle it once to get the sensor I created first to show state)
If it helps, sensor in configuration.yaml was:
- platform: mqtt
name: My Garage MQTT Cover
state_topic: "myq/(serial)/garagedoor"
icon: mdi:cover
- platform: mqtt
name: Wifes Garage MQTT Cover
state_topic: "myq/(serial)/garagedoor"
icon: mdi:cover
THANKS!