Remove deprecated reset_waste_drawer and set_wait_time services from litterrobot (#77052)

This commit is contained in:
Nathan Spencer 2022-08-25 12:31:04 -06:00 committed by GitHub
parent 7fbb9c189f
commit 8c24d5810c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 101 deletions

View file

@ -5,7 +5,6 @@ import logging
from typing import Any
from pylitterbot.enums import LitterBoxStatus
from pylitterbot.robot.litterrobot import VALID_WAIT_TIMES
import voluptuous as vol
from homeassistant.components.vacuum import (
@ -30,9 +29,7 @@ _LOGGER = logging.getLogger(__name__)
TYPE_LITTER_BOX = "Litter Box"
SERVICE_RESET_WASTE_DRAWER = "reset_waste_drawer"
SERVICE_SET_SLEEP_MODE = "set_sleep_mode"
SERVICE_SET_WAIT_TIME = "set_wait_time"
LITTER_BOX_STATUS_STATE_MAP = {
LitterBoxStatus.CLEAN_CYCLE: STATE_CLEANING,
@ -61,11 +58,6 @@ async def async_setup_entry(
)
platform = entity_platform.async_get_current_platform()
platform.async_register_entity_service(
SERVICE_RESET_WASTE_DRAWER,
{},
"async_reset_waste_drawer",
)
platform.async_register_entity_service(
SERVICE_SET_SLEEP_MODE,
{
@ -74,11 +66,6 @@ async def async_setup_entry(
},
"async_set_sleep_mode",
)
platform.async_register_entity_service(
SERVICE_SET_WAIT_TIME,
{vol.Required("minutes"): vol.All(vol.Coerce(int), vol.In(VALID_WAIT_TIMES))},
"async_set_wait_time",
)
class LitterRobotCleaner(LitterRobotControlEntity, StateVacuumEntity):
@ -116,18 +103,6 @@ class LitterRobotCleaner(LitterRobotControlEntity, StateVacuumEntity):
"""Start a clean cycle."""
await self.perform_action_and_refresh(self.robot.start_cleaning)
async def async_reset_waste_drawer(self) -> None:
"""Reset the waste drawer level."""
# The Litter-Robot reset waste drawer service has been replaced by a
# dedicated button entity and marked as deprecated
_LOGGER.warning(
"The 'litterrobot.reset_waste_drawer' service is deprecated and "
"replaced by a dedicated reset waste drawer button entity; Please "
"use that entity to reset the waste drawer instead"
)
await self.robot.reset_waste_drawer()
self.coordinator.async_set_updated_data(True)
async def async_set_sleep_mode(
self, enabled: bool, start_time: str | None = None
) -> None:
@ -138,17 +113,6 @@ class LitterRobotCleaner(LitterRobotControlEntity, StateVacuumEntity):
self.parse_time_at_default_timezone(start_time),
)
async def async_set_wait_time(self, minutes: int) -> None:
"""Set the wait time."""
# The Litter-Robot set wait time service has been replaced by a
# dedicated select entity and marked as deprecated
_LOGGER.warning(
"The 'litterrobot.set_wait_time' service is deprecated and "
"replaced by a dedicated set wait time select entity; Please "
"use that entity to set the wait time instead"
)
await self.perform_action_and_refresh(self.robot.set_wait_time, minutes)
@property
def extra_state_attributes(self) -> dict[str, Any]:
"""Return device specific state attributes."""