From 1967ce67d7e28c3a04d29faaeed3032f2f0441e5 Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Thu, 27 Oct 2022 02:19:07 -0600 Subject: [PATCH] Remove previously-deprecated Guardian services and binary sensor (#81056) --- homeassistant/components/guardian/__init__.py | 30 ------------------- .../components/guardian/binary_sensor.py | 18 ++--------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/homeassistant/components/guardian/__init__.py b/homeassistant/components/guardian/__init__.py index 63fc66f685d..24999f98e16 100644 --- a/homeassistant/components/guardian/__init__.py +++ b/homeassistant/components/guardian/__init__.py @@ -44,15 +44,11 @@ from .util import GuardianDataUpdateCoordinator DATA_PAIRED_SENSOR_MANAGER = "paired_sensor_manager" -SERVICE_NAME_DISABLE_AP = "disable_ap" -SERVICE_NAME_ENABLE_AP = "enable_ap" SERVICE_NAME_PAIR_SENSOR = "pair_sensor" SERVICE_NAME_UNPAIR_SENSOR = "unpair_sensor" SERVICE_NAME_UPGRADE_FIRMWARE = "upgrade_firmware" SERVICES = ( - SERVICE_NAME_DISABLE_AP, - SERVICE_NAME_ENABLE_AP, SERVICE_NAME_PAIR_SENSOR, SERVICE_NAME_UNPAIR_SENSOR, SERVICE_NAME_UPGRADE_FIRMWARE, @@ -231,30 +227,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return wrapper - @call_with_data - async def async_disable_ap(call: ServiceCall, data: GuardianData) -> None: - """Disable the onboard AP.""" - async_log_deprecated_service_call( - hass, - call, - "switch.turn_off", - f"switch.guardian_valve_controller_{entry.data[CONF_UID]}_onboard_ap", - "2022.12.0", - ) - await data.client.wifi.disable_ap() - - @call_with_data - async def async_enable_ap(call: ServiceCall, data: GuardianData) -> None: - """Enable the onboard AP.""" - async_log_deprecated_service_call( - hass, - call, - "switch.turn_on", - f"switch.guardian_valve_controller_{entry.data[CONF_UID]}_onboard_ap", - "2022.12.0", - ) - await data.client.wifi.enable_ap() - @call_with_data async def async_pair_sensor(call: ServiceCall, data: GuardianData) -> None: """Add a new paired sensor.""" @@ -279,8 +251,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ) for service_name, schema, method in ( - (SERVICE_NAME_DISABLE_AP, SERVICE_BASE_SCHEMA, async_disable_ap), - (SERVICE_NAME_ENABLE_AP, SERVICE_BASE_SCHEMA, async_enable_ap), ( SERVICE_NAME_PAIR_SENSOR, SERVICE_PAIR_UNPAIR_SENSOR_SCHEMA, diff --git a/homeassistant/components/guardian/binary_sensor.py b/homeassistant/components/guardian/binary_sensor.py index 6425ecd46a6..a2f2a7a593e 100644 --- a/homeassistant/components/guardian/binary_sensor.py +++ b/homeassistant/components/guardian/binary_sensor.py @@ -23,7 +23,6 @@ from . import ( ) from .const import ( API_SYSTEM_ONBOARD_SENSOR_STATUS, - API_WIFI_STATUS, CONF_UID, DOMAIN, SIGNAL_PAIRED_SENSOR_COORDINATOR_ADDED, @@ -36,7 +35,6 @@ from .util import ( ATTR_CONNECTED_CLIENTS = "connected_clients" -SENSOR_KIND_AP_INFO = "ap_enabled" SENSOR_KIND_LEAK_DETECTED = "leak_detected" SENSOR_KIND_MOVED = "moved" @@ -69,13 +67,6 @@ VALVE_CONTROLLER_DESCRIPTIONS = ( device_class=BinarySensorDeviceClass.MOISTURE, api_category=API_SYSTEM_ONBOARD_SENSOR_STATUS, ), - ValveControllerBinarySensorDescription( - key=SENSOR_KIND_AP_INFO, - name="Onboard AP enabled", - device_class=BinarySensorDeviceClass.CONNECTIVITY, - entity_category=EntityCategory.DIAGNOSTIC, - api_category=API_WIFI_STATUS, - ), ) @@ -95,7 +86,7 @@ async def async_setup_entry( f"{uid}_ap_enabled", f"switch.guardian_valve_controller_{uid}_onboard_ap", "2022.12.0", - remove_old_entity=False, + remove_old_entity=True, ), ), ) @@ -183,10 +174,5 @@ class ValveControllerBinarySensor(ValveControllerEntity, BinarySensorEntity): @callback def _async_update_from_latest_data(self) -> None: """Update the entity.""" - if self.entity_description.key == SENSOR_KIND_AP_INFO: - self._attr_is_on = self.coordinator.data["station_connected"] - self._attr_extra_state_attributes[ - ATTR_CONNECTED_CLIENTS - ] = self.coordinator.data.get("ap_clients") - elif self.entity_description.key == SENSOR_KIND_LEAK_DETECTED: + if self.entity_description.key == SENSOR_KIND_LEAK_DETECTED: self._attr_is_on = self.coordinator.data["wet"]