mirror of
https://github.com/home-assistant/core.git
synced 2025-04-28 11:17:53 +00:00
Remove deprecated services from Litterrobot (#107882)
This commit is contained in:
parent
f808c2ff14
commit
7c848d78ab
@ -25,30 +25,6 @@
|
|||||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"issues": {
|
|
||||||
"service_deprecation_turn_off": {
|
|
||||||
"title": "Litter-Robot vaccum support for {old_service} is being removed",
|
|
||||||
"fix_flow": {
|
|
||||||
"step": {
|
|
||||||
"confirm": {
|
|
||||||
"title": "[%key:component::litterrobot::issues::service_deprecation_turn_off::title%]",
|
|
||||||
"description": "Litter-Robot vaccum support for the {old_service} service is deprecated and will be removed in Home Assistant 2024.2; Please adjust any automation or script that uses the service to instead call {new_service} and select submit below to mark this issue as resolved."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"service_deprecation_turn_on": {
|
|
||||||
"title": "[%key:component::litterrobot::issues::service_deprecation_turn_off::title%]",
|
|
||||||
"fix_flow": {
|
|
||||||
"step": {
|
|
||||||
"confirm": {
|
|
||||||
"title": "[%key:component::litterrobot::issues::service_deprecation_turn_off::title%]",
|
|
||||||
"description": "[%key:component::litterrobot::issues::service_deprecation_turn_off::fix_flow::step::confirm::description%]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"entity": {
|
"entity": {
|
||||||
"binary_sensor": {
|
"binary_sensor": {
|
||||||
"sleeping": {
|
"sleeping": {
|
||||||
|
@ -20,11 +20,7 @@ from homeassistant.components.vacuum import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_OFF
|
from homeassistant.const import STATE_OFF
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
config_validation as cv,
|
|
||||||
entity_platform,
|
|
||||||
issue_registry as ir,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
@ -79,11 +75,7 @@ class LitterRobotCleaner(LitterRobotEntity[LitterRobot], StateVacuumEntity):
|
|||||||
"""Litter-Robot "Vacuum" Cleaner."""
|
"""Litter-Robot "Vacuum" Cleaner."""
|
||||||
|
|
||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
VacuumEntityFeature.START
|
VacuumEntityFeature.START | VacuumEntityFeature.STATE | VacuumEntityFeature.STOP
|
||||||
| VacuumEntityFeature.STATE
|
|
||||||
| VacuumEntityFeature.STOP
|
|
||||||
| VacuumEntityFeature.TURN_OFF
|
|
||||||
| VacuumEntityFeature.TURN_ON
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -98,42 +90,6 @@ class LitterRobotCleaner(LitterRobotEntity[LitterRobot], StateVacuumEntity):
|
|||||||
f"{self.robot.status.text}{' (Sleeping)' if self.robot.is_sleeping else ''}"
|
f"{self.robot.status.text}{' (Sleeping)' if self.robot.is_sleeping else ''}"
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
|
||||||
"""Turn the cleaner on, starting a clean cycle."""
|
|
||||||
await self.robot.set_power_status(True)
|
|
||||||
ir.async_create_issue(
|
|
||||||
self.hass,
|
|
||||||
DOMAIN,
|
|
||||||
"service_deprecation_turn_on",
|
|
||||||
breaks_in_ha_version="2024.2.0",
|
|
||||||
is_fixable=True,
|
|
||||||
is_persistent=True,
|
|
||||||
severity=ir.IssueSeverity.WARNING,
|
|
||||||
translation_key="service_deprecation_turn_on",
|
|
||||||
translation_placeholders={
|
|
||||||
"old_service": "vacuum.turn_on",
|
|
||||||
"new_service": "vacuum.start",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
|
||||||
"""Turn the unit off, stopping any cleaning in progress as is."""
|
|
||||||
await self.robot.set_power_status(False)
|
|
||||||
ir.async_create_issue(
|
|
||||||
self.hass,
|
|
||||||
DOMAIN,
|
|
||||||
"service_deprecation_turn_off",
|
|
||||||
breaks_in_ha_version="2024.2.0",
|
|
||||||
is_fixable=True,
|
|
||||||
is_persistent=True,
|
|
||||||
severity=ir.IssueSeverity.WARNING,
|
|
||||||
translation_key="service_deprecation_turn_off",
|
|
||||||
translation_placeholders={
|
|
||||||
"old_service": "vacuum.turn_off",
|
|
||||||
"new_service": "vacuum.stop",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_start(self) -> None:
|
async def async_start(self) -> None:
|
||||||
"""Start a clean cycle."""
|
"""Start a clean cycle."""
|
||||||
await self.robot.set_power_status(True)
|
await self.robot.set_power_status(True)
|
||||||
|
@ -13,8 +13,6 @@ from homeassistant.components.vacuum import (
|
|||||||
DOMAIN as PLATFORM_DOMAIN,
|
DOMAIN as PLATFORM_DOMAIN,
|
||||||
SERVICE_START,
|
SERVICE_START,
|
||||||
SERVICE_STOP,
|
SERVICE_STOP,
|
||||||
SERVICE_TURN_OFF,
|
|
||||||
SERVICE_TURN_ON,
|
|
||||||
STATE_DOCKED,
|
STATE_DOCKED,
|
||||||
STATE_ERROR,
|
STATE_ERROR,
|
||||||
)
|
)
|
||||||
@ -102,16 +100,6 @@ async def test_vacuum_with_error(
|
|||||||
[
|
[
|
||||||
(SERVICE_START, "start_cleaning", None),
|
(SERVICE_START, "start_cleaning", None),
|
||||||
(SERVICE_STOP, "set_power_status", None),
|
(SERVICE_STOP, "set_power_status", None),
|
||||||
(
|
|
||||||
SERVICE_TURN_OFF,
|
|
||||||
"set_power_status",
|
|
||||||
{"issues": {(DOMAIN, "service_deprecation_turn_off")}},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SERVICE_TURN_ON,
|
|
||||||
"set_power_status",
|
|
||||||
{"issues": {(DOMAIN, "service_deprecation_turn_on")}},
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
SERVICE_SET_SLEEP_MODE,
|
SERVICE_SET_SLEEP_MODE,
|
||||||
"set_sleep_mode",
|
"set_sleep_mode",
|
||||||
@ -150,53 +138,3 @@ async def test_commands(
|
|||||||
|
|
||||||
issue_registry = ir.async_get(hass)
|
issue_registry = ir.async_get(hass)
|
||||||
assert set(issue_registry.issues.keys()) == issues
|
assert set(issue_registry.issues.keys()) == issues
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
("service", "issue_id", "placeholders"),
|
|
||||||
[
|
|
||||||
(
|
|
||||||
SERVICE_TURN_OFF,
|
|
||||||
"service_deprecation_turn_off",
|
|
||||||
{
|
|
||||||
"old_service": "vacuum.turn_off",
|
|
||||||
"new_service": "vacuum.stop",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SERVICE_TURN_ON,
|
|
||||||
"service_deprecation_turn_on",
|
|
||||||
{
|
|
||||||
"old_service": "vacuum.turn_on",
|
|
||||||
"new_service": "vacuum.start",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
async def test_issues(
|
|
||||||
hass: HomeAssistant,
|
|
||||||
mock_account: MagicMock,
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
service: str,
|
|
||||||
issue_id: str,
|
|
||||||
placeholders: dict[str, str],
|
|
||||||
) -> None:
|
|
||||||
"""Test issues raised by calling deprecated services."""
|
|
||||||
await setup_integration(hass, mock_account, PLATFORM_DOMAIN)
|
|
||||||
|
|
||||||
vacuum = hass.states.get(VACUUM_ENTITY_ID)
|
|
||||||
assert vacuum
|
|
||||||
assert vacuum.state == STATE_DOCKED
|
|
||||||
|
|
||||||
await hass.services.async_call(
|
|
||||||
PLATFORM_DOMAIN,
|
|
||||||
service,
|
|
||||||
{ATTR_ENTITY_ID: VACUUM_ENTITY_ID},
|
|
||||||
blocking=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
issue_registry = ir.async_get(hass)
|
|
||||||
issue = issue_registry.async_get_issue(DOMAIN, issue_id)
|
|
||||||
assert issue.is_fixable is True
|
|
||||||
assert issue.is_persistent is True
|
|
||||||
assert issue.translation_placeholders == placeholders
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user