MQTT Discovery not working

Tags: #<Tag:0x00007f7395653758> #<Tag:0x00007f7395651f98>

I’m in the process of remodelling my kitchen and whilst doing so, I’ve decided to add smart light; Ikea Trafri. As my server (UnRAID with HA in Docker is a long way away, I’m using a Raspberry Pi 3b+ running zigbee2MQTT and a cc2531 flahed accordingly. Mosquitto is running on my UnRAID and working properly. I use it to report my tablet battery level (WallPanel) to HA and Node-Red and toggle a Sonoff Smartplug accordingly. I manually added the tablet MQTT sensor and it works well.

I have successfully added one bulb to my Pi and can see it in the config file and I’ve renamed it test_bulb. Node-Red can see it, but Home Assistant won’t discover it. I don’t want to have to add every bulb separately, so I really want to get this working.

Here are the relevant bits of my HA config:

  port: 1883
  client_id: HomeAssistant
  discovery: true
  discovery_prefix: zigbee2mqtt/
    topic: 'hass/status'
    payload: 'online'
    topic: 'hass/status'
    payload: 'offline'


  - platform: mqtt
    state_topic: "/HA/sensor/battery"
    name: "WallPanel Battery Level"
    unit_of_measurement: "%"
    device_class: battery
    value_template: '{{ value_json.value }}'

Note: as my discovery prefix i’ve tried zigbee2mqtt, /zigbeer2mqtt, /zigbee2mqtt/ and zigbeer2mqtt/

Node red posts this JSON upon bulb rediscovery:


This is under the topic zigbee2mqtt/bridge/log . It’s worth noting my battery posts with an extra / at the start /HA/sensor/battery .

I am bamboozled as to why discovery does not work. Can you help me? Thanks

developer tools >> mqtt >> Listen to a topic

Set the “listen to” to “#”

Verify messages received and no typo in topics

Yup, I’m getting stuff.

Message 11 received on zigbee2mqtt/bridge/log at 12:07 PM:

    "type": "devices",
    "message": [
            "ieeeAddr": "0x00124b0009efac7b",
            "type": "Coordinator",
            "networkAddress": 0,
            "friendly_name": "Coordinator",
            "softwareBuildID": "zStack12",
            "dateCode": "20190619",
            "lastSeen": 1585998463620
            "ieeeAddr": "0x680ae2fffe3696b2",
            "type": "Router",
            "networkAddress": 15831,
            "model": "LED1537R6",
            "vendor": "IKEA",
            "description": "TRADFRI LED bulb GU10 400 lumen, dimmable, white spectrum",
            "friendly_name": "test_bulb",
            "manufacturerID": 4476,
            "manufacturerName": "IKEA of Sweden",
            "powerSource": "Mains (single phase)",
            "modelID": "TRADFRI bulb GU10 WS 400lm",
            "hardwareVersion": 1,
            "softwareBuildID": "2.0.022",
            "dateCode": "20190308",
            "lastSeen": 1585995764766

Zigbee2mqtt also uses a configuration.yaml file and its instructions say you must set homeassistant: true in order to make it publish discovery topics.

Please confirm you have set that option in zigbee2mqtt.

If you’ve enabled it, then there’s no need to change the discovery_prefix option (the default is homeassistant).

Yup, it’s set to true…

In that case zigbee2mqtt will publish its discovery topics in the default format defined by Home Assistant (topic’s root name is homeassistant).

When debugging MQTT issues, I’ve found it helpful to use an independent MQTT client like MQTT Explorer.


When you restart zigbee2mqtt, you should see discovery topics being published (like homeassistant/sensor/some_name/config).

HA must see the message also.
I was pointing out how to verify the message is received by HA and that message was in expected format

I expect it is connecting mqtt but usually problem is simple like input wront topic in HA config or typo.

I assume you know this but I will mention it for those who don’t: receiving messages via that topic means Home Assistant is connected to the MQTT Broker and so is zigbee2mqtt. What it isn’t confirming is that Home Assistant is receiving the messages zigbee2mqtt publishes to Home Assistant’s discovery topics.

From the documentation, discovery topics have this format:


So you want to see messages published to a topic that looks like this:

1 Like

Yup, reverting to homeassistant as the topic sorted it. Thanks for your help Taras.

1 Like