My wife has a home business. The work boolean when turned on does some automations for her while she is working. I was able to create a history_stats that tracks a 7 day running total of hours worked. But she has requested something a little better. She would like to have a lovelace card that shows the hours by the day. I can do multiple lovelace cards for each day, doesnt have to be on the same. This is what Im using currently to track her weekly hours.
Any help would be greatly appreciated. The wife never asks for anything automation related, so this was a surprise.
- platform: history_stats
name: Sella Weekly Work
entity_id: input_boolean.work
state: 'on'
type: time
end: '{{ now().replace(hour=0, minute=0, second=0) }}'
duration:
days: 7
I think this did it. I found it another post. Said there might be an issue after week 1 with not showing stats correctly. It was over a year ago. Maybe it was fixed.
- platform: history_stats
name: Monday Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
duration: '24:00'
- platform: history_stats
name: Tuesday Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) + (1 - now().weekday()) * 86400 }}'
duration: '24:00'
- platform: history_stats
name: Wednesday Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) + (2 - now().weekday()) * 86400 }}'
duration: '24:00'
- platform: history_stats
name: Thursday Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) + (3 - now().weekday()) * 86400 }}'
duration: '24:00'
- platform: history_stats
name: Friday Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) + (4 - now().weekday()) * 86400 }}'
duration: '24:00'
- platform: history_stats
name: Saturday Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) + (5 - now().weekday()) * 86400 }}'
duration: '24:00'
- platform: history_stats
name: Sunday Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) + (6 - now().weekday()) * 86400 }}'
duration: '24:00'
- platform: history_stats
name: Total Hours
entity_id: input_boolean.work
state: 'on'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'