Hi,
I would like to track how long home assistant has been up & running.
Are there any ways to do this?
Hi,
I would like to track how long home assistant has been up & running.
Are there any ways to do this?
Take a look at this command line sensor. Works in a linux vitrual env and hassbian install, not sure about HASSio.
https://github.com/SilvrrGIT/HomeAssistant/blob/master/sensors.yaml#L396
Check the system monitor component, since_last_boot value.
https://home-assistant.io/components/sensor.systemmonitor/
That is the time since you last booted your Pi / Server/Computer. You can restart HA a number of times without restarting the base hardware.
If you are using that sensor be warned it spits out a long string, I think days, hours, minutes, seconds. If you want to trim it down, someone posted the below elsewhere on the forum and I modified it a bit to just give days and hours.
https://github.com/SilvrrGIT/HomeAssistant/blob/master/sensors.yaml#L255
Downside is until your hardware has been up for over an hour it doesn’t report anything. I rarely re-boot my hardware so not an issue for me.
Just wondering - in the 5 years since this thread was created - has there become a simpler way (like a call in yaml) to identity how long since the last restart of HA, and how long since the last Pi reboot?
How about creating a sensor for that? In configuration.yaml add:
sensor:
- platform: command_line
name: hassio_uptime
command: /usr/bin/uptime | sed -e 's/^.*up \([^,]*\),.*$/\1/'
Restart HA and check the state of the hassio_uptime entity.