diff --git a/custom_components/authenticated/sensor.py b/custom_components/authenticated/sensor.py index 8dc0eac..705f91d 100644 --- a/custom_components/authenticated/sensor.py +++ b/custom_components/authenticated/sensor.py @@ -16,6 +16,7 @@ import homeassistant.helpers.config_validation as cv import voluptuous as vol import yaml +from homeassistant.components import persistent_notification from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.helpers.entity import Entity @@ -459,7 +460,7 @@ def lookup(self): def notify(self, hass): """Create persistant notification.""" - notify = hass.components.persistent_notification.create + notify = persistent_notification.create message = f""" **IP Address:** {self.ip_address} **Username:** {self.username} @@ -479,4 +480,4 @@ def notify(self, hass): if self.last_used_at is not None: message += f"**Login time:** {self.last_used_at[:19].replace('T', ' ')}" - notify(message, title="New successful login", notification_id=self.ip_address) + notify(hass, message, title="New successful login", notification_id=self.ip_address)