Hi all,
I really like the new statistics sensor included in the latest HA updates. Here is my code:
platform: history_stats
name: Heater time on today
entity_id: switch.heater
state: 'on'
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
Currently the sensor output is, for example, 1.5h. I would prefer it to display as 1h30m. How do I do this?
Thanks!
ammdc7
(ammdc7)
2
I am just now working through this myself. You can do what you want by utilizing templating.
So for your example try:
{{ states.sensor.heater_time_on_today.attributes.value }}
This will output it as you desire. You can then create a template sensor to display it as you would like. More details on template sensors are here: [https://home-assistant.io/components/sensor.template/]
Hopefully that gets you in the right direction. Let me know if it doesn’t and we should be able to get you going!