[BETA] MQTT app Home Assistant Discovery and statestream support

Bill - if you hover over those 6 links to MQTT app - are they different ID's each of them ? If so what happens if you click on each of the links ?

@kevin Is the HE -> HA integration built to support the device and entity registry on Home Assistant? So,.for example, a device in HE will be a device in HA and a set of capabilities for the device in HE will be a set of entities for the device in HA?

This makes it easy to take advantage of Areas, Automation, and some other recent adds/updates to HA and also helps keep things in sync around device renames.

I believe so - in so much as HA support of that via its HA MQTT Discovery protocol. I provide in the discovery advertisement the same parent device details for all capabilities which then allows the device to be presented as a device with entities within say one Lovelace UI element.

OK, as long as you also provide a unique_id for each capability/ entity, then it should be good. That's awesome news, thank you!

This is a typical HA Discovery message for a binary sensor - I provide the unique_id and the additional device json which contains the identifiers value which is the Hubitat device ID , Is that sufficient ? If not do let me know what extra I should include so I can improve the import to HA.

"name":"Texecom vContact",
"device_class": "opening",
"value_template":"{{ value }}",
"device": {
    "identifiers": "HE_2818",
    "name": "Texecom vContact",
    "sw_version":"beta 2",

Beta 3 now available

As a little bit of background to HA Discovery from HE . Basically there is a MQTT topic, usually 'homeassistant' that HA watches where devices advertise they are available via MQTT . You configure this topic in both HA and my app.

The 'advertisment' is simply a single config message that tells HA what the device is (device type - within the topic) and what the MQTT topics are that provide for status and control of that device. It also tells HA how to translate (template) the payload values from HE into values that HA will understand e.g. a 0-100 range to 0-255 and how to do the reverse so that HE can understand HA's commands.

In my usage I am sending this information to MQTT using the homie protocol but this isn't of any relevance to HE so the advertisement messages just serves to identify specific topics that HA can get the appropriate information from.

So the 'advertisements' are just pointers to the topics and information on how to 'template' it usefully.


1 Like

@kevin man, I can't thank you enough for making this app. I believe that this is exactly the tool that I need. Also, thank you for steering me over to this thread. I'm still learning the etiquette in how these foums work. I know there is a method to the madness, so I wanted to follow suit. Thank you.

So, the background:

I'm just in the beginning stages of learning HA, and getting it set up. I'm doing this on a CentOS laptop, running Docker. Of course, as such, I don't have any method of interacting with my zigbee or z-wave devices. MQTT seems like the perfect tool to do this. Besides, I've heard that looking for decent z-wave and zigbee dongle hubs is a crap shoot, and I already know that the Hubitat radios are rock solid.

So, I'm wanting to control my zigbee/z-wave devices that are on Hubitat, via HA.

Now the kicker....

I'm MQTT stupid. This is my first time really looking at it. I'm a CyberSecurity profession and network architect, so I know my way around networking protocols. But this is a whole new language. I'll pick it up quickly, but I have to play with it first. Failure is my best trainer.

I had installed both the App Beta 3c and the Driver Client, and Kevin was kind enough to tell me that I didn't need the driver. So, I removed them both, and reinstalled the App.

So, that's where I am. The instructions for configuration are a little confusing for a newbie to makes heads or tails of. This is fine, no biggie, I know this is all changing quickly and a lot to keep up with for the creator. So, it's not a complaint, just an explanation of why I'm here posting the following questions.

I started at the top of the App, and it said to give the Hubitat hub a unique name. I assumed that this is the name I will give for the Hubitat Broker, and named it Hubitat_MQTT.

But the next line asks for the broker address. I'm not sure which broker it needs. The Hubitat IP, or the HA broker. If it needs the HA broker, is the IP to HA with the port 1883 ok, or do I need to use the IP of the mosquitto docker?

I had entered the IP for Home Assistant. The HE logs all show the broker as Null. So, clearly I'm doing something.....dumb..... I know it's dumb, because everyone else using this App is having great success. So, if most people can figure it out, then clearly I'm the one doing the dumb stuff. :smiley:

The devices that I want to use to test all of this are my shelly relays since they can use mqtt directly.

Any guidance you guys can offer a new guy, would be great!

It's the ip:1883 of your MQTT broker. Probably mosquito, at what ever ip/port docker is providing. I don't use docker so I can't help you there. Hubitat talks to MQTT(Broker) which talks to your Shelly's.

1 Like

The MQTT broker is another component in your setup that you need to install. It's the central repository of all the MQTT status and control messages, similar to a small database I guess. You can install one (mosquitto is the favourite) on any device from a Raspberry Pi to Windows. CentOS will host it directly too or there are Docker images for MQTT brokers including Mosquitto.

Now HA has to be able to talk to the MQTT broker as does Hubitat. It is the IP address and port of this that you fill in in the configuration, the port will be 1883. Docker can make this awkward due to exposed port access between containers, but I'm assuming you're familiar with that and can get them talking.

Both HA and HE communicate through MQTT and not directly at all. If your HA Docker is HASS (or whatever it's now referred to) then that includes an addon manager within the install and within that you can install MQTT directly. (bottom left)


1 Like

Thanks fellas! Those were really fast responses!

So, my HA set-up looks a bit like this:

I do have the mosquitto broker add-on, installed and configured. I tested the connection between mosquitto, HA, and Node-Red by just doing an injection and debug node play with MQTT.

So, it would seem that this part is ready to go.

OK good - so does my MQTT app connect OK to your broker ?
The address needs to be entered like this...

Just an observation. There are I think two official MQTT broker addons and one is being deprecated. That I think is the one that you have installed and the one I showed in the store is it's replacement and is based on Mosquitto. I would recommend the Mosquitto based one but it's hard to tell which one you have now as Mosquitto is open source too.

However I'm concerned the add-on I identified says MQTT Server and not MQTT broker.. stay as you are and see if it all works

I don't use an addon for my MQTT broker I installed it elsewhere ..

1 Like

Also, my list of containers, from Portainer, just so we can talk apples to apples.


Ah ok! Good to know!

The one I grabbed is under the "Official Add-Ons" in the Add-On Store. So, the Community Add-On is replacing the Official one? See, this is why I like this community. That's kind of important stuff to know, and you guys are all over it. Thank you.

But to answer your question about your app connecting to it....

No, it doesn't. But I'm a million percent that this is not the app's fault. HA is having some weird authentication issues going on that I have not dug down to yet. I've tried, but like I said it's weird.

It seems that the broker over there is relying on a user called 'homeassistant' to authenticate. The problem is, I don't have that user anywhere. Not in the HA users, not in any yaml file. Any configuration that I use that uses any other user, breaks the connection between mqtt and node-red.

Worse, the only way I was able to get the homeassistant user to work, in node-red, was by trying, and succeeding (much to my frustration as a cybersecurity guy) to drop the password hash, that populated in the mqtt logs, into the credentials for node-red. I shouldn't be able to inject hashes like that and it work, but here we are.

So, I'm having an entirely separate issue with HA authentication. I don't expect you guys to help me resolve that. That's HA's mess, not Hubitat's.

But, just so I can learn my way around the functionality of the Hubitat App, to start with. Let's try to get my Shelly relay's working with the Hubitat App. Does the App make Hubitat a broker?

No - I think I've got that wrong. But the one they are deprecating is not based on Mosquitto so I'm unsure just now..

No - HE can never be a broker , it's a client and requires an external broker.

1 Like

Just for more background info. Here are my shelly's trying to connect to the HA broker

1592865221: Socket error on client , disconnecting.
1592865266: New connection from on port 1883.
1592865266: Socket error on client , disconnecting.
1592865280: New connection from on port 1883.
1592865280: Socket error on client , disconnecting.
1592865286: New connection from on port 1883.
1592865286: Socket error on client , disconnecting.
1592865330: New connection from on port 1883.
1592865330: Socket error on client , disconnecting.

The IP for my Hubitat is (Don't worry, this is all in a lab environment)

So, the MQTT logs in HA are not seeing that IP even try to authenticate and get rejected. It's not hitting the broker at all.

Now I seem to remember that one of the HA brokers creates and enforces HA users with access via the (maybe now deprecated) HA user logins.

Would you be able to run MQTT Explorer. That will be such a help to you in the future and it's very easy to establish and try login credentials via that ?

Upon your recommendation in the other thread, I went ahead and installed it. I may need to watch a few youtube videos to learn to navigate it though

OK - we can sort that , I kinda know what might have happened there but let's get the broker easily accessible , e.g. to the Shellies or more easily and ideally MQTT-Explorer

1 Like