[BETA] MQTT app Home Assistant Discovery and statestream support

That error is actually stopping the app ? OK I’ll take a look shortly.

You did re-enable ‘remember’ ? Re ‘unavailable’ in HA

OK so removed mqtt app instance and rebooted. Then thought I ought to remove the mqtt device too, so did that and rebooted again.

While doing that I completely shutdown my home assistant containers and deleted ./storage/
core.device_registry
core.entity_registry
core.restore_state

I recreated the client device with a new name, and gave the app a new discovery topic to boot. I then reinstalled the MQTT app, enabling only switches and motion detectors to start. This time the logs show that the startup completed successfully, and the devices I enabled are available in home assistant, but those devices under hubitat still show up as in us by 6 copies of the mqtt app. Not sure what that's about.

Interestingly, devices with capabilities that I haven't enabled yet still show with the 6 copies of mqtt thing. So for example, I have several smoke detectors that I have not enabled via the smoke or carbon monoxide capabilities, but they have 6 copies of mqtt listed. I suppose these are enabled by the IMPORTANT toggle all step...

What happens if you disable the smoke sensor devices here ? You technically only need devices enabled here that might be controlled from MQTT and in beta2 you don’t need any.. I ask for ‘all’ so that none is missed.

I think there is some residual attachment here and I can understand each attribute enablement might cause an entry - but there aren’t 6 attributes/device and mine only show 1./ device

You're right, I don't actually need the smoke detectors shared via mqtt, I was just using them as an example of the 6 app behavior thing.

I have to kind of get on with my day here. Right now I have enough back up and working that the house works. I'm going to leave it like that for now but tear this all down and rebuild it again tonight.

I neglected to check and see if, even after deleting the mqtt app and the mqtt device, if each of my other devices was still reporting that its in use by 6 mqtt apps.

When are you planning on releasing beta2?

About a week but maybe sooner... rename the app from ‘MQTT ‘ if you do install again, and reboot after the removal. I haven’t had any other reports like this but that doesn’t mean it’s not an issue.

I will get you sorted Bill and I think you’ll be pretty happy.

Well I'm not un-happy right now. The auto discovery is badass. A little speedup here and there and I'll be thrilled, especially when it comes to 2-way comms between ha and he.

As far as my thermostat goes. This devices is actually controlled by an app and device handler on hubitat that I kind of munged together back in the smartthings days and then got working on hubitat. Ultimately it just talks to rheem's (the furnace manufacturer's) API.

I think I can just ditch the Hubitat app and send REST commands to it directly from Home assistant. I was planning on experimenting with that this week. I only ever do a couple of things with it- setting heating and cooling set points, and mode, so it should be fairly simple.

As long as it has thermostat capability and implements the required commands and attributes in a standard way it will (should) work. If you enable it does it create an appropriate device on MQTT ?

Quick Q.. have you perchance installed and deleted this app 6 times .. does that 6 increase with every install ie the listed in use entries are for now deleted app installs ?

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",
"availability_topic":"homie/development/$state",
"payload_available":"ready",
"payload_not_available":"init",
"unique_id":"Hubitat-MQTT:_texecom-vcontact",
"device_class": "opening",
"state_topic":"homie/development/texecom-vcontact/contact",
"payload_on":"true",
"payload_off":"false",
"value_template":"{{ value }}",
"device": {
    "identifiers": "HE_2818",
    "name": "Texecom vContact",
    "sw_version":"beta 2",
    "model":"development",
    "manufacturer":"Hubitat"}
}

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.

image
image

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)

Kevin

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...
image

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.

image