This seems like a dumb question, even for my standards, so go easy on me!
In an effort to minimise writes to my database, I’m trying to stop certain entities states being recorded.
I have an exclude section in my configuration, but I still see history stats when I click on the entity?
Some entities I have ‘excluded’ show no stats, some do show stats?
So, I guess my question is in 2 parts
How do I stop states of entities being saved to he database?
What is the difference in usage between the history, recorder and logbook components?
Should I have an ‘exclude’ for each component I’m not wanting history for in each of the above components.
history basically controls what will be shown on the history page. Recorder controls what will be stored in the DB.
BTW I found that moving over to MariaDB/MySQL really helped my speed and disk usage. My DB is currently less than 800MB and I have data going back to 25th August in there.
This is what’s confusing me.
I have entities in the exclude section of recorder.yaml, but still see history? (By means of having an include only section)
I assumed that if they are excluded from recorder, I’d see no stats?
You have not excluded the sensor domain for the recorder, so they will all be recorded.
The sensor entities you include do not have an effect because none of the sensors are excluded from the recorder in the first place, i.e. you include something that hasn’t been excluded:
Because none of the sensors are excluded in the recorder, you can include them in the history, but - as you have no exclude here at all - you will only see in the history what’s included in the history.
Same is valid for the light and the media_player domains.
You should not be able to see any of the latest status updates for the device_tracker.rich_phone_s8 in the history, because you excluded all device trackers from the recorder.
Sorry missed that you had posted your config (was late)
you can do it either way around.
exclude:
- domain [everything for these domains]
include:
- [ except these specific named entities]
or
include:
- domain [everything for these domains]
exclude:
- [ except these specific named entities]
as per this example from the docs
# Example configuration.yaml entry with include and exclude
recorder:
include:
domains:
- sensor
- switch
- media_player
exclude:
entities:
- sensor.last_boot
- sensor.date
If I recall correctly you can use also use the “whitelist” method which excludes everything else if you ONLY have includes.
# Example configuration.yaml entry with include and exclude
recorder:
include:
domains:
- switch
- media_player
entities:
- sensor.last_boot
- sensor.date
thanks @allan
I think I will go for the method of excluding everything, except…my logic being as my install grows it should help managing the list be a little easier, rather than listing many entities to exclude.
Will this work, when you don’t have ‘sensor’ in domains?
I ask because mine isn’t working without, but then I get ALL sensors in, unless I exclude them. But that’s a huge job…
Now I’M confused. After setting it up again, it’s actually working. I wanted only 3 sensors in my history. Not all of them. And I think I did the same, the second time. But apparently not. Anyway, it’s working.