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

I want my Homey to communicate with Home Assistant. I have a Broker on my Synology NAS. I have both a client and a hub app on my Homey.
There are two options within that hub.

  1. Home Assistant Discovery. 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. That’s useless. I don’t know why or how…
  2. Normal mode (?), I have again two options.
    2A. Homie Convention v3.0.1 which gives me a topic name of homie/homey-[ID]
    2B. Custom, where I can set the topic myself (although it displays the same homie/homey-[ID]). Also the option: include class in topic, include zone in topic, normalise topics, and % and color format.
  discovery: true
  discovery_prefix: homie

  - platform: mqtt
    state_topic: "homie/homey-[ID]/temperatuur"
    name: "MQTT Test"

This entries in my configuration.yaml doesn’t show anything.

At the same time I’m not sure if the discovery_prefix and state_topic are valid. But here is my knowledge of MQTT to short :frowning:

Home Assistant’s MQTT Discovery doesn’t support the Homie Convention. It supports its own protocol which is described here.

That’s probably because the payload, that the device is publishing to a discovery topic, is missing a json_attributes_topic option or some other option is either missing or not configured correctly.

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:


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.

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


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


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: ""
    unit_of_measurement: '°C'
    unique_id: "temperatuur"