Skip to content

Commit

Permalink
Fixes issue with multiple alerts (#23945)
Browse files Browse the repository at this point in the history
* Fixes issue with multiple alerts

* Adds missing new line

* Remove whitespace
  • Loading branch information
ludeeus authored and pvizeli committed May 18, 2019
1 parent 91ba35c commit 57bd418
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/components/alert/__init__.py
@@ -1,7 +1,7 @@
"""Support for repeating alerts when conditions are met."""
import asyncio
import logging
from datetime import datetime, timedelta
from datetime import timedelta

import voluptuous as vol

Expand All @@ -13,6 +13,7 @@
SERVICE_TURN_ON, SERVICE_TURN_OFF, SERVICE_TOGGLE, ATTR_ENTITY_ID)
from homeassistant.helpers import service, event
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.util.dt import now

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -222,7 +223,7 @@ async def end_alerting(self):
async def _schedule_notify(self):
"""Schedule a notification."""
delay = self._delay[self._next_delay]
next_msg = datetime.now() + delay
next_msg = now() + delay
self._cancel = \
event.async_track_point_in_time(self.hass, self._notify, next_msg)
self._next_delay = min(self._next_delay + 1, len(self._delay) - 1)
Expand Down

0 comments on commit 57bd418

Please sign in to comment.