Problem - MQTT Connection Establishment after electricity black out

Hi,

I’m using CloudMQTT with Home Assistant on RPI3.

In the normal situation, it’s working fine.

However, when there is electricity black out, I get below error as home assistant started before internet is ready (My router is also off and restart during black out too) so as result, I need to restart Home Assistant after electrical black out. Otherwise, owntrack and MQTT equipment will not work.

Anyone have good solution to this?

Try this:

I have also changed mosquitto.service to wait for network and so far, so good.

What I have now is:
[email protected]

[Unit]
Description=Home Assistant for %i
After=network.target mosquitto.service

mosquitto.service

[Unit]
Description=Mosquitto MQTT Broker
After=network.target

Both services wait until network is ready and home-assistant also waits until mosquitto is ready also.

Try it out yourself.

Hi,

I tried many different configurations but it still doesn’t work:

Below is for example:

I’m not sure if the way I connect Raspberry Pi to Router using LAN cable causes it to connect before the internet is ready.

Any other things I should try?

[Unit]
Description=Home Assistant
Wants=network-online.target
After=network.target network-online.target

I have a patch for this issue by adding “boot_delay=300” which will delay Raspberry Pi boot process by 300s and this give enough time for internet to be up & running before anything happens with Home Assistant.

Still looking for better solution without delaying boot still, please.