No mqtt device can connect after reboot/shutdown

I have a raspberry pi 4 system which was running until yesterday. I have made a shutdown to prevent the system for damage because we had work on the energy system here.

After that i started openhab and it starts fine but … no one of my mqtt things can connect.
I didnt made a upgrade/update or anything else … how is that possible and what can i do that the mqtt units can connect!?

Make sure Broker Bridge is online:
grafik

If not:
Check MQTT Broker:
mosquitto_sub -u <user> -P <password> -v -t zigbee2mqtt/#
(adjust parameters to your needs).

If subscription fails:
Check your MQTT Broker.

If subscription succeeds but no messages:
Check the item from which the MQTT messages originate (Zigbee2MQTT, …).

Sounds like a problem i had a while ago. Check 'sudo journalctl -u mosquitto.service’ . If it says can not write to /var/log/mosquitto/mosquitto.log (permission denied), you need to create a new log. See if https://community.openhab.org/t/mqtt-not-working-after-upgrade/143248 helps.

all checked, mosquitto is running … mqtt broker gets a connection …
but no mqtt client (like tasmota) cant connect …

yesterday it runs withour any problem.

allways get the message:
19:04:49.019 MQT: Connect failed to openhabian:1883, rc -2. Retry in 120 sec

With MQTT Explorer a connection is possible … MQTT Broker is green in openhab

  • any hint to the root cause in /var/log/mosquitto/mosquitto.log ?
  • name resolution for hostname openhabian works ?

new connection is the mqtt borker from openhab

Found it … the name resolution didnt work … what da hell …
have to use ip adresses

1 Like

I would generally recommend to use IP addresses, as name resolution on local networks can be flaky. Sometimes its the computers/devices, and sometimes it’s the router. Reserved IP addresses are the only guaranteed approach.