From 57bd4185d42f9df0eef701926c7749dfb6096bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 18 May 2019 22:59:33 +0200 Subject: [PATCH] Fixes issue with multiple alerts (#23945) * Fixes issue with multiple alerts * Adds missing new line * Remove whitespace --- homeassistant/components/alert/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/alert/__init__.py b/homeassistant/components/alert/__init__.py index 4c990d62d4b..88217b026fd 100644 --- a/homeassistant/components/alert/__init__.py +++ b/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 @@ -13,6 +13,7 @@ from homeassistant.const import ( 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__) @@ -222,7 +223,7 @@ class Alert(ToggleEntity): 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)