MQTT: From Homey to HA: Home Assistant Discovery doesn't work, but a custom protocol doesn't either

For homeassistant the discovery_prefix is homeassistant.

@teras then I still don’t know what I have to do… option 1 or option 2B in my hub-app.

With the first, I don’t know how to configure it the right way. If I use MQTT explorer, I don’t seem to see the homeassistant-topic, only the homie-topic.

So, how do I check this? And how to I fix this? I cannot find anything with json_attributes_topic inside the hub app that publishes.

Let me ask it differently:

  1. Should I go for the special homeassistent discovery option or the manual option in the device that publishes.
  2. Do I only need to use the GUI to connect to MQTT? (But how do I get a temperature value inside that sensor).
  3. Do I need to put more in my configuration.yaml file to set things right? And what.

Taras, I think you are confusing Homey with Homie. Homey is a smarthub as wink and smartthings.

Well, to make things even more confusing, I am talking about both Homey (the platform) and homie (the mqtt thing).

Well, I would start with installing mqtt explorer, and see what messages are being send. Copy some and post them here. Then we can give some more advice.

1 Like

Did you read this :

I was referring to option 2A:

That’s not a viable option for use with Home Assistant because its discovery process doesn’t support the Homie Convention.

Nor would would Home Assistant’s MQTT Discovery support option 2B because it still does this: “although it displays the same homie/homey-[ID]”

The only viable option is 1 but the Homey device doesn’t appear to use it effectively because:

I see all my devices in HA. Except for some of the fields. For a door/window sensor, the battery field is empty but for my temperature sensor both temperature and humidity are empty.

According to the documentation link you posted, the extent of configuring Homey to use Home Assistant’s MQTT Discovery is this:

Under ‘HOME ASSISTANT DISCOVERY’ the switch is ENABLED

It must be working to some degree because iAmRenzo reported “I see all my devices in HA”. The problem is that Homey’s MQTT Hub App isn’t publishing all the desired data and so we get:

For a door/window sensor, the battery field is empty but for my temperature sensor both temperature and humidity are empty

Given that there are no configuration options beyond “set to ENABLED”, I doubt there’s much else that can be done to coax Homey’s MQTT Hub app to supply the missing data.

I don’t think there’s an available option to fix it. You are limited to whatever Homey publishes and, from what I read in the documentation link posted above, the only configuration option for Homey’s MQTT Hub app is to simply enable the discovery process. There appears to be no way to control what it publishes to a discovery topic. I’ll clarify that I may be wrong because there are 147 posts in that linked thread and maybe one of them explains how to do it.

@francisp yes. I did, it results in not receiving the temperature value of a temperature sensor :frowning:

With an explorer I get all I want, except not with a homeassistant topic, but with a homie topic. I don’t know how to pick up on the homeassistant one.

@123 it’s quite weird that it sends out all the desired values, but homeassistant doesn’t pick it up…
Therefore the question: do I need to make a custom topic (situation 2B from my first post) or do something in the configuration.yaml to get it right.

Home Assistant’s discovery topics look like this in MQTT Explorer:

Screenshot from 2020-06-25 15-03-52

If you do not see any MQTT topics beginning with homeassistant than I don’t understand how you can see any devices automatically created in Home Assistant. Perhaps the payloads posted to the discovery topics were not posted as retained messages. On way to confirm that is by restarting Home Assistant.

If you restart Home Assistant, do the devices disappear or do they remain visible in Developer Tools > States?

The sensors are probably there, just not in the correct format for homeassistant to auto-discover. But without actually seeing what mqtt messages are send, it is impossible to show you how to configure homeassistant to use them. That’s why I asked to post the messages from mqtt explorer.
Plus what Taras posted above, if there are no homeassistant/ topics, nothing could be discovered.

Using option 1) the /homeassistant topic must be there because HA discovers devices. The fact extra sensor information is absent you probably can’t fix. Is it possible these appear as separate sensors maybe ?

Now 2A) ( 2B) is a non standard variation) implementing the homie protocol that HA does not support. So auto discovery won’t work. However if you were to manually add the MQTT devices into HA configuration.yaml you could import the sensors to HA from a topic within the homie node tree, They use easy text vales, not JSON.

So recognise the main device using HA protocol and manually add the sensors.

In actuality the HA protocol is mainly just a set of pointers to those homie topics anyway.

Best advice.

@iAmRenzo
Post a sample of the topics and payloads listed under homie and we can help you create appropriate MQTT Sensors (and templates) to extract whatever you need (assuming it’s available in the homie topics).

@iAmRenzo Each node within homie has a $properties topic that lists all the capabilities that specific internal Homey device exposes, measure-temperature, dim, onoff etc. Below that each node has several sub topics each named and matching a property, e.g, measure-temperature and it is this topic that holds the value payload. You can ignore the rest of the topics.

If it is a controllable device ($settable=true) then you can use that same topic name with /set appended to control it on Homey…

I’ll post a screenshot later

Here is an example simple radiator valve ‘thermostat’ depicted as a homie node kh-bed’ . It has two properties (measure-temperature and a settable target-temperature) ,. This happens to originate from a Homey controller but it could be any other homie controller like Hubitat Elevation for example… You are interested in the two or three highlighted topics

image

This is weird, I must have looked wrong, now I see both topics

homeassistent

homie convention

So any custom settings for home assistant (my option 2B) isn’t an option for home assistant? It’s quit annoying or plain dumb that the MQTT Hub app doesn’t give the right values and details.

When copying from MQTT-explorer, please use the MQTT explorer copy button, so we can see the text.

A sensor from the homie convention could be :

  - platform: mqtt
    name: "temperatuur"
    state_topic: "192.168.2.21/homie/homey-5e15acxxx26b7ae/temperatuur/measure-temperature"
    unit_of_measurement: '°C'
    unique_id: "temperatuur"

@iAmRenzo Wait, stop, relax!

I’m the developer of the Homey MQTT Hub app.
FYI: I don’t use my Homey any more, fully migrated to HA in the meantime.

I do understand your frustration. The Homey MQTT Hub app is used by many people to connect to different platforms (Google Home, OpenHAB, Magic mirrors, Node-Red, etc.), HA is just another candidate. This is also the reason why there are so many settings and configuration options.

Yes I know, it’s confusing and I hear you screaming:

Even giving bad reviews already: https://homey.app/nl-nl/app/nl.hdg.mqtt/MQTT-Hub/

What you’re trying to achieve is level ‘advanced’, and to be honest, many of the heavy lifting is already done for you. But don’t forget it’s extremely experimental (beta) and all is build for free by developers in their spare time (both HA & Homey apps). Also, most but not all HA device types are fully supported. Furthermore both platforms (Homey & HA) evolve and change rapidly.

And for real, you discovered MQTT just two days ago: https://community.athom.com/t/why-mqtt-and-broker/31615.

So, now let’s investigate your problem: Some of your device states (Homey capability values) are not submitted / updated / available in HA.

Actually I think you were almost there already. If I understand correctly, all your Homey devices are automatically discovered by HA? So probably there is a small hickup in communication, the first thing to try is: restart the MQTT Client & Hub apps (in this order). Homey has limited resources and sometimes the socket connection between these apps is overloaded.

Some additional info: The Hub contains two communication protocols: Homie & HA Discovery. Forget Homie, Home Assistant has not implemented the Homie Convention and therefore will not work out of the box.

Most info can be found here: https://community.athom.com/t/mqtt-hub-gateway/6766

3 Likes

You can appreciate how difficult it becomes for someone to provide you with assistance when the reported information is incorrect.

In this screenshot:

it is missing important information. Perhaps it is actually present but your screenshot cropped it out. The structure of a discovery topic is like this:

<discovery_prefix>/<component>/[<node_id>/]<object_id>/config

Example:

homeassistant/sensor/temperatuur/measure-temperature/config

Is that what you are actually seeing in MQTT Explorer’s list?