Sometimes you may need to measure the exact time required by Home Assistant to start. This can be especially useful for low-performance Raspberry Pi boards. There is a very good custom component for this made by AlexxIT who is well known as the author of Xiaomi Gateway 3 and SonoffLan components.
We will use another tiny component made by him named StartTime. It does one thing and does it well: makes a sensor that keeps the exact startup time in seconds captured during the last restart of Home Assistant. As it said one can use it to debug their Raspberry Pi configuration or just monitor startup time and send an alert when startup time exceeds some threshold.
The component can be installed manually by copying the folder from the author’s repository into the
custom_components folder of your Home Assistant instance or it can be installed via HACS addon manager.
Open Integrations section of HACS page and click EXPLORE & ADD REPOSITORIES. Type
Start to find and install “Start Time” component.
The installation process requires a reboot of your Home Assistant instance. Once it is done, you will need to add a single string into your
configuration.yaml file and restart your Home Assistant again:
When the component is installed, you may discover a new sensor in the Developer Tools section of your Home Assistant instance.
Besides total startup time, the sensor also contains loading time for every component in your system in the attributes section. Though, you shouldn’t be expected that disabling a component will significantly reduce Home Assistant startup time since the components are loaded simultaneously.
The only exception here if a component loading time is very close to Home Assistant startup time. In this case, the component can be that bottleneck that delays the whole startup process.
Let’s try to utilize it in our setup. On my Intel© NUC8i3BEH it roughly takes 24 seconds to start Home Assistant right now. I am going to add a simple automation rule to send a notification when startup time exceeds 30 seconds so that I can immediately find out what is the reason for delay:
That’s it, as soon as Home Assistant startup time is increased we’ll get a notification about it.