Delay auto boot for add-ons

I’m running Hass.io (0.55) on an RPi3 with the Homebridge add-on installed and set to boot automatically when HA is started. However, some of my devices are missing in HomeKit after a HA restart unless I manually restart the Homebridge add-on again. I’m fairly certain the issue is because some devices take about 10-30 seconds extra for HA to detect after a restart (specifically my WeMo devices), and the Homebridge add-on is started before those devices are discovered by HA, hence the reason they’re not showing up in HomeKit.

I think a simple solution would be to have a delay in starting add-ons so everything is up and running in HA before the add-ons are started.

Similar issue here with Node-RED add-on on Home Assistant 2021.12.7.

The Home Assistant entity nodes – in my case representing the state of my Z-Wave window sensors which are an important input to my blind control flow implemented in Node-RED – aren’t properly initialized yet when the Node-RED add-on starts during Home Assistant startup.

I solved this with an automation which starts the Node-RED add-on (which is configured not to startup at boot) a short time after Home Assistant startup:

automation:
  - alias: Start Node-RED on start of Home Assistant (with a delay)
    trigger:
      - platform: homeassistant
        event: start
    action:
      - delay:
          seconds: 15
      - service: hassio.addon_restart
        data:
          addon: a0d7b954_nodered

Actually, I have to use the addon_restart service (and not addon_start) because the automation has to cover both start and restart of Home Assistant (in the latter case the Node-RED add-on simply runs on and loses its connection to the Home Assistant entities and needs to be restarted).