So the homebridge-mqttthing and homebridge-mqttgaragedoor plugins got me close to having the door operate in HomeKit via MQTT, but while you can sometimes open or close close (but not always) neither are reliable about getting the status of the door.
So if someone wants to get the MQTT process working with Homebridge it seems like itās working ok now for me. Install the homebridge-mqttthing plugin, and then use the following configuration. Just replace the ExampleGarageDoor with your door name.
"accessories": [
{
"accessory": "mqttthing",
"type": "garageDoorOpener",
"name": "Garage Door",
"url": "http://192.158.0.10:1883",
"logMqtt": true,
"topics": {
"setTargetDoorState": "garadget/ExampleGarageDoor/command",
"getTargetDoorState": {
"topic": "garadget/ExampleGarageDoor/status",
"apply": "return JSON.parse (message).status;"
},
"getCurrentDoorState": {
"topic": "garadget/ExampleGarageDoor/status",
"apply": "return JSON.parse (message).status;"
}
},
"doorValues": [
"open",
"closed",
"opening",
"closing",
"stopped"
]
}
]
I am experiencing the same behavior. I have a slow internet connection at my house and was experiencing random status changes when connected to via cloud (I assume this was cloud related). I changed to MQTT and Cloud (keeping cloud as a backup in case my server went down). My status would not update via MQTT. I switched to only MQTT and it updates correctly. I would still like the option to use both Cloud and MQTT functionality.
I think this can only be resolved with a firmware upgrade.
Iām trying to get my Garadget to work with HASS. I couldnāt get the Garadget cover to work so now Iām trying MQTT. I too enabled MQTT + Cloud and now my Garadget app is very slow and HASS is still not operating the Garadget or receiving status from it. Iāll try reconfiguring the Garadget for MQTT-only tomorrow.
I would also prefer to have the MQTT+cloud functionality working!
MQTT+Cloud works fine on my Home Assistant 0.85.0 with Garadget Firmware v1.20
Do you get any errors in HASS logs?
Thanks for your reply. Iām on HASS 0.86.4, also with Garadget firmware 1.20.
I suspect my HASS setup isnāt quite right then. Thereās nothing in the log related to Garadget though I havenāt played with the log settings, assuming any errors would appear in the log with the default settings.
My HASS configuration. yaml is a combination of things Iāve found that eliminated the errors I got with the configuration on the http://www.homeassistant.io/components/cover.garadget page. I found that neither the āstandardā example nor the MQTT example on that page worked for me.
@garadget, any chance you could share your working configuration (with IDs, passwords etc deidentified of course)? I suspect thereās some subtlety to the configuration that the docco hasnāt kept up with. Iāve come across other references to that possibility in my research (eg: https://github.com/home-assistant/home-assistant/issues/20420#issuecomment-457998017 ).
Sure, hereās configuration.yaml
logger:
default: warning
logs:
homeassistant.components.mqtt: debug
mqtt:
password: *******
# Garadget
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "garadget/Home/command"
state_topic: "garadget/Home/status"
value_template: '{{ value_json.status }}'
icon_template: >-
{% if is_state('cover.garage_door', 'closed') %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
sensor:
- platform: mqtt
name: 'Garage Door'
state_topic: 'garadget/Home/status'
value_template: '{{ value_json.status }}'
icon_template: '{% if is_state("sensor.garage_door", "closed") %}mdi:garage{% else %}mdi:garage-open{% endif %}'
- platform: mqtt
name: 'Garage Brightness'
state_topic: 'garadget/Home/status'
unit_of_measurement: '%'
value_template: '{{ value_json.bright }}'
Thanks Denis,
Iāll tweak my settings to match yours when I get home from work later today.
BTW, I use the āsecrets.yamlā file for my passwords. I assume thereās no problem with doing that for the mqtt password?
Cheers,
Rob Hills
Waikiki, Western Australia
Hi Denis,
Iāve tweaked my configuration to match yours, but Iām still not quite there. Part of my original problem was that Iād missed making a pinhole in my firewall between LAN and WiFi networks for MQTT traffic but Iāve sold now. What I see in the log now (with debug turned on) is the following:
2019-02-05 00:30:22 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to garadget/My_Street/status
2019-02-05 00:30:22 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to garadget/My_Street/status
2019-02-05 00:30:22 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to garadget/My_Street/status
2019-02-05 00:35:17 ERROR (MainThread) [hbmqtt.broker] Invalid connection from (client @=192.168.23.157:12218) : [MQTT-3.1.2-1] Incorrect protocol name: "MQIsdp"
2019-02-05 00:36:14 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on garadget/My_Street/command: close
Iām not sure why Iām getting the āIncorrect Protocolā error.
I donāt see any status change in response to the ācloseā command and the door doesnāt close.
TIA,
Rob
Waikiki, Western Australia
Iāve upgraded HA to 0.86.4 and hereās the relevant log from the first boot (looks healthy):
|2019-02-04 16:50:21|stdout|e[36m2019-02-04 09:50:21 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on garadget/Home/status: b'{"status":"closed","time":"102m","sensor":97,"bright":11,"signal":-41}'e[0m|
|2019-02-04 16:50:21|stdout|e[36m2019-02-04 09:50:21 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to garadget/Home/statuse[0m|
|2019-02-04 16:50:21|stdout|e[36m2019-02-04 09:50:21 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on garadget/Home/status: b'{"status":"closed","time":"102m","sensor":97,"bright":11,"signal":-41}'e[0m|
|2019-02-04 16:50:21|stdout|e[36m2019-02-04 09:50:21 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on garadget/Home/status: b'{"status":"closed","time":"102m","sensor":97,"bright":11,"signal":-41}'e[0m|
|2019-02-04 16:50:21|stdout|e[36m2019-02-04 09:50:21 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to garadget/Home/statuse[0m|
|2019-02-04 16:50:21|stdout|e[36m2019-02-04 09:50:21 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to garadget/Home/statuse[0m|
Re. white spaces in name: I donāt find anything about them not being allowed, but Iād at least test with SomeStreet as the name. For debugging you can try getting mosquitto broker and use their client to manually connect/subscribe with home assistant and see if there are any errors.
Hi Denis,
Thanks for your reply. Sorry, but I suspect I updated my post while you were writing the reply. I discovered and fixed a firewall issue and now I have a new problem (see updated previous post).
It may respond to the Mosquitto broker suggestion, but I figured if yours works with the inbuilt mqtt broker, mine should too ?
Cheers,
Rob
Please try using the password setting as in my config, at least to rule out that as the source of the error.
Hi Denis,
I notice in your log it says Subscribing to garadget/Home/statuse
rather than āstatusā. Can you confirm that your state_topic value is āgaradget/Home/statusā and not āgaradget/Home/statuseā? I suspect the log output is some sort of log formatting anomaly, but thought Iād check.
Iāve tried moving the mqtt password from secrets.yaml into the main configuration.yaml file but the only change Iāve seen since then, which may or may not be related, is that Iāve now lost the āincorrect protocol nameā error I was getting before. Still no status messages in the log and no response to attempts to open it.
I changed back to my original configuration (with the password in secrets.yaml) and now have the same outcome as the previous step: no āincorrect protocol nameā but no status messages, no response to attempts to open it.
I think the next step will be to try changing the ID on the Garadget itself from āMy Streetā to āMyStreetā as you mentioned previously.
Cheers,
Rob Hills
Waikiki, Western Australia
Not getting protocol error message is already a positive result. Iād keep that version while trying to make other things to work. Then when everything works it would be a good time to figure out the way to separate the password.
In case anyone else runs into this: apparently the max number of characters for the mqtt password for garadget is 31, and it will silently truncate to 31 if you put in something longerāwhich prevents the garadget client from connecting to an mqtt server expecting the full password (lots of āSocket error on clientā errors in the mosquitto server log).
Are there any plans to expand garadget mqtt support? Iād like to use ssl with certs from letsencrypt on my mqtt server, but I donāt see any way for garadget (connecting to IP only, only authenticating via username/password) to support that configuration as it currently stands.
Seems like perhaps the sample brightness-updating automation isnāt valid anymore. We have to use time_pattern now:
- alias: 'Update Garage Brightness'
trigger:
- platform: time_pattern
minutes: '/2'
action:
service: mqtt.publish
data:
topic: "garadget/Home/command"
payload: "get-status"
icon_template
doesnāt work anymore either but I added device_class: 'garage'
to the cover for the same icon effect
I also had to change value_template for the cover to fix the above unknown-state bug. I got it to show an open state when itās anything but closed, making the icon the open state when the door reports being partway through as āopeningā and āclosingā
value_template: >-
{% if value_json.status == 'closed' %}
closed
{% else %}
open
{% endif %}
Iām using MQTT-only but Iām not sure if thatās required to make this work.
Just wanted to let you all know that I open sourced the Garadget integration for Homebridge, using MQTT project. Everything was especially easy to code up thanks to the great work of the team over at Garadget! Keep up the excellent work!