parent
201dab93ff
commit
b0df223f5a
|
@ -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 = {
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -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": [
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue