From 6e621f0146cea969dc4f38441ef8efd1a2482f6f Mon Sep 17 00:00:00 2001 From: jcgoette Date: Tue, 24 Sep 2024 12:38:38 -0400 Subject: [PATCH] feat: Update hass.helpers usage before Home Assistant 2024.11 --- custom_components/babybuddy/__init__.py | 3 ++- custom_components/babybuddy/config_flow.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/babybuddy/__init__.py b/custom_components/babybuddy/__init__.py index b84c877..bb2ad06 100644 --- a/custom_components/babybuddy/__init__.py +++ b/custom_components/babybuddy/__init__.py @@ -22,6 +22,7 @@ from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers import config_validation as cv +from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.device_registry import ( DeviceRegistry, async_entries_for_config_entry, @@ -128,7 +129,7 @@ def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None: config_entry.data[CONF_PORT], config_entry.data[CONF_PATH], config_entry.data[CONF_API_KEY], - hass.helpers.aiohttp_client.async_get_clientsession(), + async_get_clientsession(self.hass), ) self.device_registry: DeviceRegistry = async_get(self.hass) self.child_ids: list[str] = [] diff --git a/custom_components/babybuddy/config_flow.py b/custom_components/babybuddy/config_flow.py index 790eb58..bf822e7 100644 --- a/custom_components/babybuddy/config_flow.py +++ b/custom_components/babybuddy/config_flow.py @@ -19,6 +19,7 @@ ) from homeassistant.core import callback from homeassistant.data_entry_flow import FlowResult +from homeassistant.helpers.aiohttp_client import async_get_clientsession from .client import BabyBuddyClient from .const import ( @@ -78,7 +79,7 @@ async def async_step_user( user_input[CONF_PORT], user_input[CONF_PATH], user_input[CONF_API_KEY], - self.hass.helpers.aiohttp_client.async_get_clientsession(), + async_get_clientsession(self.hass), ) await client.async_connect() except AuthorizationError: @@ -120,7 +121,7 @@ async def async_step_reauth_confirm( user_input[CONF_PORT], user_input[CONF_PATH], user_input[CONF_API_KEY], - self.hass.helpers.aiohttp_client.async_get_clientsession(), + async_get_clientsession(self.hass), ) await client.async_connect() except ConnectError: