From 271ec84bcb37bc4dd991b11c7f06f0108b861bbc Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 15 Oct 2026 19:23:03 +0200 Subject: [PATCH] Define public names of the calendar integration (#186592) --- homeassistant/components/calendar/__init__.py | 47 ++++++++++++++++--- homeassistant/components/calendar/services.py | 4 +- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/calendar/__init__.py b/homeassistant/components/calendar/__init__.py index 4c19b3f97afd..bb4a2a7760f0 100644 --- a/homeassistant/components/calendar/__init__.py +++ b/homeassistant/components/calendar/__init__.py @@ -36,7 +36,7 @@ from homeassistant.helpers.typing import ConfigType from homeassistant.util import dt as dt_util from homeassistant.util.json import JsonValueType -from .const import ( # noqa: F401 +from .const import ( CREATE_EVENT_SERVICE, DATA_COMPONENT, DOMAIN, @@ -79,11 +79,7 @@ from .helper import ( has_timezone, validate_rrule, ) -from .services import ( # noqa: F401 - CREATE_EVENT_SCHEMA, - async_create_event, - async_setup_services, -) +from .services import CREATE_EVENT_SCHEMA, async_setup_services # mypy: disallow-any-generics @@ -130,6 +126,45 @@ CALENDAR_EVENT_SCHEMA = probatio.Schema( extra=probatio.ALLOW_EXTRA, ) +__all__ = [ + "CREATE_EVENT_SCHEMA", + "CREATE_EVENT_SERVICE", + "DOMAIN", + "ENTITY_ID_FORMAT", + "EVENT_DESCRIPTION", + "EVENT_DURATION", + "EVENT_END", + "EVENT_END_DATE", + "EVENT_END_DATETIME", + "EVENT_IN", + "EVENT_IN_DAYS", + "EVENT_IN_WEEKS", + "EVENT_LOCATION", + "EVENT_RECURRENCE_ID", + "EVENT_RECURRENCE_RANGE", + "EVENT_RRULE", + "EVENT_START", + "EVENT_START_DATE", + "EVENT_START_DATETIME", + "EVENT_SUMMARY", + "EVENT_TIME_FIELDS", + "EVENT_TYPES", + "EVENT_UID", + "LIST_EVENT_FIELDS", + "PLATFORM_SCHEMA", + "PLATFORM_SCHEMA_BASE", + "SERVICE_GET_EVENTS", + "WEBSOCKET_EVENT_SCHEMA", + "CalendarEntity", + "CalendarEntityDescription", + "CalendarEntityFeature", + "CalendarEntityStateAttribute", + "CalendarEvent", + "CalendarEventStatus", + "extract_offset", + "is_offset_reached", +] + async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Track states and offer events for calendars.""" diff --git a/homeassistant/components/calendar/services.py b/homeassistant/components/calendar/services.py index 62582d1dc12d..cd3095170179 100644 --- a/homeassistant/components/calendar/services.py +++ b/homeassistant/components/calendar/services.py @@ -135,7 +135,7 @@ def _validate_timespan( raise ValueError("Missing required fields to set start or end date/datetime") -async def async_create_event(entity: CalendarEntity, call: ServiceCall) -> None: +async def _async_create_event(entity: CalendarEntity, call: ServiceCall) -> None: """Add a new event to calendar.""" # Convert parameters to format used by async_create_event (start, end) = _validate_timespan(call.data) @@ -176,7 +176,7 @@ def async_setup_services(hass: HomeAssistant) -> None: component.async_register_entity_service( CREATE_EVENT_SERVICE, CREATE_EVENT_SCHEMA, - async_create_event, + _async_create_event, required_features=[CalendarEntityFeature.CREATE_EVENT], ) component.async_register_entity_service(