From 78adeb837e31a09a1323bde0d0c25a1f59cd9ae7 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 29 Dec 2025 21:18:34 +0100 Subject: [PATCH] Inject session in Switchbot cloud (#159942) --- homeassistant/components/switchbot_cloud/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switchbot_cloud/__init__.py b/homeassistant/components/switchbot_cloud/__init__.py index e25763bc894..4573d04e2a0 100644 --- a/homeassistant/components/switchbot_cloud/__init__.py +++ b/homeassistant/components/switchbot_cloud/__init__.py @@ -20,6 +20,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_API_KEY, CONF_API_TOKEN, CONF_WEBHOOK_ID, Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady +from homeassistant.helpers.aiohttp_client import async_get_clientsession from .const import DOMAIN, ENTRY_TITLE from .coordinator import SwitchBotCoordinator @@ -309,7 +310,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: token = entry.data[CONF_API_TOKEN] secret = entry.data[CONF_API_KEY] - api = SwitchBotAPI(token=token, secret=secret) + api = SwitchBotAPI( + token=token, secret=secret, session=async_get_clientsession(hass) + ) try: devices = await api.list_devices() except SwitchBotAuthenticationError as ex: