You’re welcome
Aware of revamping this topic, however it seems a good ‘overview’ topic.
I am trying to create a history_stats sensor that is using a group as input. In my case this is a group of presence_detectors, so I can see how much time the house was ‘empty’.
The sensor results in Unknown in the front-end. Is it even possible to use a group for history_stats? Documentation on history_stats nor history mentions this.
- platform: history_stats
name: Empty house today
entity_id: group.household
state: 'off'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
The history_stats
component will work as long as there are states saved in the history.
Are you sure this is the case ? Can you attempt this database query and check the values ?
SELECT state from states WHERE entity_id = 'group.household'
Thanks @bokub. Running the query on my separate InfluxDB (via Docker on Synology) didn’t give any results. I did make sure to have the group include in the history config:
history:
include:
entities:
- group.household
I am now thinking to set up a template sensor that mimick the group’s state…
Is it just me or do only system defined groups listed here: https://www.home-assistant.io/components/group/ …save state to the database?
It seems custom groups do not and therefore stats don’t work for them?
EDIT:
After digging around a bit more, I found that one of my groups saves to the database and one does not. The one that works has 3 entities, the one that does not work has 7 entities. I wonder if its overloaded. Strange.
EDIT2:
Ooooooops I had the group disabled in the recorder component. NEVERMIND. All good.