Move definition of attributes excluded from history to entity classes (#100430)

* Move definition of attributes excluded from history to entity classes

* Revert change which should be in a follow-up PR

* Fix sun unrecorded attributes

* Fix input_select unrecorded attributes
This commit is contained in:
Erik Montnemery 2023-09-21 15:02:47 +02:00 committed by GitHub
parent aed3ba3acd
commit df73850f56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 143 additions and 558 deletions

View file

@ -22,9 +22,6 @@ from homeassistant.helpers import collection
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.integration_platform import (
async_process_integration_platform_for_component,
)
from homeassistant.helpers.restore_state import RestoreEntity
import homeassistant.helpers.service
from homeassistant.helpers.storage import Store
@ -94,10 +91,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up an input boolean."""
component = EntityComponent[InputBoolean](_LOGGER, DOMAIN, hass)
# Process integration platforms right away since
# we will create entities before firing EVENT_COMPONENT_LOADED
await async_process_integration_platform_for_component(hass, DOMAIN)
id_manager = collection.IDManager()
yaml_collection = collection.YamlCollection(
@ -156,6 +149,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
class InputBoolean(collection.CollectionEntity, ToggleEntity, RestoreEntity):
"""Representation of a boolean input."""
_unrecorded_attributes = frozenset({ATTR_EDITABLE})
_attr_should_poll = False
editable: bool

View file

@ -1,11 +0,0 @@
"""Integration platform for recorder."""
from __future__ import annotations
from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant, callback
@callback
def exclude_attributes(hass: HomeAssistant) -> set[str]:
"""Exclude editable hint from being recorded in the database."""
return {ATTR_EDITABLE}