Bump aioguardian (#37188)

* Bump aioguardian

* Fix tests
This commit is contained in:
Aaron Bach 2020-06-27 23:16:42 -06:00 committed by GitHub
parent 201dab93ff
commit b0df223f5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 18 deletions

View file

@ -3,7 +3,7 @@ import asyncio
from datetime import timedelta from datetime import timedelta
from aioguardian import Client from aioguardian import Client
from aioguardian.commands.device import ( from aioguardian.commands.system import (
DEFAULT_FIRMWARE_UPGRADE_FILENAME, DEFAULT_FIRMWARE_UPGRADE_FILENAME,
DEFAULT_FIRMWARE_UPGRADE_PORT, DEFAULT_FIRMWARE_UPGRADE_PORT,
DEFAULT_FIRMWARE_UPGRADE_URL, DEFAULT_FIRMWARE_UPGRADE_URL,
@ -102,7 +102,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Disable the device's onboard access point.""" """Disable the device's onboard access point."""
try: try:
async with guardian.client: async with guardian.client:
await guardian.client.device.wifi_disable_ap() await guardian.client.wifi.disable_ap()
except GuardianError as err: except GuardianError as err:
LOGGER.error("Error during service call: %s", err) LOGGER.error("Error during service call: %s", err)
return return
@ -112,7 +112,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Enable the device's onboard access point.""" """Enable the device's onboard access point."""
try: try:
async with guardian.client: async with guardian.client:
await guardian.client.device.wifi_enable_ap() await guardian.client.wifi.enable_ap()
except GuardianError as err: except GuardianError as err:
LOGGER.error("Error during service call: %s", err) LOGGER.error("Error during service call: %s", err)
return return
@ -122,7 +122,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Reboot the device.""" """Reboot the device."""
try: try:
async with guardian.client: async with guardian.client:
await guardian.client.device.reboot() await guardian.client.system.reboot()
except GuardianError as err: except GuardianError as err:
LOGGER.error("Error during service call: %s", err) LOGGER.error("Error during service call: %s", err)
return return
@ -132,7 +132,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Fully reset system motor diagnostics.""" """Fully reset system motor diagnostics."""
try: try:
async with guardian.client: async with guardian.client:
await guardian.client.valve.valve_reset() await guardian.client.valve.reset()
except GuardianError as err: except GuardianError as err:
LOGGER.error("Error during service call: %s", err) LOGGER.error("Error during service call: %s", err)
return return
@ -142,7 +142,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Upgrade the device firmware.""" """Upgrade the device firmware."""
try: try:
async with guardian.client: async with guardian.client:
await guardian.client.device.upgrade_firmware( await guardian.client.system.upgrade_firmware(
url=call.data[CONF_URL], url=call.data[CONF_URL],
port=call.data[CONF_PORT], port=call.data[CONF_PORT],
filename=call.data[CONF_FILENAME], filename=call.data[CONF_FILENAME],
@ -191,12 +191,12 @@ class Guardian:
self.uid = entry.data[CONF_UID] self.uid = entry.data[CONF_UID]
self._api_coros = { self._api_coros = {
DATA_DIAGNOSTICS: self.client.device.diagnostics, DATA_DIAGNOSTICS: self.client.system.diagnostics,
DATA_PAIR_DUMP: self.client.sensor.pair_dump, DATA_PAIR_DUMP: self.client.sensor.pair_dump,
DATA_PING: self.client.device.ping, DATA_PING: self.client.system.ping,
DATA_SENSOR_STATUS: self.client.sensor.sensor_status, DATA_SENSOR_STATUS: self.client.system.onboard_sensor_status,
DATA_VALVE_STATUS: self.client.valve.valve_status, DATA_VALVE_STATUS: self.client.valve.status,
DATA_WIFI_STATUS: self.client.device.wifi_status, DATA_WIFI_STATUS: self.client.wifi.status,
} }
self._api_category_count = { self._api_category_count = {

View file

@ -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. Data has the keys from DATA_SCHEMA with values provided by the user.
""" """
async with Client(data[CONF_IP_ADDRESS]) as client: async with Client(data[CONF_IP_ADDRESS]) as client:
ping_data = await client.device.ping() ping_data = await client.system.ping()
return { return {
CONF_UID: ping_data["data"]["uid"], CONF_UID: ping_data["data"]["uid"],

View file

@ -4,7 +4,7 @@
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/guardian", "documentation": "https://www.home-assistant.io/integrations/guardian",
"requirements": [ "requirements": [
"aioguardian==0.2.3" "aioguardian==1.0.0"
], ],
"ssdp": [], "ssdp": [],
"zeroconf": [ "zeroconf": [

View file

@ -64,7 +64,7 @@ class GuardianSwitch(GuardianEntity, SwitchEntity):
"""Turn the valve off (closed).""" """Turn the valve off (closed)."""
try: try:
async with self._guardian.client: async with self._guardian.client:
await self._guardian.client.valve.valve_close() await self._guardian.client.valve.close()
except GuardianError as err: except GuardianError as err:
LOGGER.error("Error while closing the valve: %s", err) LOGGER.error("Error while closing the valve: %s", err)
return return
@ -76,7 +76,7 @@ class GuardianSwitch(GuardianEntity, SwitchEntity):
"""Turn the valve on (open).""" """Turn the valve on (open)."""
try: try:
async with self._guardian.client: async with self._guardian.client:
await self._guardian.client.valve.valve_open() await self._guardian.client.valve.open()
except GuardianError as err: except GuardianError as err:
LOGGER.error("Error while opening the valve: %s", err) LOGGER.error("Error while opening the valve: %s", err)
return return

View file

@ -178,7 +178,7 @@ aiofreepybox==0.0.8
aioftp==0.12.0 aioftp==0.12.0
# homeassistant.components.guardian # homeassistant.components.guardian
aioguardian==0.2.3 aioguardian==1.0.0
# homeassistant.components.harmony # homeassistant.components.harmony
aioharmony==0.2.5 aioharmony==0.2.5

View file

@ -85,7 +85,7 @@ aioesphomeapi==2.6.1
aiofreepybox==0.0.8 aiofreepybox==0.0.8
# homeassistant.components.guardian # homeassistant.components.guardian
aioguardian==0.2.3 aioguardian==1.0.0
# homeassistant.components.harmony # homeassistant.components.harmony
aioharmony==0.2.5 aioharmony==0.2.5

View file

@ -9,7 +9,7 @@ def ping_client():
with patch( with patch(
"homeassistant.components.guardian.async_setup_entry", return_value=True "homeassistant.components.guardian.async_setup_entry", return_value=True
), patch("aioguardian.client.Client.connect"), patch( ), 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"}}, return_value={"command": 0, "status": "ok", "data": {"uid": "ABCDEF123456"}},
), patch( ), patch(
"aioguardian.client.Client.disconnect" "aioguardian.client.Client.disconnect"