Automation to check if home assistant is fully loaded

I am trying to write an automation to reload the lifx and shelly integrations when they become unavailable due to network failure.

I have it working with a while loop but this is slowing down the startup proces.
Is there any way to determin when home assistant is fully loaded.

It would by nice to have a sensor for this (created at the time te message gets sent to the user interface. (maybe it is but i can’t find it)

i think it would be better to have it as a native HA event for trigger

There’s an event you can use for automations:

trigger:
  - platform: homeassistant
    event: start
2 Likes

That does not work, since all integrations are not always loaded at that point. I had to add at least a 20s delay after that or calling an integrated entity action on HA start would fail

All integrations are loaded before that event is dispatched. Whether the devices that are part of the integration are ready is a different matter.

Using this event in conjunction with an unavailable entities sensor (template, python script, plenty of examples on the forums recently) is the best way to ensure that everything is ready and correct (or not!) before proceeding.

I have this automation, and he works perfekt!

- id: Home-Assistant
  alias: 'Home-Assistant Neugestartet'
  initial_state: 'on'
  trigger:
    - platform: homeassistant
      event: start
  action:
    - service: telegram_bot.send_video
      data:
        #url: "https://www.home-assistant.io/images/favicon-192x192-full.png"
        file: "/config/www/wallpaper/ha.mp4"
        caption: "HOME - ASSISTANT Neugestartet!"
    - service: telegram_bot.send_document
      data:
        file: "/config/home-assistant.log"

Thanks all for the replies.
However there seems to be some misunderstanding on what i am trying to do.

I’m trying not to trigger an automation at startup.

It looks like 2:30 in the morning isn’t a good time to fix problems because the solotion was actuely quite simple.
I added a trigger from state condition for the ‘on’ and ‘of’ states and it works perfectly.

It might not be the best solution but it works so I’m happy :smiley:

For automations I don’t want to trigger at startup, I use the uptime sensor.

2 Likes