Closed plord12 closed 1 year ago
The cpu module feels like a more natural fit for uptime.
The rest all change rarely and together, so bundling them makes sense.
Would:
work for you?
Yes, that looks perfect :-) Many thanks.
I've pushed some updates that add the sys_info module and the uptime to the cpu module. I had to tweak the os_XX names a little as the original naming confused HA, I suspect as the os_release name overlapped the others. I'm not happy with the formatting of uptime in HA, but haven't found a good solution for that yet.
Brilliant ! Actually I think the uptime is as it should be ( expressed in seconds ), can always be formatted eg
{% set total_seconds = states('sensor.arm2_cpu_uptime') | float %}
{% set days = (total_seconds / 86400) | int %}
{% set hours = ((total_seconds % 86400) / 3600 ) | int %}
{% set minutes = ((total_seconds % 3600) / 60 ) | int %}
**OS:** {{ states('sensor.arm2_sys_info_os_release') }}
**Kernel:** {{ states('sensor.arm2_sys_info_kernel_release') }}
**Uptime:** {{ days }} day, {{ hours }} hours, {{ minutes }} minutes
I'm fine with the class and units passed to HA, I'm not happy with any of the standard formatting options.
My preference would be something that displays as days, hours, minutes and seconds, drops the leading terms if they are zero, and maybe drops the seconds if the uptime is greater than an hour (or some other threshold). I'm a bit surprised to find there isn't something that can do that out of the box, rather than having to do a whole lot of templating.
I suppose you could call uptime -p
and return a string
No, I'm not going to do formatting on the wrong end. The class and units being passed are appropriate - it is the disappointing lack of formatting options in HA itself that is my problem.
A future idea is to add a module for system info, eg -
Nice tool, just what I was looking for :-)