From 7dc5d131b4cf6ec81e8d230c1cc7b5f06d6d6ce5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 4 May 2023 11:38:24 +0200 Subject: [PATCH] Fix lingering timer in jewish_calendar (#92470) --- homeassistant/components/jewish_calendar/binary_sensor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/homeassistant/components/jewish_calendar/binary_sensor.py b/homeassistant/components/jewish_calendar/binary_sensor.py index 3d28e2bb0c0..e127d78229f 100644 --- a/homeassistant/components/jewish_calendar/binary_sensor.py +++ b/homeassistant/components/jewish_calendar/binary_sensor.py @@ -116,6 +116,13 @@ class JewishCalendarBinarySensor(BinarySensorEntity): await super().async_added_to_hass() self._schedule_update() + async def async_will_remove_from_hass(self) -> None: + """Run when entity will be removed from hass.""" + if self._update_unsub: + self._update_unsub() + self._update_unsub = None + return await super().async_will_remove_from_hass() + @callback def _update(self, now: datetime | None = None) -> None: """Update the state of the sensor."""