mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Fix bug in calendar state transitions (#102083)
This commit is contained in:
parent
422252e3a0
commit
ce7573c3ad
@ -483,7 +483,7 @@ class CalendarEntity(Entity):
|
|||||||
|
|
||||||
_entity_component_unrecorded_attributes = frozenset({"description"})
|
_entity_component_unrecorded_attributes = frozenset({"description"})
|
||||||
|
|
||||||
_alarm_unsubs: list[CALLBACK_TYPE] = []
|
_alarm_unsubs: list[CALLBACK_TYPE] | None = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def event(self) -> CalendarEvent | None:
|
def event(self) -> CalendarEvent | None:
|
||||||
@ -528,6 +528,8 @@ class CalendarEntity(Entity):
|
|||||||
the current or upcoming event.
|
the current or upcoming event.
|
||||||
"""
|
"""
|
||||||
super().async_write_ha_state()
|
super().async_write_ha_state()
|
||||||
|
if self._alarm_unsubs is None:
|
||||||
|
self._alarm_unsubs = []
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Clearing %s alarms (%s)", self.entity_id, len(self._alarm_unsubs)
|
"Clearing %s alarms (%s)", self.entity_id, len(self._alarm_unsubs)
|
||||||
)
|
)
|
||||||
@ -571,9 +573,9 @@ class CalendarEntity(Entity):
|
|||||||
|
|
||||||
To be extended by integrations.
|
To be extended by integrations.
|
||||||
"""
|
"""
|
||||||
for unsub in self._alarm_unsubs:
|
for unsub in self._alarm_unsubs or ():
|
||||||
unsub()
|
unsub()
|
||||||
self._alarm_unsubs.clear()
|
self._alarm_unsubs = None
|
||||||
|
|
||||||
async def async_get_events(
|
async def async_get_events(
|
||||||
self,
|
self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user