diff --git a/homeassistant/components/calendar/__init__.py b/homeassistant/components/calendar/__init__.py index e1f206ca661..fa7b82a9e1e 100644 --- a/homeassistant/components/calendar/__init__.py +++ b/homeassistant/components/calendar/__init__.py @@ -33,7 +33,7 @@ from homeassistant.core import ( ) from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.entity import Entity +from homeassistant.helpers.entity import Entity, EntityDescription from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.event import async_track_point_in_time from homeassistant.helpers.template import DATE_STR_FORMAT @@ -483,9 +483,15 @@ def is_offset_reached( return start + offset_time <= dt_util.now(start.tzinfo) +class CalendarEntityDescription(EntityDescription, frozen_or_thawed=True): + """A class that describes calendar entities.""" + + class CalendarEntity(Entity): """Base class for calendar event entities.""" + entity_description: CalendarEntityDescription + _entity_component_unrecorded_attributes = frozenset({"description"}) _alarm_unsubs: list[CALLBACK_TYPE] | None = None diff --git a/homeassistant/components/google/calendar.py b/homeassistant/components/google/calendar.py index 3a5a620876d..ed3a27ce614 100644 --- a/homeassistant/components/google/calendar.py +++ b/homeassistant/components/google/calendar.py @@ -24,6 +24,7 @@ from homeassistant.components.calendar import ( EVENT_START, EVENT_SUMMARY, CalendarEntity, + CalendarEntityDescription, CalendarEntityFeature, CalendarEvent, extract_offset, @@ -34,7 +35,7 @@ from homeassistant.const import CONF_DEVICE_ID, CONF_ENTITIES, CONF_NAME, CONF_O from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import HomeAssistantError, PlatformNotReady from homeassistant.helpers import entity_platform, entity_registry as er -from homeassistant.helpers.entity import EntityDescription, generate_entity_id +from homeassistant.helpers.entity import generate_entity_id from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.util import dt as dt_util @@ -84,7 +85,7 @@ SERVICE_CREATE_EVENT = "create_event" @dataclass(frozen=True, kw_only=True) -class GoogleCalendarEntityDescription(EntityDescription): +class GoogleCalendarEntityDescription(CalendarEntityDescription): """Google calendar entity description.""" name: str diff --git a/pylint/plugins/hass_enforce_class_module.py b/pylint/plugins/hass_enforce_class_module.py index 2320a4af8b7..09fe61b68c6 100644 --- a/pylint/plugins/hass_enforce_class_module.py +++ b/pylint/plugins/hass_enforce_class_module.py @@ -28,7 +28,7 @@ _MODULES: dict[str, set[str]] = { "assist_satellite": {"AssistSatelliteEntity", "AssistSatelliteEntityDescription"}, "binary_sensor": {"BinarySensorEntity", "BinarySensorEntityDescription"}, "button": {"ButtonEntity", "ButtonEntityDescription"}, - "calendar": {"CalendarEntity"}, + "calendar": {"CalendarEntity", "CalendarEntityDescription"}, "camera": {"Camera", "CameraEntityDescription"}, "climate": {"ClimateEntity", "ClimateEntityDescription"}, "coordinator": {"DataUpdateCoordinator"},