Remove previously-deprecated Guardian services and binary sensor (#81056)
This commit is contained in:
parent
7213102c51
commit
1967ce67d7
2 changed files with 2 additions and 46 deletions
|
@ -44,15 +44,11 @@ from .util import GuardianDataUpdateCoordinator
|
||||||
|
|
||||||
DATA_PAIRED_SENSOR_MANAGER = "paired_sensor_manager"
|
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_PAIR_SENSOR = "pair_sensor"
|
||||||
SERVICE_NAME_UNPAIR_SENSOR = "unpair_sensor"
|
SERVICE_NAME_UNPAIR_SENSOR = "unpair_sensor"
|
||||||
SERVICE_NAME_UPGRADE_FIRMWARE = "upgrade_firmware"
|
SERVICE_NAME_UPGRADE_FIRMWARE = "upgrade_firmware"
|
||||||
|
|
||||||
SERVICES = (
|
SERVICES = (
|
||||||
SERVICE_NAME_DISABLE_AP,
|
|
||||||
SERVICE_NAME_ENABLE_AP,
|
|
||||||
SERVICE_NAME_PAIR_SENSOR,
|
SERVICE_NAME_PAIR_SENSOR,
|
||||||
SERVICE_NAME_UNPAIR_SENSOR,
|
SERVICE_NAME_UNPAIR_SENSOR,
|
||||||
SERVICE_NAME_UPGRADE_FIRMWARE,
|
SERVICE_NAME_UPGRADE_FIRMWARE,
|
||||||
|
@ -231,30 +227,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
|
||||||
return wrapper
|
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
|
@call_with_data
|
||||||
async def async_pair_sensor(call: ServiceCall, data: GuardianData) -> None:
|
async def async_pair_sensor(call: ServiceCall, data: GuardianData) -> None:
|
||||||
"""Add a new paired sensor."""
|
"""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 (
|
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_NAME_PAIR_SENSOR,
|
||||||
SERVICE_PAIR_UNPAIR_SENSOR_SCHEMA,
|
SERVICE_PAIR_UNPAIR_SENSOR_SCHEMA,
|
||||||
|
|
|
@ -23,7 +23,6 @@ from . import (
|
||||||
)
|
)
|
||||||
from .const import (
|
from .const import (
|
||||||
API_SYSTEM_ONBOARD_SENSOR_STATUS,
|
API_SYSTEM_ONBOARD_SENSOR_STATUS,
|
||||||
API_WIFI_STATUS,
|
|
||||||
CONF_UID,
|
CONF_UID,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SIGNAL_PAIRED_SENSOR_COORDINATOR_ADDED,
|
SIGNAL_PAIRED_SENSOR_COORDINATOR_ADDED,
|
||||||
|
@ -36,7 +35,6 @@ from .util import (
|
||||||
|
|
||||||
ATTR_CONNECTED_CLIENTS = "connected_clients"
|
ATTR_CONNECTED_CLIENTS = "connected_clients"
|
||||||
|
|
||||||
SENSOR_KIND_AP_INFO = "ap_enabled"
|
|
||||||
SENSOR_KIND_LEAK_DETECTED = "leak_detected"
|
SENSOR_KIND_LEAK_DETECTED = "leak_detected"
|
||||||
SENSOR_KIND_MOVED = "moved"
|
SENSOR_KIND_MOVED = "moved"
|
||||||
|
|
||||||
|
@ -69,13 +67,6 @@ VALVE_CONTROLLER_DESCRIPTIONS = (
|
||||||
device_class=BinarySensorDeviceClass.MOISTURE,
|
device_class=BinarySensorDeviceClass.MOISTURE,
|
||||||
api_category=API_SYSTEM_ONBOARD_SENSOR_STATUS,
|
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"{uid}_ap_enabled",
|
||||||
f"switch.guardian_valve_controller_{uid}_onboard_ap",
|
f"switch.guardian_valve_controller_{uid}_onboard_ap",
|
||||||
"2022.12.0",
|
"2022.12.0",
|
||||||
remove_old_entity=False,
|
remove_old_entity=True,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -183,10 +174,5 @@ class ValveControllerBinarySensor(ValveControllerEntity, BinarySensorEntity):
|
||||||
@callback
|
@callback
|
||||||
def _async_update_from_latest_data(self) -> None:
|
def _async_update_from_latest_data(self) -> None:
|
||||||
"""Update the entity."""
|
"""Update the entity."""
|
||||||
if self.entity_description.key == SENSOR_KIND_AP_INFO:
|
if self.entity_description.key == SENSOR_KIND_LEAK_DETECTED:
|
||||||
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:
|
|
||||||
self._attr_is_on = self.coordinator.data["wet"]
|
self._attr_is_on = self.coordinator.data["wet"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue