- platform: history_stats
name: Time at Work
entity_id: device_tracker.matts_iphone
state: 'Work'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
can show X hours and X minutes rather than how it currently works which is to show 44.49 hours which actually means 44 hours and 0.49 of an hour (so nearly 30 minutes)
My current card is:
#Showing time at work this week
- type: sensor
entity: sensor.time_at_work
name: Time at work this week
graph: line # or can be none
detail: 60
hours_to_show: 189
I don’t think so but you can simplify and pretty it up. Discovered templates understand a timedelta type so let it do the heavy lifting. Outputs H:MM:SS format, just slice off the last three characters if you want H:MM
With Home-Assistant 2022.05, the "value" attribute is gone. :-(
https://github.com/home-assistant/core/pull/70720
https://www.home-assistant.io/blog/2022/05/04/release-20225/#breaking-changes
the Duration does not work for start and end time for whatever reason, so time is now rendered as decimal hours, which no human beeing can make sense of.
Just wondering if anyone came up with a smarter idea to render times properly in the ui, that does not reqire another template sensor?
i try to make history state entity to calculate duration of my Gas Burner for whole year using HA manual, but i get duration value in UNIX format 1281.65557704541.
how to transfer result in classic HH:MM format?
my configuration.yaml for this entity: