From d5377e4c210b998598d79ddf581e1578665439fb Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:00:52 -0700 Subject: [PATCH] fix: fix deprecated hass.components use (#2468) --- custom_components/alexa_media/config_flow.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index 4ae546d3..9dd32173 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -28,6 +28,9 @@ ) from homeassistant import config_entries from homeassistant.components.http.view import HomeAssistantView +from homeassistant.components.persistent_notification import ( + async_dismiss as async_dismiss_persistent_notification, +) from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_URL from homeassistant.core import callback from homeassistant.data_entry_flow import FlowResult, UnknownFlow @@ -642,7 +645,7 @@ async def _test_login(self): "alexa_media_relogin_success", event_data={"email": hide_email(email), "url": login.url}, ) - self.hass.components.persistent_notification.async_dismiss( + async_dismiss_persistent_notification( f"alexa_media_{slugify(email)}{slugify(login.url[7:])}" ) if not self.hass.data[DATA_ALEXAMEDIA]["accounts"].get( @@ -695,7 +698,7 @@ async def _test_login(self): if login.status and (login.status.get("login_failed")): _LOGGER.debug("Login failed: %s", login.status.get("login_failed")) await login.close() - self.hass.components.persistent_notification.async_dismiss( + async_dismiss_persistent_notification( f"alexa_media_{slugify(email)}{slugify(login.url[7:])}" ) return self.async_abort(reason="login_failed")