MQTT bridge not working after first HA reboot

Morning,

Newbie question.

I am just looking for a little help as to where I need to look to find out why when I reboot HA my MQTT bridge does not work correctly.

Background.

I have MQTT setup where I recieve data directly to MQTT on HA for the Hildebrande IHD and have setup a bridge so that I can receive the Victron MQTT data. All of this working fine.

The isue that I have come across is when the system is rebooted. I use MQTT explorer to watch what is happening and only data from the IHD is active, although there does not appear to be any error messages reported in the ‘mosquitto broker’ logs

I have checked to ensure that the ‘keepalive’ for the Victron is running.

When I manually restart Mosquitto broker from within HA the bridge to Victron works correctly.

If someone could point me in the direction I need to look that would be much appreciated.

Regards,

Graham.

Can you check if the client that doesn’t publish without a reboot connects via a hostname or an IPv4 address? (e.g. homeassistant.local verses 192.168.0.123)

HASS MQTT doesn’t work with IPv6 (raised a GitHub ticket years ago), and mDNS / *.local / *.home hostnames can be unreliable depending on your LAN.

The other possibility is the broker restart causes the client to publish immediately (e.g. the Victron might usually only publish once an hour) or connect only on the second start-up. No idea why, buy you’re doing the right thing by using MQTT Explorer to look at what is actually going on. Deleting retained topics might also be worth a test.

PS Text formatted with code blocks is much easier to read and understand than screen-shots.

I’m also going to point to a walk-though of all MQTT settings as a check, but not sure there’s much wrong without turning on higher levels of Mosquitto logging and capturing the debug logs:

If you do increase Mosquitto logging, it’s normal to see connect/discoonect from “odd” IPv4 addresses - this is likely the HASS add-on reconnecting reguarly via Docker internal addresses:

2023-06-20 12:54:17: New connection from 172.30.32.2:33138 on port 1883.
2023-06-20 12:54:17: Client <unknown> closed its connection.

If this helps, :heart: this post!

Hi @FloatingBoater,

Thanks for the reply.

My HA is setup with a IPv6 address, which I connect to via Duckdns, so that may cause some issues.

I will enable debug logging with the Mosquitto broker, to see if that shows up anything else as to why the items going via the MQTT bridge don’t seem to be picked up until the manual restart.

I will reply again when I have had time to check on the debugging and to see if I can make any sense of it.

Regards,

Graham.

Hi @FloatingBoater,

I have turned on the debugging this morning to see if I can see anything obvious, but no joy.

Basically Mosquitto only sees the Published messages from the Victron invertor (via the bridge) when the broker is manually restarted, and there is no other clue as to what is happening.

As I know how to resolve the issue (manual reboot) it is not the end of the world. I am going to leave this for the time being.

If I get the inclination, I may go and have a look at the github code to see if I can figure out what is going on.

Regards,
Graham.

Try setting IPv4 addresses in the client and retest - wierd mess went away for me.