I have two integrations that use history_stats to keep track of TV/Roku usage over 7 days. When I initially added the YAML it was working, but now neither sensor will load. After a reboot, I see this in the logs. But when I click on the link that states there’s an issue with the history_stats, it says there are no issues.
2024-05-08 22:06:42.853 ERROR (MainThread) [homeassistant.config] Invalid config for 'sensor' from integration 'history_stats' at integrations/roku_time_watched_history.yaml, line 7: You must provide exactly 2 of the following: start, end, duration '', got {'platform': 'history_stats', 'name': 'Roku Total Play Time', 'entity_id': 'media_player.roku_ultra', 'state': 'playing', 'type': 'time', 'start': '{{ now().replace(hour=0, minute=0, second=0) }}', 'end': '{{ now() }}', 'duration': {'days': 7}}, please check the docs at https://www.home-assistant.io/integrations/history_stats
2024-05-08 22:06:42.853 ERROR (MainThread) [homeassistant.config] Invalid config for 'sensor' from integration 'history_stats' at integrations/samsung_time_watched_history.yaml, line 7: You must provide exactly 2 of the following: start, end, duration '', got {'platform': 'history_stats', 'name': 'Samsung Total Play Time', 'entity_id': 'media_player.samsung_q6_series', 'state': 'on', 'type': 'time', 'start': '{{ now().replace(hour=0, minute=0, second=0) }}\n', 'end': '{{ now() }}\n', 'duration': {'days': 7}}, please check the docs at https://www.home-assistant.io/integrations/history_stats
I have start, end, and duration configured for each. Thoughts?
sensor:
- platform: history_stats
name: Roku Total Play Time
entity_id: media_player.roku_ultra
state: "playing"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
duration:
days: 7
sensor:
- platform: history_stats
name: "Samsung Total Play Time"
entity_id: media_player.samsung_q6_series
state: "on"
type: time
start: >
{{ now().replace(hour=0, minute=0, second=0) }}
end: >
{{ now() }}
duration:
days: 7