HA staggered start up

THE SITUATION
Quite often after a cold reboot of HA I experience some add-ons or integrations fail to start.

THE HYPOTHESIS
Some add-ons, like e.g. Zigbee2MQTT, depend on other add-ons, link MQTT, to properly start.

MY WORKAROUND
To wait until HA stabilises to then manually restart the add-ons that failed the starting.

THE PROPOSAL
To define a mechanism to stagger the start up of add-ons and integrations based on a dependency table or similar where underlying add-ons integrations are listed and sorted so the latter cannot start until the former becomes available.

NOTE
I make use of add-on watchdog feature.

Addons do not get restarted when you restart HA. They keep running in their own containers.

Unless you are restarting the entire host system. Which you should not be doing “often”.

Thanks! I have clarified the text stating “cold reboot”. As you mention, fortunately I don’t cold reboot the system often although it happens often when I do. BTW, I don’t experience this issue with warm reboots/restarts.

These two lines facilitate this feature already on cold reboot.

"startup": "application",
  "services": [
    "mqtt:need"
   ], 

zigbee2mqtt config line8

initialize will start the add-on on setup of Home Assistant. system is for things like databases and not dependent on other things. services will start before Home Assistant, while application is started afterwards. Finally once is for applications that don’t run as a daemon.

A list of services that will be provided or consumed with this add-on. Format is service :function and functions are: provide (this add-on can provide this service), want (this add-on can use this service) or need (this add-on needs this service to work correctly).

addon config dev docs

1 Like

Thanks for your enlightening reply!

This is exactly what I was looking for. Obviously, I need to improve my googling skills.

I will configure it and be prepared for the next cold reboot.

They aren’t a user configuration, they are in the addon already, atleast for zigbee2mqtt.

Just some feedback in case someone falls in the same:

SHORT STORY
Make use of a high power USB cable.

THE LONG STORY
My R-Pi-3 has all its four USB ports in use:

  1. External SSD
  2. Zigbee module
  3. RTL-SDR radio receiver
  4. RFXtrx433E module

My guess is that during a cold boot there is a high surge of current that may cause a drop in the supply voltage if the power supply cable is not adequately dimensioned. The drop in voltage my lead some USB device to not get properly initialised. I found in the HA log an average of three undervoltage messages a day (supply voltage drops under 4.63V). I decided to go for my homemade 20cm AWG-15 USB cable. So far, it seems this cable has solved the situation.

  1. The system boots accordingly.
  2. No undervoltage message in the HA log.

Notes
a) The homemade cable sustains [email protected].
b) The USB power supply sustains 3A@5V.