MQTT support

client-apps
integration
home-automation
Tags: #<Tag:0x00007fe88f3f5bb8> #<Tag:0x00007fe88f3f59b0> #<Tag:0x00007fe88f3f57f8>

#21

Another recipe by @lindsayward in Home Assistant Community Board:

I’m only a few hours into this, so I don’t want to be the one to say, “here’s how you do it”… However :slight_smile:

  • I did all the HA stuff before realising you also had to connect to the garadget settings interface and enable MQTT (since the link here points down the thread, not to the top).
  • I also copied the provided code, not realising that “Home” was a variable, dependent on my setup.
  • As mentioned, you don’t seem to need the sensor… just the extra attributes for the cover.
  • Two more things need to be set in HA customizations (mine through the web interface):
    Set device_class: garage
    Set homebridge_cover_type: garage_door (if you’re using homebridge for “Hey Siri, open the garage door”)

These details are all there, just not in one place.

Here’s what I’m using now. Replace “XXX” with the name/topic you set in the garadget settings.

cover:
  - platform: mqtt
    name: "Garage Door"
    command_topic: "garadget/XXX/command"
    state_topic: "garadget/XXX/status"
    payload_open: "open"
    payload_close: "close"
    state_open: "open"
    state_closed: "closed"
    value_template: '{{ value_json.status }}'

#22

What is the purpose of updating the brightness?


#23

It’s just another sensor you can log or use in your automation scripts.
No need to update if not using.


#24

I’ve tried to deploy the embedded mqtt broker (hbmqtt) in HASS and had issues. Has anyone encounter this before?

configuration.yaml

mqtt:
protocol: 3.1
user: user
password: pass

cover:

  • platform: mqtt
    name: “Garage”
    command_topic: “garadget/Garage/command”
    state_topic: “garadget/Garage/status”
    payload_open: “open”
    payload_close: “close”
    state_open: “open”
    state_closed: “closed”
    value_template: ‘{{ value_json.status }}’

home-assistant.log
ERROR (MainThread) [hbmqtt.broker] Invalid connection from (client @=x.x.x.x:32250) : [MQTT-3.1.2-1] Incorrect protocol name: “MQIsdp”


MQTT in hassio stopped working
#25

What is the version of your Home Assistant?
Also, do you experience this issue with both protocol 3.1 and 3.1.1 ?


#26

I’m running .76.2, with version 1.2 firmware on the garadget.

I haven’t tried 3.1.1. yet, but will.


#27

James,
please let me know how it goes with 3.1.1


#28

Same issues with 3.1.1.

Invalid connection from (client @=x.x.x.x:XXXX) : [MQTT-3.1.2-1] Incorrect protocol name: “MQIsdp”


#29

Home Assistant’s embedded MQTT broker and they keep changing it all the time. I played around with one in the latest version as of today (0.77.2) and it appears that the username is hard coded as homeassistant. So the working configuration for the broker is:

mqtt:
  password: yourpassword

In Garadget’s setup interface configure username as homeassistant and password matching that in configuration.yaml

One instance of connection error message is normal because Garadget attempts to figure out which protocol broker understands by trying different versions.

Incorrect protocol name: “MQIsdp”

Please let me know if this solves your connection issue.


#30

Hi,
I can’t connect to MQTT, tried multiple clients.
I’ve configured my garadget to work with both cloud and MQTT.
The error I’m seeing in my clients is:

2018-09-09 21:28:11,645 WARN  [MQTT Con: loplo141124478      ] [MqttConnectionResultHandler   ]  - Connecting to garadget failed
Unable to connect to server (32103) - java.net.ConnectException: Connection refused: connect
	at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:79)
	at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70)

What am I doing wrong?


#31

@joem
Garadget doesn’t run MQTT broker, it acts as a client. Please use one of MQTT brokers such as Mosquitto, Mosca, HomeAssistant etc to connect both your other client device and Garadget.


#32

Hi @garadget.

I’ve moved to MQTT on Home Assistant with the following config (my MQTT Garage name is “GarageDoor”):

configuration.yaml

sensor:

  • platform: mqtt
    name: “Garage Door Status”
    state_topic: ‘garadget/GarageDoor/status’
    value_template: ‘{{ value_json.status }}’
  • platform: mqtt
    name: “Garage Door Time in Status”
    state_topic: ‘garadget/GarageDoor/status’
    value_template: ‘{{ value_json.time }}’
  • platform: mqtt
    name: “Garage Door Sensor Reflection Rate”
    state_topic: ‘garadget/GarageDoor/status’
    value_template: ‘{{ value_json.sensor }}’
    unit_of_measurement: ‘%’
  • platform: mqtt
    name: “Garage Brightness”
    state_topic: ‘garadget/GarageDoor/status’
    value_template: ‘{{ value_json.bright }}’
    unit_of_measurement: ‘%’
  • platform: mqtt
    name: “Garage Door Wireless Signal”
    state_topic: ‘garadget/GarageDoor/status’
    value_template: ‘{{ value_json.signal }}’
    unit_of_measurement: ‘dB’

cover:

  • platform: mqtt
    name: “Garage Door”
    command_topic: “garadget/GarageDoor/command”
    state_topic: “garadget/GarageDoor/status”
    payload_open: “open”
    payload_close: “close”
    payload_stop: “stop”
    state_open: “open”
    state_closed: “closed”
    value_template: ‘{{ value_json.status }}’

group:
garage_door:
name: Garage door
entities:
- cover.garage_door
- sensor.garage_door_status
- sensor.garage_door_time_in_status
- sensor.garage_door_wireless_signal
- sensor.garage_door_sensor_reflection_rate
- sensor.garage_brightness

automations.yaml

  • id: ‘123456785434’’
    alias: ‘Update Garage Status’
    trigger:
    platform: time
    minutes: ‘/2’
    seconds: 00
    action:
    service: mqtt.publish
    data:
    topic: “garadget/GarageDoor/command”
    payload: “get-status”

Garage Door parameters update successful upon restart but never change later. If I trigger the “open” command, the garage door opens but the status never shows it. The “lower” button never activates and the “raise” button always stays active.

Any clues as to what I’m missing?

Thanks!

W.


#33

I’d look for the clues in the communication logs.
Please post here if you need help interpreting the messages there.


#34

I use Domoticz as my home automation controller. It uses MQTT

Is there any way to customise the MQTT output to fit in with it (I have only just ordered my Garadget)

Here is their wiki on MQTT

https://www.domoticz.com/wiki/MQTT

Thanks


#35

Nice. From what I see in the docs, it should be possible to set it up with Garadget. MQTT is fairly standard protocol except for payloads (the content of the messages) and those appear to be configurable in Domoticz.

If you get this configured, please post your configs. I’ll be happy to answer any of your questions in the process.


#36

I’ve been stuck with this for several weeks. It seems that the get-status command in automation is not having any effect (all garage parameters are NOT changing after the first update)… Could it be the actual unit?


#37

@garadget, and the problem is with the firmware… I initially had my garadget configured for MQTT+cloud. As soon as moved it to MQTT only, it worked!

Running v1.20


#38

Thanks for the update!


#39

Hi, I’ve seen the code above to getting it working with HomeAssistant, but does anyone have anything for working with Homebridge directly. I have the MQTT broker running and working and I’ve tried out a few Homebridge mqtt plugins without much success.


#40

Pete,
When you have other end ready, please give Garadget a try with your MQTT broker and let us know how it went.