diff --git a/custom_components/myenergi/__init__.py b/custom_components/myenergi/__init__.py index c9b515d..ca7a6e9 100644 --- a/custom_components/myenergi/__init__.py +++ b/custom_components/myenergi/__init__.py @@ -15,6 +15,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.helpers.update_coordinator import UpdateFailed +from homeassistant.helpers.httpx_client import get_async_client from pymyenergi.client import MyenergiClient from pymyenergi.connection import Connection @@ -48,8 +49,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): app_email = entry.data.get(CONF_APP_EMAIL) app_password = entry.data.get(CONF_APP_PASSWORD) + async_client = get_async_client(hass) + conn = await hass.async_add_executor_job( - Connection, username, password, app_password, app_email + Connection, username, password, app_password, app_email, 20, async_client ) if app_email and app_password: await conn.discoverLocations() @@ -107,6 +110,7 @@ async def _async_update_data(self): await self.client.refresh() await self.client.refresh_history(utc_today, 24, "hour") except Exception as exception: + _LOGGER.debug(exception) raise UpdateFailed() from exception diff --git a/custom_components/myenergi/manifest.json b/custom_components/myenergi/manifest.json index 1cd9314..19f0c39 100644 --- a/custom_components/myenergi/manifest.json +++ b/custom_components/myenergi/manifest.json @@ -7,6 +7,6 @@ "documentation": "https://github.com/cjne/ha-myenergi", "iot_class": "cloud_polling", "issue_tracker": "https://github.com/cjne/ha-myenergi/issues", - "requirements": ["pymyenergi==0.2.1"], + "requirements": ["pymyenergi==0.2.2"], "version": "0.0.28" }