diff --git a/homeassistant/components/ecovacs/config_flow.py b/homeassistant/components/ecovacs/config_flow.py index 75a0d28ae91..7b56417f93e 100644 --- a/homeassistant/components/ecovacs/config_flow.py +++ b/homeassistant/components/ecovacs/config_flow.py @@ -5,9 +5,8 @@ import logging from typing import Any, cast from aiohttp import ClientError -from deebot_client.authentication import Authenticator +from deebot_client.authentication import Authenticator, create_rest_config from deebot_client.exceptions import InvalidAuthenticationError -from deebot_client.models import Configuration from deebot_client.util import md5 from deebot_client.util.continents import COUNTRIES_TO_CONTINENTS, get_continent import voluptuous as vol @@ -32,15 +31,14 @@ async def _validate_input( """Validate user input.""" errors: dict[str, str] = {} - deebot_config = Configuration( + rest_config = create_rest_config( aiohttp_client.async_get_clientsession(hass), device_id=get_client_device_id(), country=user_input[CONF_COUNTRY], - continent=user_input.get(CONF_CONTINENT), ) authenticator = Authenticator( - deebot_config, + rest_config, user_input[CONF_USERNAME], md5(user_input[CONF_PASSWORD]), ) diff --git a/homeassistant/components/ecovacs/controller.py b/homeassistant/components/ecovacs/controller.py index 645c5b9bc19..e0c3497c178 100644 --- a/homeassistant/components/ecovacs/controller.py +++ b/homeassistant/components/ecovacs/controller.py @@ -6,20 +6,16 @@ import logging from typing import Any from deebot_client.api_client import ApiClient -from deebot_client.authentication import Authenticator +from deebot_client.authentication import Authenticator, create_rest_config from deebot_client.device import Device from deebot_client.exceptions import DeebotError, InvalidAuthenticationError -from deebot_client.models import Configuration, DeviceInfo -from deebot_client.mqtt_client import MqttClient, MqttConfiguration +from deebot_client.models import DeviceInfo +from deebot_client.mqtt_client import MqttClient, create_mqtt_config from deebot_client.util import md5 +from deebot_client.util.continents import get_continent from sucks import EcoVacsAPI, VacBot -from homeassistant.const import ( - CONF_COUNTRY, - CONF_PASSWORD, - CONF_USERNAME, - CONF_VERIFY_SSL, -) +from homeassistant.const import CONF_COUNTRY, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryError, ConfigEntryNotReady from homeassistant.helpers import aiohttp_client @@ -37,25 +33,27 @@ class EcovacsController: self._hass = hass self.devices: list[Device] = [] self.legacy_devices: list[VacBot] = [] - verify_ssl = config.get(CONF_VERIFY_SSL, True) - device_id = get_client_device_id() - - self._config = Configuration( - aiohttp_client.async_get_clientsession(self._hass, verify_ssl=verify_ssl), - device_id=device_id, - country=config[CONF_COUNTRY], - verify_ssl=verify_ssl, - ) + self._device_id = get_client_device_id() + country = config[CONF_COUNTRY] + self._continent = get_continent(country) self._authenticator = Authenticator( - self._config, + create_rest_config( + aiohttp_client.async_get_clientsession(self._hass), + device_id=self._device_id, + country=country, + ), config[CONF_USERNAME], md5(config[CONF_PASSWORD]), ) self._api_client = ApiClient(self._authenticator) - - mqtt_config = MqttConfiguration(config=self._config) - self._mqtt = MqttClient(mqtt_config, self._authenticator) + self._mqtt = MqttClient( + create_mqtt_config( + device_id=self._device_id, + country=country, + ), + self._authenticator, + ) async def initialize(self) -> None: """Init controller.""" @@ -72,10 +70,10 @@ class EcovacsController: bot = VacBot( credentials.user_id, EcoVacsAPI.REALM, - self._config.device_id[0:8], + self._device_id[0:8], credentials.token, device_config, - self._config.continent, + self._continent, monitor=True, ) self.legacy_devices.append(bot) diff --git a/homeassistant/components/ecovacs/manifest.json b/homeassistant/components/ecovacs/manifest.json index d08602bbba8..3472e4746f8 100644 --- a/homeassistant/components/ecovacs/manifest.json +++ b/homeassistant/components/ecovacs/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/ecovacs", "iot_class": "cloud_push", "loggers": ["sleekxmppfs", "sucks", "deebot_client"], - "requirements": ["py-sucks==0.9.8", "deebot-client==4.3.0"] + "requirements": ["py-sucks==0.9.8", "deebot-client==5.0.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 82e73d6bbe7..316a8216bbb 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -681,7 +681,7 @@ debugpy==1.8.0 # decora==0.6 # homeassistant.components.ecovacs -deebot-client==4.3.0 +deebot-client==5.0.0 # homeassistant.components.ihc # homeassistant.components.namecheapdns diff --git a/requirements_test_all.txt b/requirements_test_all.txt index a0c493ebdb8..f9e5b61efbc 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -556,7 +556,7 @@ dbus-fast==2.21.1 debugpy==1.8.0 # homeassistant.components.ecovacs -deebot-client==4.3.0 +deebot-client==5.0.0 # homeassistant.components.ihc # homeassistant.components.namecheapdns