real case scenario: main power went off yesterday and I didn’t receive a “power alert notification”.
In history I can find some useful information (like the “main power” sensor value changed, or the internet connection was on/off).
But, at some point I would like to understand whether HA was running or not (i.e., the ups running the raspberry pi run out of battery power).
I already record the “start” of HA. In this case, the state “shutting down” does not exists.
The only idea I came with is an input boolean sensor and an automation that switch its state every minute. The result will be that, if the value does not change for >1 minute, HA is not running for that period.
The bad thing here is that the history in HA gets full of log related to this sensor.
Do you have any better idea on how to achieve this?
Maybe the best thing to do is to go with the “classic IT” approach that is “reading the system log”…
See this post I did on this subject before. It uses a free external service. This would detect power outage or internet outage though, not one or the other.
I think I just found what to use: “uptime”.
This is part of system monitor sensor and represent how long HA has been running for.
In the “History” tab I can see a graph of uptime. I hope it will let me to understand when HA is running (uptime is raising) or not.