MQTT integration receives messages but doesn't discover device

I have a relay (ethernet connected) that worked before but is not discovered anymore.

  • HA receives messages when I listen to the topic in the MQTT integration
  • ‘Enable newly added entities’ is enabled
  • ‘Enable discovery’ is checked

What else can I do/check because I have no idea how to troubleshoot this.

I would suggest listen on all topics and see if there are any MQTT message from your relay that have a discovery topic. The discovery topic should have homeassistant at the beginning. This is called the discovery prefix that by default is set to homeassistant, so hopefully this matches the discovery topic sent by your relay. If this all looks correct, well, hmm…don’t know.

1 Like

Hi @wmaker: thanks for your help!
In the homeassistant ‘branch’ I only have my smartplug, nothing from the relay… :roll_eyes:

If it has already been discovered, why do you need to discover it again?

What firmware are you running on it?

The relay is not being discovered, a smartplug that I have is the only MQTT device.
It worked before with this firmware but somewhere in between updates of HA it stopped working.

Because it’s not in production yet, I did not notice it right away.

Which version of ha did it work with?

What version of ha did it stop working with?

No idea… :blush:

Given this it’s not an HA issue, it’s an MQTT issue. If you aren’t even seeing the messages in your broker then the failure is between the client device and the broker, HA isn’t even involved.

What broker are you using?

Mosquitto on linux

What does the mosquitto log say?

At the bottom of the file I found:

1653684662: New connection from on port 1883.
1653684662: New client connected from as 2154d5e0aa46831378722ee8 (p2, c0, k256, u'mqtusr').

.150 is the IP of the relay

Could this be related to the broker and the changes that were made some time ago in MQTT?

This log seems to indicate that the relay is registering with the MQTT broker…that’s good.

Just to verify, to listen in on all topics, one would subscribe to #. If you are doing this, and you are seeing topics from the smart plug but not seeing any mqtt topics from the relay, then yeah it appears the relay is having some issue.

1 Like

What changes are you referring to? Did you just upgrade your broker or something? If so, between which two versions?

If you’re referring to changes in the Mqtt integration of ha then again, that’s not relevant here. You said you connected to the broker with some kind of client and saw no discovery messages in the homeassistant topic from your relay right? If so then HA isn’t involved at all. Either your relay’s messages are being rejected for some reason (check your acl?) or your relay is failing to send messages at all (maybe check it’s logs? Did you just update it by any chance?)

1 Like

Or that the mqtt devices aren’t using a username and passwd.


Yea that’s why one of the main reasons I was asking if they updated the broker. If they recently went from 1.x to 2.x then they could be in for a rough time with that, discovering all the devices that were actually banking on anonymous connections now that mosquitto disabled that by default.

If they were using the addon I would’ve assumed that was it since the addon recently did that upgrade. But since they said they were separately hosting mosquitto I wasn’t sure.

1 Like

Mosquitto broker 1.x to 2.0 - automatically - at the time I went from Buster to Bullseye.
I discovered MQTT Explorer to get more insight.

I installed Mosquitto in the same LXC as my HA.
I am using username/password for MQTT connections.

I can also control the relay from it’s webinterface: is it not so that when I see messages from changing outputs, that the communication between relay & broker is OK?