I have an entity which I’d like to display differently from my NUT tools grab from my Eaton 5PX UPS.
Is there a way to do “math” with this so that instead of a number of seconds I can either divide by 60 to get “minutes” or by 3600 to get “hours”?
(This would then show about 10.8 hr)
khenderick
(Kenneth Henderick)
2
I’m not aware of something off the shelf. I’m using a bit of template code in a custom:template-entity-row to accomplish this;
{% set minutes = states('sensor.foo_seconds')|float(0) * 60 %}
{{ (minutes // 60)|int(0) }}h {{ (minutes % 60)|int(0) }}m
Similar code could be used to support seconds, or even days etc.
Thanks! That got me there with a couple of tweaks…perfect!
1 Like