Add additional calendar state alarm debugging (#101631)

This commit is contained in:
Allen Porter 2023-10-08 05:20:35 -07:00 committed by GitHub
parent faea3b1634
commit 0f4aae4128
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -528,7 +528,9 @@ class CalendarEntity(Entity):
the current or upcoming event.
"""
super().async_write_ha_state()
_LOGGER.debug(
"Clearing %s alarms (%s)", self.entity_id, len(self._alarm_unsubs)
)
for unsub in self._alarm_unsubs:
unsub()
self._alarm_unsubs.clear()
@ -536,6 +538,7 @@ class CalendarEntity(Entity):
now = dt_util.now()
event = self.event
if event is None or now >= event.end_datetime_local:
_LOGGER.debug("No alarms needed for %s (event=%s)", self.entity_id, event)
return
@callback