Adjust services and properties supported by roborock vacuum (#95789)
* Update supported features * Raise issue when vacuum.start_pause is calledpull/95242/head
parent
85e8eee94e
commit
39dcb5a2b5
|
@ -139,5 +139,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"service_deprecation_start_pause": {
|
||||
"title": "Roborock vaccum support for vacuum.start_pause is being removed",
|
||||
"description": "Roborock vaccum support for the vacuum.start_pause 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 vacuum.pause or vacuum.start and select submit below to mark this issue as resolved."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ from homeassistant.components.vacuum import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util import slugify
|
||||
|
||||
|
@ -75,7 +76,6 @@ class RoborockVacuum(RoborockCoordinatedEntity, StateVacuumEntity):
|
|||
| VacuumEntityFeature.RETURN_HOME
|
||||
| VacuumEntityFeature.FAN_SPEED
|
||||
| VacuumEntityFeature.BATTERY
|
||||
| VacuumEntityFeature.STATUS
|
||||
| VacuumEntityFeature.SEND_COMMAND
|
||||
| VacuumEntityFeature.LOCATE
|
||||
| VacuumEntityFeature.CLEAN_SPOT
|
||||
|
@ -110,11 +110,6 @@ class RoborockVacuum(RoborockCoordinatedEntity, StateVacuumEntity):
|
|||
"""Return the fan speed of the vacuum cleaner."""
|
||||
return self._device_status.fan_power.name
|
||||
|
||||
@property
|
||||
def status(self) -> str | None:
|
||||
"""Return the status of the vacuum cleaner."""
|
||||
return self._device_status.state.name
|
||||
|
||||
async def async_start(self) -> None:
|
||||
"""Start the vacuum."""
|
||||
await self.send(RoborockCommand.APP_START)
|
||||
|
@ -152,6 +147,16 @@ class RoborockVacuum(RoborockCoordinatedEntity, StateVacuumEntity):
|
|||
await self.async_pause()
|
||||
else:
|
||||
await self.async_start()
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
"service_deprecation_start_pause",
|
||||
breaks_in_ha_version="2024.2.0",
|
||||
is_fixable=True,
|
||||
is_persistent=True,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="service_deprecation_start_pause",
|
||||
)
|
||||
|
||||
async def async_send_command(
|
||||
self,
|
||||
|
|
|
@ -20,7 +20,7 @@ from homeassistant.components.vacuum import (
|
|||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers import entity_registry as er, issue_registry as ir
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -88,3 +88,37 @@ async def test_commands(
|
|||
assert mock_send_command.call_count == 1
|
||||
assert mock_send_command.call_args[0][0] == command
|
||||
assert mock_send_command.call_args[0][1] == called_params
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("service", "issue_id"),
|
||||
[
|
||||
(SERVICE_START_PAUSE, "service_deprecation_start_pause"),
|
||||
],
|
||||
)
|
||||
async def test_issues(
|
||||
hass: HomeAssistant,
|
||||
bypass_api_fixture,
|
||||
setup_entry: MockConfigEntry,
|
||||
service: str,
|
||||
issue_id: str,
|
||||
) -> None:
|
||||
"""Test issues raised by calling deprecated services."""
|
||||
vacuum = hass.states.get(ENTITY_ID)
|
||||
assert vacuum
|
||||
|
||||
data = {ATTR_ENTITY_ID: ENTITY_ID}
|
||||
with patch(
|
||||
"homeassistant.components.roborock.coordinator.RoborockLocalClient.send_command"
|
||||
):
|
||||
await hass.services.async_call(
|
||||
Platform.VACUUM,
|
||||
service,
|
||||
data,
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
issue_registry = ir.async_get(hass)
|
||||
issue = issue_registry.async_get_issue("roborock", issue_id)
|
||||
assert issue.is_fixable is True
|
||||
assert issue.is_persistent is True
|
||||
|
|
Loading…
Reference in New Issue