diff --git a/homeassistant/components/guardian/__init__.py b/homeassistant/components/guardian/__init__.py index 8ccf69c7077..7fc12bece26 100644 --- a/homeassistant/components/guardian/__init__.py +++ b/homeassistant/components/guardian/__init__.py @@ -3,7 +3,7 @@ import asyncio from datetime import timedelta from aioguardian import Client -from aioguardian.commands.device import ( +from aioguardian.commands.system import ( DEFAULT_FIRMWARE_UPGRADE_FILENAME, DEFAULT_FIRMWARE_UPGRADE_PORT, DEFAULT_FIRMWARE_UPGRADE_URL, @@ -102,7 +102,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Disable the device's onboard access point.""" try: async with guardian.client: - await guardian.client.device.wifi_disable_ap() + await guardian.client.wifi.disable_ap() except GuardianError as err: LOGGER.error("Error during service call: %s", err) return @@ -112,7 +112,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Enable the device's onboard access point.""" try: async with guardian.client: - await guardian.client.device.wifi_enable_ap() + await guardian.client.wifi.enable_ap() except GuardianError as err: LOGGER.error("Error during service call: %s", err) return @@ -122,7 +122,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Reboot the device.""" try: async with guardian.client: - await guardian.client.device.reboot() + await guardian.client.system.reboot() except GuardianError as err: LOGGER.error("Error during service call: %s", err) return @@ -132,7 +132,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Fully reset system motor diagnostics.""" try: async with guardian.client: - await guardian.client.valve.valve_reset() + await guardian.client.valve.reset() except GuardianError as err: LOGGER.error("Error during service call: %s", err) return @@ -142,7 +142,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Upgrade the device firmware.""" try: async with guardian.client: - await guardian.client.device.upgrade_firmware( + await guardian.client.system.upgrade_firmware( url=call.data[CONF_URL], port=call.data[CONF_PORT], filename=call.data[CONF_FILENAME], @@ -191,12 +191,12 @@ class Guardian: self.uid = entry.data[CONF_UID] self._api_coros = { - DATA_DIAGNOSTICS: self.client.device.diagnostics, + DATA_DIAGNOSTICS: self.client.system.diagnostics, DATA_PAIR_DUMP: self.client.sensor.pair_dump, - DATA_PING: self.client.device.ping, - DATA_SENSOR_STATUS: self.client.sensor.sensor_status, - DATA_VALVE_STATUS: self.client.valve.valve_status, - DATA_WIFI_STATUS: self.client.device.wifi_status, + DATA_PING: self.client.system.ping, + DATA_SENSOR_STATUS: self.client.system.onboard_sensor_status, + DATA_VALVE_STATUS: self.client.valve.status, + DATA_WIFI_STATUS: self.client.wifi.status, } self._api_category_count = { diff --git a/homeassistant/components/guardian/config_flow.py b/homeassistant/components/guardian/config_flow.py index 769344e3b01..71ec271753e 100644 --- a/homeassistant/components/guardian/config_flow.py +++ b/homeassistant/components/guardian/config_flow.py @@ -34,7 +34,7 @@ async def validate_input(hass: core.HomeAssistant, data): Data has the keys from DATA_SCHEMA with values provided by the user. """ async with Client(data[CONF_IP_ADDRESS]) as client: - ping_data = await client.device.ping() + ping_data = await client.system.ping() return { CONF_UID: ping_data["data"]["uid"], diff --git a/homeassistant/components/guardian/manifest.json b/homeassistant/components/guardian/manifest.json index a3e2d9e66ee..72a11d15cfb 100644 --- a/homeassistant/components/guardian/manifest.json +++ b/homeassistant/components/guardian/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/guardian", "requirements": [ - "aioguardian==0.2.3" + "aioguardian==1.0.0" ], "ssdp": [], "zeroconf": [ diff --git a/homeassistant/components/guardian/switch.py b/homeassistant/components/guardian/switch.py index 39945f4da4e..f8af11768d2 100644 --- a/homeassistant/components/guardian/switch.py +++ b/homeassistant/components/guardian/switch.py @@ -64,7 +64,7 @@ class GuardianSwitch(GuardianEntity, SwitchEntity): """Turn the valve off (closed).""" try: async with self._guardian.client: - await self._guardian.client.valve.valve_close() + await self._guardian.client.valve.close() except GuardianError as err: LOGGER.error("Error while closing the valve: %s", err) return @@ -76,7 +76,7 @@ class GuardianSwitch(GuardianEntity, SwitchEntity): """Turn the valve on (open).""" try: async with self._guardian.client: - await self._guardian.client.valve.valve_open() + await self._guardian.client.valve.open() except GuardianError as err: LOGGER.error("Error while opening the valve: %s", err) return diff --git a/requirements_all.txt b/requirements_all.txt index beeb837a4e9..60a90d1e72c 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -178,7 +178,7 @@ aiofreepybox==0.0.8 aioftp==0.12.0 # homeassistant.components.guardian -aioguardian==0.2.3 +aioguardian==1.0.0 # homeassistant.components.harmony aioharmony==0.2.5 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c5223644ba3..ad91ada704a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -85,7 +85,7 @@ aioesphomeapi==2.6.1 aiofreepybox==0.0.8 # homeassistant.components.guardian -aioguardian==0.2.3 +aioguardian==1.0.0 # homeassistant.components.harmony aioharmony==0.2.5 diff --git a/tests/components/guardian/conftest.py b/tests/components/guardian/conftest.py index 40df9c3cdb1..f54b285b960 100644 --- a/tests/components/guardian/conftest.py +++ b/tests/components/guardian/conftest.py @@ -9,7 +9,7 @@ def ping_client(): with patch( "homeassistant.components.guardian.async_setup_entry", return_value=True ), patch("aioguardian.client.Client.connect"), patch( - "aioguardian.commands.device.Device.ping", + "aioguardian.commands.system.SystemCommands.ping", return_value={"command": 0, "status": "ok", "data": {"uid": "ABCDEF123456"}}, ), patch( "aioguardian.client.Client.disconnect"