From 5f36023b9eb755b1877b080b573966a63129916d Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Thu, 9 Jul 2020 20:52:13 -0600 Subject: [PATCH] Actually fix Guardian entity services (#37700) * Actually fix Guardian entity services * Bump aioguardian * Remove upgrade_firmware defaults --- .../components/guardian/manifest.json | 2 +- .../components/guardian/services.yaml | 15 ++++------ homeassistant/components/guardian/switch.py | 29 ++++++------------- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 5 files changed, 17 insertions(+), 33 deletions(-) diff --git a/homeassistant/components/guardian/manifest.json b/homeassistant/components/guardian/manifest.json index 72a11d15cfb..6d69597a065 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==1.0.0" + "aioguardian==1.0.1" ], "ssdp": [], "zeroconf": [ diff --git a/homeassistant/components/guardian/services.yaml b/homeassistant/components/guardian/services.yaml index 9d1cef25227..6e20e2aca9d 100644 --- a/homeassistant/components/guardian/services.yaml +++ b/homeassistant/components/guardian/services.yaml @@ -4,36 +4,31 @@ disable_ap: fields: entity_id: description: The Guardian valve controller to affect. - area_id: - description: The area to affect. + example: switch.guardian_abcde_valve enable_ap: description: Enable the device's onboard access point. fields: entity_id: description: The Guardian valve controller to affect. - area_id: - description: The area to affect. + example: switch.guardian_abcde_valve reboot: description: Reboot the device. fields: entity_id: description: The Guardian valve controller to affect. - area_id: - description: The area to affect. + example: switch.guardian_abcde_valve reset_valve_diagnostics: description: Fully (and irrecoverably) reset all valve diagnostics. fields: entity_id: description: The Guardian valve controller to affect. - area_id: - description: The area to affect. + example: switch.guardian_abcde_valve upgrade_firmware: description: Upgrade the device firmware. fields: entity_id: description: The Guardian valve controller to affect. - area_id: - description: The area to affect. + example: switch.guardian_abcde_valve url: description: (optional) The URL of the server hosting the firmware file. example: https://repo.guardiancloud.services/gvc/fw diff --git a/homeassistant/components/guardian/switch.py b/homeassistant/components/guardian/switch.py index af42c5b3900..6822fea6de2 100644 --- a/homeassistant/components/guardian/switch.py +++ b/homeassistant/components/guardian/switch.py @@ -2,11 +2,6 @@ from typing import Callable, Dict from aioguardian import Client -from aioguardian.commands.system import ( - DEFAULT_FIRMWARE_UPGRADE_FILENAME, - DEFAULT_FIRMWARE_UPGRADE_PORT, - DEFAULT_FIRMWARE_UPGRADE_URL, -) from aioguardian.errors import GuardianError import voluptuous as vol @@ -31,16 +26,6 @@ SERVICE_REBOOT = "reboot" SERVICE_RESET_VALVE_DIAGNOSTICS = "reset_valve_diagnostics" SERVICE_UPGRADE_FIRMWARE = "upgrade_firmware" -SERVICE_UPGRADE_FIRMWARE_SCHEMA = vol.Schema( - { - vol.Optional(CONF_URL, default=DEFAULT_FIRMWARE_UPGRADE_URL): cv.url, - vol.Optional(CONF_PORT, default=DEFAULT_FIRMWARE_UPGRADE_PORT): cv.port, - vol.Optional( - CONF_FILENAME, default=DEFAULT_FIRMWARE_UPGRADE_FILENAME - ): cv.string, - } -) - async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable @@ -49,13 +34,17 @@ async def async_setup_entry( platform = entity_platform.current_platform.get() for service_name, schema, method in [ - (SERVICE_DISABLE_AP, None, "async_disable_ap"), - (SERVICE_ENABLE_AP, None, "async_enable_ap"), - (SERVICE_REBOOT, None, "async_reboot"), - (SERVICE_RESET_VALVE_DIAGNOSTICS, None, "async_reset_valve_diagnostics"), + (SERVICE_DISABLE_AP, {}, "async_disable_ap"), + (SERVICE_ENABLE_AP, {}, "async_enable_ap"), + (SERVICE_REBOOT, {}, "async_reboot"), + (SERVICE_RESET_VALVE_DIAGNOSTICS, {}, "async_reset_valve_diagnostics"), ( SERVICE_UPGRADE_FIRMWARE, - SERVICE_UPGRADE_FIRMWARE_SCHEMA, + { + vol.Optional(CONF_URL): cv.url, + vol.Optional(CONF_PORT): cv.port, + vol.Optional(CONF_FILENAME): cv.string, + }, "async_upgrade_firmware", ), ]: diff --git a/requirements_all.txt b/requirements_all.txt index 275e53e5ba8..c78c8a4d81e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -179,7 +179,7 @@ aiofreepybox==0.0.8 aioftp==0.12.0 # homeassistant.components.guardian -aioguardian==1.0.0 +aioguardian==1.0.1 # homeassistant.components.harmony aioharmony==0.2.5 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index fe390b8cfc6..486bec87556 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==1.0.0 +aioguardian==1.0.1 # homeassistant.components.harmony aioharmony==0.2.5