#Do not wait for an integration to initialize during startup

1 messages · Page 1 of 1 (latest)

agile imp
#

My GoodWe solar inverter can only be reached by the HA integration when the solar panels give enough power. This means Home Assistant hangs during startup, waiting for the integration to initialize to continue the boot sequence. This is especially problematic becase add-ons are only started after the integration has timed out. Is there a way to configure this differently?

#

Or should the integration not block its initialization on being able to reach the inverter?

light creek
agile imp
#

Note that it hasn’t failed yet, the connection attempt just takes a very long time before eventually failing

#

The “Home Assistant has started” toast takes minutes to appear, and it looks like this is the only thing happening

#

(This is on a Home Assistant Green)

agile imp
#

I do see a warning in the logs:

Logger: homeassistant.bootstrap
Source: bootstrap.py:1005
First occurred: 17:12:32 (3 occurrences)
Last logged: 17:14:32

Waiting for integrations to complete setup: {('goodwe', '01KBQ3M3A933P7MRVFBC3XTAT6'): 86.349990605}

light creek
# agile imp I think closer to 3 minutes

so in the integrations code

    try:
        inverter = await connect(
            host=host,
            port=port,
            family=model_family,
            retries=10,
        )

so its waiting for 10 timeouts before it fails which is probably why its slow.

#

I am not sure what the best solution to this would necessarily be though.
how major of an issue is this? how often are you rebooting your green?

agile imp
#

(I am assuming that this blocks the startup somehow, have not checked that in the code)

light creek
light creek
#

reducing the retries to something like 3 or 5 is probably sensible. and would speed things up.

agile imp
light creek
agile imp
tulip cape
#

Better solution would probably be to put it in a separate task so the integration could finalize its setup without waiting if this is a common thing.

agile imp
#

Yes, that does sound better. Is there documentation about what an integration should and shouldn’t do during its setup?

tulip cape
#

It’s too much “depends on” I believe so would not be feasible to try to document but essentially an integration should be working once setup but for special circumstances one might have to do different things