I have a strange MQTT problem which I cannot fix

I have a strange problem when I got a new internet provider (and router etc). I cannot get it to work as it used to, even though I checked the settings.

So, I have a broker on my NAS (Mosquito, no settings). I have a MQTT client pointing to that broker (I checked the IP and port if it’s pointing to my NAS). I have a MQTT hub (the app I can select devices in to send them out), with Home Assistant Discovery On. The topic, status topic, on-/offline message I checked and put into the configuration.yaml file.

mqtt:
  broker: 192.168.1.26
  port: 1883
  discovery: true
  client_id: home-assistant
  discovery_prefix: homeassistant
  birth_message:
    topic: 'hass/status'
    payload: 'online'
  will_message:
    topic: 'hass/status'
    payload: 'offline'

But in Home Assistant, there is no device to see… but, in MQTT Explorer I do see all my devices.

What is going on?

Your devices, do they support HA autodiscovery ? If not, you have to configure them manually.

Do you see messages like this :

image
image

The thing is, I had this working perfectly. When I changed modem/router/dhcp-server it went wrong. Yesterday, all of the sudden I had every entity in Home Assistant, but then they went " no data" on my. I deleted the whole MQTT entities and configuration in the yaml file.

My MQTT Explorer looks like this:

The MQTT hub app on my device has home assistant discovery enabled.

I have to say, I just know to little to troubleshoot it. The explorer app only needs the IP address of the broker to display all the devices and states. I thought home assistant also works like this, but it seems not. I am not sure what client_id and discovery_prefix is. Same goes for birth and will messages, but they are configured in the hub-app as I said in my topic start configuration.

Check logs if HA doesn’t complain about mqtt
On Integrations page you should fond Mqtt card. Is it configured?

When you said you changed dhcp, have HA/MQTT adress(es) changed?

Yes, there was a new IP-range. But I corrected that everywhere. The explorer can find the details (see screenshot) so I think it’s something in Home Assistant.
I deleted my home assistant configuration and started fresh. Broker IP, hub and client pointing at each other the correct and new IP-address. Which I also made static with DHCP-binding in the router.

So, I deleted the MQTT configuration in the config-file, and removed the integration. Restarted. Then I added the MQTT configuration back in the file, rebooted the server: nothing.
The MQTT card is back stating ‘configuration.yaml’. But there aren’t any entities.
When I click configure and add ‘homeassistant’ or ‘homie’ as topic to listen to… nothing.

There is nothing in the logs. I have no idea. Do I add the configuration in the yaml-file or do I add MQTT in the GUI? Is that a difference?

hard to say.
But I suggest to remove mqtt config from configuration.yam, then configure it in mqtt integration

Schermafbeelding 2020-11-19 om 09.41.34

This should be enough then?
For MQTT explorer there is no need for a username/password to see all things.

This results in nothing visible in Home Assistant. But it’s the same I enter for the other MQTT Explorer app (and that shows everything). I really don’t get this. Why is Home Assistant so difficult in this?

Do I need to enter something with the listen to topic?
Do I need to manually enter something in the configuration.yaml file?

Things get even more strange… I deleted everything again, and there they were: all MQTT devices.
I enabled the yaml mode in my configuration, restarted the server and everything was back to unavailable. What the heck is going on inside Home Assistant to no receive my devices anymore?

They were really there, and the small gray bar on the right stats unavailable again?! #wtf

I’m only guessing, but I think your homey does not send the home assistant discovery messages as retained messages.

Oh, and if you use the mqtt add-on, you need a username and password.