diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py index fd6a70cce46..df388e52a7f 100644 --- a/homeassistant/components/automation/__init__.py +++ b/homeassistant/components/automation/__init__.py @@ -57,9 +57,6 @@ from homeassistant.helpers import condition 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.issue_registry import IssueSeverity, async_create_issue from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.script import ( @@ -249,10 +246,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: 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) - # Register automation as valid domain for Blueprint async_get_blueprints(hass) diff --git a/homeassistant/components/calendar/__init__.py b/homeassistant/components/calendar/__init__.py index e487569453f..96872e039e1 100644 --- a/homeassistant/components/calendar/__init__.py +++ b/homeassistant/components/calendar/__init__.py @@ -481,6 +481,8 @@ def is_offset_reached( class CalendarEntity(Entity): """Base class for calendar event entities.""" + _entity_component_unrecorded_attributes = frozenset({"description"}) + _alarm_unsubs: list[CALLBACK_TYPE] = [] @property diff --git a/homeassistant/components/calendar/recorder.py b/homeassistant/components/calendar/recorder.py deleted file mode 100644 index 4aba7b409cc..00000000000 --- a/homeassistant/components/calendar/recorder.py +++ /dev/null @@ -1,10 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude potentially large attributes from being recorded in the database.""" - return {"description"} diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index 07394ca75b2..bb5a44a530c 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -449,6 +449,10 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: class Camera(Entity): """The base class for camera entities.""" + _entity_component_unrecorded_attributes = frozenset( + {"access_token", "entity_picture"} + ) + # Entity Properties _attr_brand: str | None = None _attr_frame_interval: float = MIN_STREAM_INTERVAL diff --git a/homeassistant/components/camera/recorder.py b/homeassistant/components/camera/recorder.py deleted file mode 100644 index 5c141220881..00000000000 --- a/homeassistant/components/camera/recorder.py +++ /dev/null @@ -1,10 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude access_token and entity_picture from being recorded in the database.""" - return {"access_token", "entity_picture"} diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index dfc428a9bd0..a075467a313 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -209,6 +209,20 @@ class ClimateEntityDescription(EntityDescription): class ClimateEntity(Entity): """Base class for climate entities.""" + _entity_component_unrecorded_attributes = frozenset( + { + ATTR_HVAC_MODES, + ATTR_FAN_MODES, + ATTR_SWING_MODES, + ATTR_MIN_TEMP, + ATTR_MAX_TEMP, + ATTR_MIN_HUMIDITY, + ATTR_MAX_HUMIDITY, + ATTR_TARGET_TEMP_STEP, + ATTR_PRESET_MODES, + } + ) + entity_description: ClimateEntityDescription _attr_current_humidity: int | None = None _attr_current_temperature: float | None = None diff --git a/homeassistant/components/climate/recorder.py b/homeassistant/components/climate/recorder.py deleted file mode 100644 index 879e6bfbbac..00000000000 --- a/homeassistant/components/climate/recorder.py +++ /dev/null @@ -1,32 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from .const import ( - ATTR_FAN_MODES, - ATTR_HVAC_MODES, - ATTR_MAX_HUMIDITY, - ATTR_MAX_TEMP, - ATTR_MIN_HUMIDITY, - ATTR_MIN_TEMP, - ATTR_PRESET_MODES, - ATTR_SWING_MODES, - ATTR_TARGET_TEMP_STEP, -) - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return { - ATTR_HVAC_MODES, - ATTR_FAN_MODES, - ATTR_SWING_MODES, - ATTR_MIN_TEMP, - ATTR_MAX_TEMP, - ATTR_MIN_HUMIDITY, - ATTR_MAX_HUMIDITY, - ATTR_TARGET_TEMP_STEP, - ATTR_PRESET_MODES, - } diff --git a/homeassistant/components/event/__init__.py b/homeassistant/components/event/__init__.py index f6ba2d79bfe..d9608670972 100644 --- a/homeassistant/components/event/__init__.py +++ b/homeassistant/components/event/__init__.py @@ -105,6 +105,8 @@ class EventExtraStoredData(ExtraStoredData): class EventEntity(RestoreEntity): """Representation of an Event entity.""" + _entity_component_unrecorded_attributes = frozenset({ATTR_EVENT_TYPES}) + entity_description: EventEntityDescription _attr_device_class: EventDeviceClass | None _attr_event_types: list[str] diff --git a/homeassistant/components/event/recorder.py b/homeassistant/components/event/recorder.py deleted file mode 100644 index 759fd80bcf0..00000000000 --- a/homeassistant/components/event/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_EVENT_TYPES - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return {ATTR_EVENT_TYPES} diff --git a/homeassistant/components/fan/__init__.py b/homeassistant/components/fan/__init__.py index 6aa29d8b804..a149909e029 100644 --- a/homeassistant/components/fan/__init__.py +++ b/homeassistant/components/fan/__init__.py @@ -183,6 +183,8 @@ class FanEntityDescription(ToggleEntityDescription): class FanEntity(ToggleEntity): """Base class for fan entities.""" + _entity_component_unrecorded_attributes = frozenset({ATTR_PRESET_MODES}) + entity_description: FanEntityDescription _attr_current_direction: str | None = None _attr_oscillating: bool | None = None diff --git a/homeassistant/components/fan/recorder.py b/homeassistant/components/fan/recorder.py deleted file mode 100644 index e7305b64f16..00000000000 --- a/homeassistant/components/fan/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_PRESET_MODES - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return {ATTR_PRESET_MODES} diff --git a/homeassistant/components/group/__init__.py b/homeassistant/components/group/__init__.py index ef011c4308a..364ef15fa5e 100644 --- a/homeassistant/components/group/__init__.py +++ b/homeassistant/components/group/__init__.py @@ -42,7 +42,6 @@ from homeassistant.helpers.event import ( async_track_state_change_event, ) from homeassistant.helpers.integration_platform import ( - async_process_integration_platform_for_component, async_process_integration_platforms, ) from homeassistant.helpers.reload import async_reload_integration_platforms @@ -285,8 +284,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: if DOMAIN not in hass.data: hass.data[DOMAIN] = EntityComponent[Group](_LOGGER, DOMAIN, hass) - await async_process_integration_platform_for_component(hass, DOMAIN) - component: EntityComponent[Group] = hass.data[DOMAIN] hass.data[REG_KEY] = GroupIntegrationRegistry() @@ -472,6 +469,8 @@ async def _async_process_config(hass: HomeAssistant, config: ConfigType) -> None class GroupEntity(Entity): """Representation of a Group of entities.""" + _unrecorded_attributes = frozenset({ATTR_ENTITY_ID}) + _attr_should_poll = False _entity_ids: list[str] @@ -560,6 +559,8 @@ class GroupEntity(Entity): class Group(Entity): """Track a group of entity ids.""" + _unrecorded_attributes = frozenset({ATTR_ENTITY_ID, ATTR_ORDER, ATTR_AUTO}) + _attr_should_poll = False tracking: tuple[str, ...] trackable: tuple[str, ...] diff --git a/homeassistant/components/group/media_player.py b/homeassistant/components/group/media_player.py index 3960f400614..bc238519cfa 100644 --- a/homeassistant/components/group/media_player.py +++ b/homeassistant/components/group/media_player.py @@ -122,6 +122,8 @@ def async_create_preview_media_player( class MediaPlayerGroup(MediaPlayerEntity): """Representation of a Media Group.""" + _unrecorded_attributes = frozenset({ATTR_ENTITY_ID}) + _attr_available: bool = False _attr_should_poll = False diff --git a/homeassistant/components/group/recorder.py b/homeassistant/components/group/recorder.py deleted file mode 100644 index 9138b4ef348..00000000000 --- a/homeassistant/components/group/recorder.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_AUTO, ATTR_ENTITY_ID, ATTR_ORDER - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return { - ATTR_ENTITY_ID, - ATTR_ORDER, - ATTR_AUTO, - } diff --git a/homeassistant/components/humidifier/__init__.py b/homeassistant/components/humidifier/__init__.py index a525c626f14..47745c53394 100644 --- a/homeassistant/components/humidifier/__init__.py +++ b/homeassistant/components/humidifier/__init__.py @@ -134,6 +134,10 @@ class HumidifierEntityDescription(ToggleEntityDescription): class HumidifierEntity(ToggleEntity): """Base class for humidifier entities.""" + _entity_component_unrecorded_attributes = frozenset( + {ATTR_MIN_HUMIDITY, ATTR_MAX_HUMIDITY, ATTR_AVAILABLE_MODES} + ) + entity_description: HumidifierEntityDescription _attr_action: HumidifierAction | None = None _attr_available_modes: list[str] | None diff --git a/homeassistant/components/humidifier/recorder.py b/homeassistant/components/humidifier/recorder.py deleted file mode 100644 index 53df96605d6..00000000000 --- a/homeassistant/components/humidifier/recorder.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_AVAILABLE_MODES, ATTR_MAX_HUMIDITY, ATTR_MIN_HUMIDITY - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return { - ATTR_MIN_HUMIDITY, - ATTR_MAX_HUMIDITY, - ATTR_AVAILABLE_MODES, - } diff --git a/homeassistant/components/image/__init__.py b/homeassistant/components/image/__init__.py index d1895053f02..e5c40affe0f 100644 --- a/homeassistant/components/image/__init__.py +++ b/homeassistant/components/image/__init__.py @@ -126,6 +126,10 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: class ImageEntity(Entity): """The base class for image entities.""" + _entity_component_unrecorded_attributes = frozenset( + {"access_token", "entity_picture"} + ) + # Entity Properties _attr_content_type: str = DEFAULT_CONTENT_TYPE _attr_image_last_updated: datetime | None = None diff --git a/homeassistant/components/image/recorder.py b/homeassistant/components/image/recorder.py deleted file mode 100644 index 5c141220881..00000000000 --- a/homeassistant/components/image/recorder.py +++ /dev/null @@ -1,10 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude access_token and entity_picture from being recorded in the database.""" - return {"access_token", "entity_picture"} diff --git a/homeassistant/components/input_boolean/__init__.py b/homeassistant/components/input_boolean/__init__.py index a074b3b9b65..613e8829aa1 100644 --- a/homeassistant/components/input_boolean/__init__.py +++ b/homeassistant/components/input_boolean/__init__.py @@ -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 diff --git a/homeassistant/components/input_boolean/recorder.py b/homeassistant/components/input_boolean/recorder.py deleted file mode 100644 index 8e94dc93f3b..00000000000 --- a/homeassistant/components/input_boolean/recorder.py +++ /dev/null @@ -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} diff --git a/homeassistant/components/input_button/__init__.py b/homeassistant/components/input_button/__init__.py index c04b18b0c25..3318354392c 100644 --- a/homeassistant/components/input_button/__init__.py +++ b/homeassistant/components/input_button/__init__.py @@ -18,9 +18,6 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import collection import homeassistant.helpers.config_validation as cv 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 @@ -79,10 +76,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up an input button.""" component = EntityComponent[InputButton](_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( @@ -137,6 +130,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: class InputButton(collection.CollectionEntity, ButtonEntity, RestoreEntity): """Representation of a button.""" + _unrecorded_attributes = frozenset({ATTR_EDITABLE}) + _attr_should_poll = False editable: bool diff --git a/homeassistant/components/input_button/recorder.py b/homeassistant/components/input_button/recorder.py deleted file mode 100644 index 8e94dc93f3b..00000000000 --- a/homeassistant/components/input_button/recorder.py +++ /dev/null @@ -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} diff --git a/homeassistant/components/input_datetime/__init__.py b/homeassistant/components/input_datetime/__init__.py index 81882137fad..73a4df12d03 100644 --- a/homeassistant/components/input_datetime/__init__.py +++ b/homeassistant/components/input_datetime/__init__.py @@ -20,9 +20,6 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import collection import homeassistant.helpers.config_validation as cv 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 @@ -132,10 +129,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up an input datetime.""" component = EntityComponent[InputDatetime](_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( @@ -225,6 +218,8 @@ class DateTimeStorageCollection(collection.DictStorageCollection): class InputDatetime(collection.CollectionEntity, RestoreEntity): """Representation of a datetime input.""" + _unrecorded_attributes = frozenset({ATTR_EDITABLE, CONF_HAS_DATE, CONF_HAS_TIME}) + _attr_should_poll = False editable: bool diff --git a/homeassistant/components/input_datetime/recorder.py b/homeassistant/components/input_datetime/recorder.py deleted file mode 100644 index 91c33ee0811..00000000000 --- a/homeassistant/components/input_datetime/recorder.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.const import ATTR_EDITABLE -from homeassistant.core import HomeAssistant, callback - -from . import CONF_HAS_DATE, CONF_HAS_TIME - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude some attributes from being recorded in the database.""" - return {ATTR_EDITABLE, CONF_HAS_DATE, CONF_HAS_TIME} diff --git a/homeassistant/components/input_number/__init__.py b/homeassistant/components/input_number/__init__.py index 197a35246d2..4a74201be15 100644 --- a/homeassistant/components/input_number/__init__.py +++ b/homeassistant/components/input_number/__init__.py @@ -21,9 +21,6 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import collection import homeassistant.helpers.config_validation as cv 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 @@ -110,10 +107,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up an input slider.""" component = EntityComponent[InputNumber](_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( @@ -209,6 +202,10 @@ class NumberStorageCollection(collection.DictStorageCollection): class InputNumber(collection.CollectionEntity, RestoreEntity): """Representation of a slider.""" + _unrecorded_attributes = frozenset( + {ATTR_EDITABLE, ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_STEP} + ) + _attr_should_poll = False editable: bool diff --git a/homeassistant/components/input_number/recorder.py b/homeassistant/components/input_number/recorder.py deleted file mode 100644 index 05a5023be0b..00000000000 --- a/homeassistant/components/input_number/recorder.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.const import ATTR_EDITABLE -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_STEP - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude editable hint from being recorded in the database.""" - return { - ATTR_EDITABLE, - ATTR_MAX, - ATTR_MIN, - ATTR_MODE, - ATTR_STEP, - } diff --git a/homeassistant/components/input_select/__init__.py b/homeassistant/components/input_select/__init__.py index e1354cb26a5..4a384e0c17a 100644 --- a/homeassistant/components/input_select/__init__.py +++ b/homeassistant/components/input_select/__init__.py @@ -29,9 +29,6 @@ from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import collection import homeassistant.helpers.config_validation as cv 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 @@ -138,10 +135,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up an input select.""" component = EntityComponent[InputSelect](_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( @@ -255,6 +248,11 @@ class InputSelectStorageCollection(collection.DictStorageCollection): class InputSelect(collection.CollectionEntity, SelectEntity, RestoreEntity): """Representation of a select input.""" + _entity_component_unrecorded_attributes = ( + SelectEntity._entity_component_unrecorded_attributes - {ATTR_OPTIONS} + ) + _unrecorded_attributes = frozenset({ATTR_EDITABLE}) + _attr_should_poll = False editable: bool diff --git a/homeassistant/components/input_select/recorder.py b/homeassistant/components/input_select/recorder.py deleted file mode 100644 index 8e94dc93f3b..00000000000 --- a/homeassistant/components/input_select/recorder.py +++ /dev/null @@ -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} diff --git a/homeassistant/components/input_text/__init__.py b/homeassistant/components/input_text/__init__.py index 096e7cbb105..81b75458dc1 100644 --- a/homeassistant/components/input_text/__init__.py +++ b/homeassistant/components/input_text/__init__.py @@ -20,9 +20,6 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import collection import homeassistant.helpers.config_validation as cv 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 @@ -110,10 +107,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up an input text.""" component = EntityComponent[InputText](_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( @@ -187,6 +180,10 @@ class InputTextStorageCollection(collection.DictStorageCollection): class InputText(collection.CollectionEntity, RestoreEntity): """Represent a text box.""" + _unrecorded_attributes = frozenset( + {ATTR_EDITABLE, ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_PATTERN} + ) + _attr_should_poll = False editable: bool diff --git a/homeassistant/components/input_text/recorder.py b/homeassistant/components/input_text/recorder.py deleted file mode 100644 index 0f4969270d0..00000000000 --- a/homeassistant/components/input_text/recorder.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.const import ATTR_EDITABLE -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_PATTERN - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude editable hint from being recorded in the database.""" - return { - ATTR_EDITABLE, - ATTR_MAX, - ATTR_MIN, - ATTR_MODE, - ATTR_PATTERN, - } diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index f7f0150bdd2..cfcb1e13a07 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -785,6 +785,17 @@ class LightEntityDescription(ToggleEntityDescription): class LightEntity(ToggleEntity): """Base class for light entities.""" + _entity_component_unrecorded_attributes = frozenset( + { + ATTR_SUPPORTED_COLOR_MODES, + ATTR_EFFECT_LIST, + ATTR_MIN_MIREDS, + ATTR_MAX_MIREDS, + ATTR_MIN_COLOR_TEMP_KELVIN, + ATTR_MAX_COLOR_TEMP_KELVIN, + } + ) + entity_description: LightEntityDescription _attr_brightness: int | None = None _attr_color_mode: ColorMode | str | None = None diff --git a/homeassistant/components/light/recorder.py b/homeassistant/components/light/recorder.py deleted file mode 100644 index e38ba888e71..00000000000 --- a/homeassistant/components/light/recorder.py +++ /dev/null @@ -1,26 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ( - ATTR_EFFECT_LIST, - ATTR_MAX_COLOR_TEMP_KELVIN, - ATTR_MAX_MIREDS, - ATTR_MIN_COLOR_TEMP_KELVIN, - ATTR_MIN_MIREDS, - ATTR_SUPPORTED_COLOR_MODES, -) - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return { - ATTR_SUPPORTED_COLOR_MODES, - ATTR_EFFECT_LIST, - ATTR_MIN_MIREDS, - ATTR_MAX_MIREDS, - ATTR_MIN_COLOR_TEMP_KELVIN, - ATTR_MAX_COLOR_TEMP_KELVIN, - } diff --git a/homeassistant/components/media_player/__init__.py b/homeassistant/components/media_player/__init__.py index 2acb516fa95..f3ff925a1a4 100644 --- a/homeassistant/components/media_player/__init__.py +++ b/homeassistant/components/media_player/__init__.py @@ -27,6 +27,7 @@ from homeassistant.components.http import KEY_AUTHENTICATED, HomeAssistantView from homeassistant.components.websocket_api import ERR_NOT_SUPPORTED, ERR_UNKNOWN_ERROR from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( # noqa: F401 + ATTR_ENTITY_PICTURE, SERVICE_MEDIA_NEXT_TRACK, SERVICE_MEDIA_PAUSE, SERVICE_MEDIA_PLAY, @@ -458,6 +459,17 @@ class MediaPlayerEntityDescription(EntityDescription): class MediaPlayerEntity(Entity): """ABC for media player entities.""" + _entity_component_unrecorded_attributes = frozenset( + { + ATTR_ENTITY_PICTURE_LOCAL, + ATTR_ENTITY_PICTURE, + ATTR_INPUT_SOURCE_LIST, + ATTR_MEDIA_POSITION_UPDATED_AT, + ATTR_MEDIA_POSITION, + ATTR_SOUND_MODE_LIST, + } + ) + entity_description: MediaPlayerEntityDescription _access_token: str | None = None diff --git a/homeassistant/components/media_player/recorder.py b/homeassistant/components/media_player/recorder.py deleted file mode 100644 index 8ced833ebec..00000000000 --- a/homeassistant/components/media_player/recorder.py +++ /dev/null @@ -1,26 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.const import ATTR_ENTITY_PICTURE -from homeassistant.core import HomeAssistant, callback - -from . import ( - ATTR_ENTITY_PICTURE_LOCAL, - ATTR_INPUT_SOURCE_LIST, - ATTR_MEDIA_POSITION, - ATTR_MEDIA_POSITION_UPDATED_AT, - ATTR_SOUND_MODE_LIST, -) - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static and token attributes from being recorded in the database.""" - return { - ATTR_ENTITY_PICTURE_LOCAL, - ATTR_ENTITY_PICTURE, - ATTR_INPUT_SOURCE_LIST, - ATTR_MEDIA_POSITION_UPDATED_AT, - ATTR_MEDIA_POSITION, - ATTR_SOUND_MODE_LIST, - } diff --git a/homeassistant/components/number/__init__.py b/homeassistant/components/number/__init__.py index aa3566c5a95..4e0f5059c90 100644 --- a/homeassistant/components/number/__init__.py +++ b/homeassistant/components/number/__init__.py @@ -156,6 +156,10 @@ def floor_decimal(value: float, precision: float = 0) -> float: class NumberEntity(Entity): """Representation of a Number entity.""" + _entity_component_unrecorded_attributes = frozenset( + {ATTR_MIN, ATTR_MAX, ATTR_STEP, ATTR_MODE} + ) + entity_description: NumberEntityDescription _attr_device_class: NumberDeviceClass | None _attr_max_value: None diff --git a/homeassistant/components/number/recorder.py b/homeassistant/components/number/recorder.py deleted file mode 100644 index 39418a48878..00000000000 --- a/homeassistant/components/number/recorder.py +++ /dev/null @@ -1,17 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_STEP - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return { - ATTR_MIN, - ATTR_MAX, - ATTR_STEP, - ATTR_MODE, - } diff --git a/homeassistant/components/person/__init__.py b/homeassistant/components/person/__init__.py index ea325380e11..49b719a5490 100644 --- a/homeassistant/components/person/__init__.py +++ b/homeassistant/components/person/__init__.py @@ -47,9 +47,6 @@ from homeassistant.helpers import ( ) from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.event import async_track_state_change_event -from homeassistant.helpers.integration_platform import ( - async_process_integration_platform_for_component, -) from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.storage import Store from homeassistant.helpers.typing import ConfigType @@ -333,9 +330,6 @@ The following persons point at invalid users: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the person component.""" - # Process integration platforms right away since - # we will create entities before firing EVENT_COMPONENT_LOADED - await async_process_integration_platform_for_component(hass, DOMAIN) entity_component = EntityComponent[Person](_LOGGER, DOMAIN, hass) id_manager = collection.IDManager() yaml_collection = collection.YamlCollection( @@ -397,6 +391,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: class Person(collection.CollectionEntity, RestoreEntity): """Represent a tracked person.""" + _entity_component_unrecorded_attributes = frozenset({ATTR_DEVICE_TRACKERS}) + _attr_should_poll = False editable: bool diff --git a/homeassistant/components/person/recorder.py b/homeassistant/components/person/recorder.py deleted file mode 100644 index 7c0fdf52258..00000000000 --- a/homeassistant/components/person/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_DEVICE_TRACKERS - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude large and chatty update attributes from being recorded.""" - return {ATTR_DEVICE_TRACKERS} diff --git a/homeassistant/components/schedule/__init__.py b/homeassistant/components/schedule/__init__.py index 2e5fcc27715..2f7831fedd4 100644 --- a/homeassistant/components/schedule/__init__.py +++ b/homeassistant/components/schedule/__init__.py @@ -30,9 +30,6 @@ from homeassistant.helpers.collection import ( import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.event import async_track_point_in_utc_time -from homeassistant.helpers.integration_platform import ( - async_process_integration_platform_for_component, -) from homeassistant.helpers.service import async_register_admin_service from homeassistant.helpers.storage import Store from homeassistant.helpers.typing import ConfigType @@ -157,10 +154,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up an input select.""" component = EntityComponent[Schedule](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 = IDManager() yaml_collection = YamlCollection(LOGGER, id_manager) @@ -240,6 +233,10 @@ class ScheduleStorageCollection(DictStorageCollection): class Schedule(CollectionEntity): """Schedule entity.""" + _entity_component_unrecorded_attributes = frozenset( + {ATTR_EDITABLE, ATTR_NEXT_EVENT} + ) + _attr_has_entity_name = True _attr_should_poll = False _attr_state: Literal["on", "off"] diff --git a/homeassistant/components/schedule/recorder.py b/homeassistant/components/schedule/recorder.py deleted file mode 100644 index b9911e0544b..00000000000 --- a/homeassistant/components/schedule/recorder.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.const import ATTR_EDITABLE -from homeassistant.core import HomeAssistant, callback - -from .const import ATTR_NEXT_EVENT - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude configuration to be recorded in the database.""" - return { - ATTR_EDITABLE, - ATTR_NEXT_EVENT, - } diff --git a/homeassistant/components/script/__init__.py b/homeassistant/components/script/__init__.py index 13b25a00053..716f0197c8b 100644 --- a/homeassistant/components/script/__init__.py +++ b/homeassistant/components/script/__init__.py @@ -42,9 +42,6 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.config_validation import make_entity_service_schema 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 from homeassistant.helpers.script import ( ATTR_CUR, @@ -188,10 +185,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: 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) - # Register script as valid domain for Blueprint async_get_blueprints(hass) @@ -382,6 +375,10 @@ async def _async_process_config( class BaseScriptEntity(ToggleEntity, ABC): """Base class for script entities.""" + _entity_component_unrecorded_attributes = frozenset( + {ATTR_LAST_TRIGGERED, ATTR_MODE, ATTR_CUR, ATTR_MAX, ATTR_LAST_ACTION} + ) + raw_config: ConfigType | None @property diff --git a/homeassistant/components/script/recorder.py b/homeassistant/components/script/recorder.py deleted file mode 100644 index b1afc318b51..00000000000 --- a/homeassistant/components/script/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_CUR, ATTR_LAST_ACTION, ATTR_LAST_TRIGGERED, ATTR_MAX, ATTR_MODE - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude extra attributes from being recorded in the database.""" - return {ATTR_LAST_TRIGGERED, ATTR_MODE, ATTR_CUR, ATTR_MAX, ATTR_LAST_ACTION} diff --git a/homeassistant/components/select/__init__.py b/homeassistant/components/select/__init__.py index a8034588ed1..4997e088a54 100644 --- a/homeassistant/components/select/__init__.py +++ b/homeassistant/components/select/__init__.py @@ -128,6 +128,8 @@ class SelectEntityDescription(EntityDescription): class SelectEntity(Entity): """Representation of a Select entity.""" + _entity_component_unrecorded_attributes = frozenset({ATTR_OPTIONS}) + entity_description: SelectEntityDescription _attr_current_option: str | None _attr_options: list[str] diff --git a/homeassistant/components/select/recorder.py b/homeassistant/components/select/recorder.py deleted file mode 100644 index 6660c8383d0..00000000000 --- a/homeassistant/components/select/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_OPTIONS - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return {ATTR_OPTIONS} diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index 6b4e4a17fc2..4faeca33df5 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -149,6 +149,8 @@ class SensorEntityDescription(EntityDescription): class SensorEntity(Entity): """Base class for sensor entities.""" + _entity_component_unrecorded_attributes = frozenset({ATTR_OPTIONS}) + entity_description: SensorEntityDescription _attr_device_class: SensorDeviceClass | None _attr_last_reset: datetime | None diff --git a/homeassistant/components/sensor/recorder.py b/homeassistant/components/sensor/recorder.py index 63096b16cd8..2ef1b6854fc 100644 --- a/homeassistant/components/sensor/recorder.py +++ b/homeassistant/components/sensor/recorder.py @@ -30,19 +30,13 @@ from homeassistant.const import ( UnitOfSoundPressure, UnitOfVolume, ) -from homeassistant.core import HomeAssistant, State, callback, split_entity_id +from homeassistant.core import HomeAssistant, State, split_entity_id from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity import entity_sources from homeassistant.util import dt as dt_util from homeassistant.util.enum import try_parse_enum -from .const import ( - ATTR_LAST_RESET, - ATTR_OPTIONS, - ATTR_STATE_CLASS, - DOMAIN, - SensorStateClass, -) +from .const import ATTR_LAST_RESET, ATTR_STATE_CLASS, DOMAIN, SensorStateClass _LOGGER = logging.getLogger(__name__) @@ -790,9 +784,3 @@ def validate_statistics( ) return validation_result - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude attributes from being recorded in the database.""" - return {ATTR_OPTIONS} diff --git a/homeassistant/components/siren/__init__.py b/homeassistant/components/siren/__init__.py index a8907ba3b68..ac02201b928 100644 --- a/homeassistant/components/siren/__init__.py +++ b/homeassistant/components/siren/__init__.py @@ -159,6 +159,8 @@ class SirenEntityDescription(ToggleEntityDescription): class SirenEntity(ToggleEntity): """Representation of a siren device.""" + _entity_component_unrecorded_attributes = frozenset({ATTR_AVAILABLE_TONES}) + entity_description: SirenEntityDescription _attr_available_tones: list[int | str] | dict[int, str] | None _attr_supported_features: SirenEntityFeature = SirenEntityFeature(0) diff --git a/homeassistant/components/siren/recorder.py b/homeassistant/components/siren/recorder.py deleted file mode 100644 index 3daf4fc52b2..00000000000 --- a/homeassistant/components/siren/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_AVAILABLE_TONES - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return {ATTR_AVAILABLE_TONES} diff --git a/homeassistant/components/sun/__init__.py b/homeassistant/components/sun/__init__.py index de1c545739f..5bb105f8123 100644 --- a/homeassistant/components/sun/__init__.py +++ b/homeassistant/components/sun/__init__.py @@ -17,9 +17,6 @@ from homeassistant.const import ( from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback from homeassistant.helpers import config_validation as cv, event from homeassistant.helpers.entity import Entity -from homeassistant.helpers.integration_platform import ( - async_process_integration_platform_for_component, -) from homeassistant.helpers.sun import ( get_astral_location, get_location_astral_event_next, @@ -97,9 +94,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up from a config entry.""" - # Process integration platforms right away since - # we will create entities before firing EVENT_COMPONENT_LOADED - await async_process_integration_platform_for_component(hass, DOMAIN) hass.data[DOMAIN] = Sun(hass) await hass.config_entries.async_forward_entry_setups(entry, [Platform.SENSOR]) return True @@ -119,6 +113,20 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: class Sun(Entity): """Representation of the Sun.""" + _unrecorded_attributes = frozenset( + { + STATE_ATTR_AZIMUTH, + STATE_ATTR_ELEVATION, + STATE_ATTR_RISING, + STATE_ATTR_NEXT_DAWN, + STATE_ATTR_NEXT_DUSK, + STATE_ATTR_NEXT_MIDNIGHT, + STATE_ATTR_NEXT_NOON, + STATE_ATTR_NEXT_RISING, + STATE_ATTR_NEXT_SETTING, + } + ) + _attr_name = "Sun" entity_id = ENTITY_ID # This entity is legacy and does not have a platform. @@ -143,6 +151,12 @@ class Sun(Entity): self.hass = hass self.phase: str | None = None + # This is normally done by async_internal_added_to_hass which is not called + # for sun because sun has no platform + self._state_info = { + "unrecorded_attributes": self._Entity__combined_unrecorded_attributes # type: ignore[attr-defined] + } + self._config_listener: CALLBACK_TYPE | None = None self._update_events_listener: CALLBACK_TYPE | None = None self._update_sun_position_listener: CALLBACK_TYPE | None = None diff --git a/homeassistant/components/sun/recorder.py b/homeassistant/components/sun/recorder.py deleted file mode 100644 index 710d7ff4559..00000000000 --- a/homeassistant/components/sun/recorder.py +++ /dev/null @@ -1,32 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ( - STATE_ATTR_AZIMUTH, - STATE_ATTR_ELEVATION, - STATE_ATTR_NEXT_DAWN, - STATE_ATTR_NEXT_DUSK, - STATE_ATTR_NEXT_MIDNIGHT, - STATE_ATTR_NEXT_NOON, - STATE_ATTR_NEXT_RISING, - STATE_ATTR_NEXT_SETTING, - STATE_ATTR_RISING, -) - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude sun attributes from being recorded in the database.""" - return { - STATE_ATTR_AZIMUTH, - STATE_ATTR_ELEVATION, - STATE_ATTR_RISING, - STATE_ATTR_NEXT_DAWN, - STATE_ATTR_NEXT_DUSK, - STATE_ATTR_NEXT_MIDNIGHT, - STATE_ATTR_NEXT_NOON, - STATE_ATTR_NEXT_RISING, - STATE_ATTR_NEXT_SETTING, - } diff --git a/homeassistant/components/text/__init__.py b/homeassistant/components/text/__init__.py index 4182b177bf6..acc5f62a0cc 100644 --- a/homeassistant/components/text/__init__.py +++ b/homeassistant/components/text/__init__.py @@ -111,6 +111,10 @@ class TextEntityDescription(EntityDescription): class TextEntity(Entity): """Representation of a Text entity.""" + _entity_component_unrecorded_attributes = frozenset( + {ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_PATTERN} + ) + entity_description: TextEntityDescription _attr_mode: TextMode _attr_native_value: str | None diff --git a/homeassistant/components/text/recorder.py b/homeassistant/components/text/recorder.py deleted file mode 100644 index 09642eb3079..00000000000 --- a/homeassistant/components/text/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_PATTERN - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return {ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_PATTERN} diff --git a/homeassistant/components/trafikverket_camera/__init__.py b/homeassistant/components/trafikverket_camera/__init__.py index dfac8416c49..5575f32788a 100644 --- a/homeassistant/components/trafikverket_camera/__init__.py +++ b/homeassistant/components/trafikverket_camera/__init__.py @@ -4,10 +4,6 @@ from __future__ import annotations from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.integration_platform import ( - async_process_integration_platform_for_component, -) -from homeassistant.helpers.typing import ConfigType from .const import DOMAIN, PLATFORMS from .coordinator import TVDataUpdateCoordinator @@ -15,14 +11,6 @@ from .coordinator import TVDataUpdateCoordinator CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) -async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: - """Set up trafikverket_camera.""" - # Process integration platforms right away since - # we will create entities before firing EVENT_COMPONENT_LOADED - await async_process_integration_platform_for_component(hass, DOMAIN) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Trafikverket Camera from a config entry.""" diff --git a/homeassistant/components/trafikverket_camera/camera.py b/homeassistant/components/trafikverket_camera/camera.py index a7da3db1433..808d687a131 100644 --- a/homeassistant/components/trafikverket_camera/camera.py +++ b/homeassistant/components/trafikverket_camera/camera.py @@ -37,6 +37,8 @@ async def async_setup_entry( class TVCamera(TrafikverketCameraEntity, Camera): """Implement Trafikverket camera.""" + _unrecorded_attributes = frozenset({ATTR_DESCRIPTION, ATTR_LOCATION}) + _attr_name = None _attr_translation_key = "tv_camera" coordinator: TVDataUpdateCoordinator diff --git a/homeassistant/components/trafikverket_camera/recorder.py b/homeassistant/components/trafikverket_camera/recorder.py deleted file mode 100644 index b6b608749ad..00000000000 --- a/homeassistant/components/trafikverket_camera/recorder.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.const import ATTR_LOCATION -from homeassistant.core import HomeAssistant, callback - -from .const import ATTR_DESCRIPTION - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude description and location from being recorded in the database.""" - return {ATTR_DESCRIPTION, ATTR_LOCATION} diff --git a/homeassistant/components/unifiprotect/entity.py b/homeassistant/components/unifiprotect/entity.py index d42e611be7e..28149d349c9 100644 --- a/homeassistant/components/unifiprotect/entity.py +++ b/homeassistant/components/unifiprotect/entity.py @@ -311,6 +311,8 @@ class ProtectNVREntity(ProtectDeviceEntity): class EventEntityMixin(ProtectDeviceEntity): """Adds motion event attributes to sensor.""" + _unrecorded_attributes = frozenset({ATTR_EVENT_ID, ATTR_EVENT_SCORE}) + entity_description: ProtectEventMixin def __init__( diff --git a/homeassistant/components/unifiprotect/recorder.py b/homeassistant/components/unifiprotect/recorder.py deleted file mode 100644 index 6603a0543f8..00000000000 --- a/homeassistant/components/unifiprotect/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from .const import ATTR_EVENT_ID, ATTR_EVENT_SCORE - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude event_id and event_score from being recorded in the database.""" - return {ATTR_EVENT_ID, ATTR_EVENT_SCORE} diff --git a/homeassistant/components/update/__init__.py b/homeassistant/components/update/__init__.py index e23032e24fe..c9496ce8f7b 100644 --- a/homeassistant/components/update/__init__.py +++ b/homeassistant/components/update/__init__.py @@ -13,7 +13,7 @@ import voluptuous as vol from homeassistant.components import websocket_api from homeassistant.config_entries import ConfigEntry -from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory +from homeassistant.const import ATTR_ENTITY_PICTURE, STATE_OFF, STATE_ON, EntityCategory from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_validation as cv @@ -192,6 +192,10 @@ def _version_is_newer(latest_version: str, installed_version: str) -> bool: class UpdateEntity(RestoreEntity): """Representation of an update entity.""" + _entity_component_unrecorded_attributes = frozenset( + {ATTR_ENTITY_PICTURE, ATTR_IN_PROGRESS, ATTR_RELEASE_SUMMARY} + ) + entity_description: UpdateEntityDescription _attr_auto_update: bool = False _attr_installed_version: str | None = None diff --git a/homeassistant/components/update/recorder.py b/homeassistant/components/update/recorder.py deleted file mode 100644 index 408937c4f31..00000000000 --- a/homeassistant/components/update/recorder.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.const import ATTR_ENTITY_PICTURE -from homeassistant.core import HomeAssistant, callback - -from .const import ATTR_IN_PROGRESS, ATTR_RELEASE_SUMMARY - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude large and chatty update attributes from being recorded.""" - return {ATTR_ENTITY_PICTURE, ATTR_IN_PROGRESS, ATTR_RELEASE_SUMMARY} diff --git a/homeassistant/components/vacuum/__init__.py b/homeassistant/components/vacuum/__init__.py index 8285e1d76d1..68d50d1c2fc 100644 --- a/homeassistant/components/vacuum/__init__.py +++ b/homeassistant/components/vacuum/__init__.py @@ -228,6 +228,8 @@ class _BaseVacuum(Entity): Contains common properties and functions for all vacuum devices. """ + _entity_component_unrecorded_attributes = frozenset({ATTR_FAN_SPEED_LIST}) + _attr_battery_icon: str _attr_battery_level: int | None = None _attr_fan_speed: str | None = None diff --git a/homeassistant/components/vacuum/recorder.py b/homeassistant/components/vacuum/recorder.py deleted file mode 100644 index 7dc7e9e0408..00000000000 --- a/homeassistant/components/vacuum/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_FAN_SPEED_LIST - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return {ATTR_FAN_SPEED_LIST} diff --git a/homeassistant/components/water_heater/__init__.py b/homeassistant/components/water_heater/__init__.py index b31d1306c55..9e796092f6a 100644 --- a/homeassistant/components/water_heater/__init__.py +++ b/homeassistant/components/water_heater/__init__.py @@ -164,6 +164,10 @@ class WaterHeaterEntityEntityDescription(EntityDescription): class WaterHeaterEntity(Entity): """Base class for water heater entities.""" + _entity_component_unrecorded_attributes = frozenset( + {ATTR_OPERATION_LIST, ATTR_MIN_TEMP, ATTR_MAX_TEMP} + ) + entity_description: WaterHeaterEntityEntityDescription _attr_current_operation: str | None = None _attr_current_temperature: float | None = None diff --git a/homeassistant/components/water_heater/recorder.py b/homeassistant/components/water_heater/recorder.py deleted file mode 100644 index d76b96936fa..00000000000 --- a/homeassistant/components/water_heater/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_MAX_TEMP, ATTR_MIN_TEMP, ATTR_OPERATION_LIST - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude static attributes from being recorded in the database.""" - return {ATTR_OPERATION_LIST, ATTR_MIN_TEMP, ATTR_MAX_TEMP} diff --git a/homeassistant/components/weather/__init__.py b/homeassistant/components/weather/__init__.py index 0d72dbb825e..4ec9ea91f89 100644 --- a/homeassistant/components/weather/__init__.py +++ b/homeassistant/components/weather/__init__.py @@ -264,6 +264,8 @@ class PostInit(metaclass=PostInitMeta): class WeatherEntity(Entity, PostInit): """ABC for weather data.""" + _entity_component_unrecorded_attributes = frozenset({ATTR_FORECAST}) + entity_description: WeatherEntityDescription _attr_condition: str | None = None # _attr_forecast is deprecated, implement async_forecast_daily, diff --git a/homeassistant/components/weather/recorder.py b/homeassistant/components/weather/recorder.py deleted file mode 100644 index 1c887ea5202..00000000000 --- a/homeassistant/components/weather/recorder.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Integration platform for recorder.""" -from __future__ import annotations - -from homeassistant.core import HomeAssistant, callback - -from . import ATTR_FORECAST - - -@callback -def exclude_attributes(hass: HomeAssistant) -> set[str]: - """Exclude (often large) forecasts from being recorded in the database.""" - return {ATTR_FORECAST}