mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Fix lingering timer in alert integration (#91452)
This commit is contained in:
parent
3367e86686
commit
7c9242b4a7
@ -25,7 +25,7 @@ from homeassistant.const import (
|
|||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.core import Event, HomeAssistant
|
from homeassistant.core import Event, HassJob, HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
@ -237,7 +237,13 @@ class Alert(Entity):
|
|||||||
"""Schedule a notification."""
|
"""Schedule a notification."""
|
||||||
delay = self._delay[self._next_delay]
|
delay = self._delay[self._next_delay]
|
||||||
next_msg = now() + delay
|
next_msg = now() + delay
|
||||||
self._cancel = async_track_point_in_time(self.hass, self._notify, next_msg)
|
self._cancel = async_track_point_in_time(
|
||||||
|
self.hass,
|
||||||
|
HassJob(
|
||||||
|
self._notify, name="Schedule notify alert", cancel_on_shutdown=True
|
||||||
|
),
|
||||||
|
next_msg,
|
||||||
|
)
|
||||||
self._next_delay = min(self._next_delay + 1, len(self._delay) - 1)
|
self._next_delay = min(self._next_delay + 1, len(self._delay) - 1)
|
||||||
|
|
||||||
async def _notify(self, *args: Any) -> None:
|
async def _notify(self, *args: Any) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user