Description:
Currently, the Home Assistant Recorder integration allows filtering of recorded data based on entities, domains, and event types. However, there is no built-in functionality to exclude specific states (e.g., unknown
, unavailable
) from being recorded.
In many setups, sensors may frequently report unknown
or unavailable
states due to temporary connectivity issues or other transient problems. Recording these states can lead to unnecessary database bloat and negatively impact performance, without providing any useful historical data.
Proposed Solution:
I propose adding a new feature to the Recorder integration that allows users to exclude specific states from being recorded. This could be implemented as a new exclude_states
option within the recorder
configuration, similar to the existing exclude_entities
and exclude_event_types
options.
Example Configuration:
yaml
Copy Code
recorder: exclude: entities: - sensor.example_sensor event_types: - call_service states: - unknown - unavailable
In this example, the Recorder would exclude all unknown
and unavailable
states from being recorded, regardless of the entity or event type.
Benefits:
- Reduced Database Size: By excluding unnecessary states, the database size can be significantly reduced, leading to improved performance and reduced storage requirements.
- Improved Data Quality: Excluding transient states results in a cleaner and more meaningful historical dataset.
- Resource Savings: Less frequent database writes reduce CPU and I/O load on the Home Assistant system.
Use Case:
I have approximately 3000 sensors in my Home Assistant setup, and many of them occasionally report unknown
states. Manually excluding each sensor or performing regular database cleanup is not a scalable solution. A built-in feature to exclude specific states would greatly simplify the management of recorded data and improve the overall performance of my Home Assistant system.