Hi. I am new here and it is a pleasure to greet everyone. Hours ago I am struggling with the result of a time in history_stats. The result obtained is in a fraction of an hour and not in hours and minutes. That is, 5h45m shows it to me as 5.75. I’m already desperate because I can’t find the solution. How can this be changed? Thank you very much for your attention.
History stats sensors have a state attribute named value
that displays it like that. Look in the third column at developer tools > states. You can use templating to create a template sensor to grab that value if you want to use it elsewhere like in the frontend.
The template would be something like
"{{ state_attr('sensor.whatever', 'value') }}"
1 Like
That’s also not a fraction but a decimal.
Fractions would be 23/47 th’s of an hour or something
1 Like
Thanks a lot. I’ll investigate
thank you very much. your template worked perfectly !!