mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Bump python-robroock to 4.17.1 (#163765)
Co-authored-by: Ludovic BOUÉ <lboue@users.noreply.github.com>
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
from typing import Any
|
||||
|
||||
from roborock.data import Status
|
||||
from roborock.devices.traits.v1.command import CommandTrait
|
||||
from roborock.devices.traits.v1.status import StatusTrait
|
||||
from roborock.exceptions import RoborockException
|
||||
from roborock.roborock_typing import RoborockCommand
|
||||
|
||||
@@ -94,7 +94,7 @@ class RoborockCoordinatedEntityV1(
|
||||
self._attr_unique_id = unique_id
|
||||
|
||||
@property
|
||||
def _device_status(self) -> Status:
|
||||
def _device_status(self) -> StatusTrait:
|
||||
"""Return the status of the device."""
|
||||
data = self.coordinator.data
|
||||
return data.status
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"loggers": ["roborock"],
|
||||
"quality_scale": "silver",
|
||||
"requirements": [
|
||||
"python-roborock==4.15.0",
|
||||
"python-roborock==4.17.1",
|
||||
"vacuum-map-parser-roborock==0.1.4"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ from roborock.data import (
|
||||
HomeDataDevice,
|
||||
HomeDataProduct,
|
||||
NetworkInfo,
|
||||
Status,
|
||||
)
|
||||
from roborock.devices.traits.v1.status import StatusTrait
|
||||
from vacuum_map_parser_base.map_data import MapData
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -23,7 +23,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class DeviceState:
|
||||
"""Data about the current state of a device."""
|
||||
|
||||
status: Status
|
||||
status: StatusTrait
|
||||
dnd_timer: DnDTimer
|
||||
consumable: Consumable
|
||||
clean_summary: CleanSummaryWithDetail
|
||||
|
||||
@@ -92,25 +92,31 @@ SELECT_DESCRIPTIONS: list[RoborockSelectDescription] = [
|
||||
key="water_box_mode",
|
||||
translation_key="mop_intensity",
|
||||
api_command=RoborockCommand.SET_WATER_BOX_CUSTOM_MODE,
|
||||
value_fn=lambda api: api.status.water_box_mode_name,
|
||||
value_fn=lambda api: api.status.water_mode_name,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
options_lambda=lambda api: (
|
||||
api.status.water_box_mode.keys()
|
||||
if api.status.water_box_mode is not None
|
||||
[mode.value for mode in api.status.water_mode_options]
|
||||
if api.status.water_mode_options
|
||||
else None
|
||||
),
|
||||
parameter_lambda=lambda key, api: [api.status.get_mop_intensity_code(key)],
|
||||
parameter_lambda=lambda key, api: [
|
||||
{v: k for k, v in api.status.water_mode_mapping.items()}[key]
|
||||
],
|
||||
),
|
||||
RoborockSelectDescription(
|
||||
key="mop_mode",
|
||||
translation_key="mop_mode",
|
||||
api_command=RoborockCommand.SET_MOP_MODE,
|
||||
value_fn=lambda api: api.status.mop_mode_name,
|
||||
value_fn=lambda api: api.status.mop_route_name,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
options_lambda=lambda api: (
|
||||
api.status.mop_mode.keys() if api.status.mop_mode is not None else None
|
||||
[mode.value for mode in api.status.mop_route_options]
|
||||
if api.status.mop_route_options
|
||||
else None
|
||||
),
|
||||
parameter_lambda=lambda key, api: [api.status.get_mop_mode_code(key)],
|
||||
parameter_lambda=lambda key, api: [
|
||||
{v: k for k, v in api.status.mop_route_mapping.items()}[key]
|
||||
],
|
||||
),
|
||||
RoborockSelectDescription(
|
||||
key="dust_collection_mode",
|
||||
|
||||
@@ -118,9 +118,12 @@
|
||||
"max": "Max",
|
||||
"medium": "[%key:common::state::medium%]",
|
||||
"mild": "Mild",
|
||||
"min": "Min",
|
||||
"moderate": "Moderate",
|
||||
"off": "[%key:common::state::off%]",
|
||||
"slight": "Slight",
|
||||
"smart_mode": "[%key:component::roborock::entity::select::mop_mode::state::smart_mode%]",
|
||||
"standard": "[%key:component::roborock::entity::select::mop_mode::state::standard%]",
|
||||
"vac_followed_by_mop": "Vacuum followed by mop"
|
||||
}
|
||||
},
|
||||
@@ -448,6 +451,7 @@
|
||||
"max_plus": "Max plus",
|
||||
"medium": "[%key:common::state::medium%]",
|
||||
"off": "[%key:common::state::off%]",
|
||||
"off_raise_main_brush": "Off (raised brush)",
|
||||
"quiet": "Quiet",
|
||||
"silent": "Silent",
|
||||
"smart_mode": "[%key:component::roborock::entity::select::mop_mode::state::smart_mode%]",
|
||||
|
||||
@@ -124,7 +124,7 @@ class RoborockVacuum(RoborockCoordinatedEntityV1, StateVacuumEntity):
|
||||
@property
|
||||
def fan_speed_list(self) -> list[str]:
|
||||
"""Get the list of available fan speeds."""
|
||||
return self._device_status.fan_power_options
|
||||
return [mode.value for mode in self._device_status.fan_speed_options]
|
||||
|
||||
@property
|
||||
def activity(self) -> VacuumActivity | None:
|
||||
@@ -135,7 +135,7 @@ class RoborockVacuum(RoborockCoordinatedEntityV1, StateVacuumEntity):
|
||||
@property
|
||||
def fan_speed(self) -> str | None:
|
||||
"""Return the fan speed of the vacuum cleaner."""
|
||||
return self._device_status.fan_power_name
|
||||
return self._device_status.fan_speed_name
|
||||
|
||||
async def async_start(self) -> None:
|
||||
"""Start the vacuum."""
|
||||
@@ -174,7 +174,11 @@ class RoborockVacuum(RoborockCoordinatedEntityV1, StateVacuumEntity):
|
||||
"""Set vacuum fan speed."""
|
||||
await self.send(
|
||||
RoborockCommand.SET_CUSTOM_MODE,
|
||||
[self._device_status.get_fan_speed_code(fan_speed)],
|
||||
[
|
||||
{v: k for k, v in self._device_status.fan_speed_mapping.items()}[
|
||||
fan_speed
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
async def async_set_vacuum_goto_position(self, x: int, y: int) -> None:
|
||||
|
||||
Generated
+1
-1
@@ -2627,7 +2627,7 @@ python-rabbitair==0.0.8
|
||||
python-ripple-api==0.0.3
|
||||
|
||||
# homeassistant.components.roborock
|
||||
python-roborock==4.15.0
|
||||
python-roborock==4.17.1
|
||||
|
||||
# homeassistant.components.smarttub
|
||||
python-smarttub==0.0.47
|
||||
|
||||
Generated
+1
-1
@@ -2220,7 +2220,7 @@ python-pooldose==0.8.2
|
||||
python-rabbitair==0.0.8
|
||||
|
||||
# homeassistant.components.roborock
|
||||
python-roborock==4.15.0
|
||||
python-roborock==4.17.1
|
||||
|
||||
# homeassistant.components.smarttub
|
||||
python-smarttub==0.0.47
|
||||
|
||||
@@ -10,7 +10,14 @@ from typing import Any
|
||||
from unittest.mock import AsyncMock, Mock, PropertyMock, patch
|
||||
|
||||
import pytest
|
||||
from roborock import HomeDataRoom, MultiMapsListMapInfo, RoborockCategory
|
||||
from roborock import (
|
||||
CleanRoutes,
|
||||
HomeDataRoom,
|
||||
MultiMapsListMapInfo,
|
||||
RoborockCategory,
|
||||
VacuumModes,
|
||||
WaterModes,
|
||||
)
|
||||
from roborock.data import (
|
||||
CombinedMapInfo,
|
||||
DnDTimer,
|
||||
@@ -307,6 +314,20 @@ def create_v1_properties(network_info: NetworkInfo) -> AsyncMock:
|
||||
trait_spec=StatusTrait,
|
||||
dataclass_template=STATUS,
|
||||
)
|
||||
_fan_speed_mapping = {m.code: m.value for m in VacuumModes}
|
||||
_water_mode_mapping = {m.code: m.value for m in WaterModes}
|
||||
_mop_route_mapping = {m.code: m.value for m in CleanRoutes}
|
||||
v1_properties.status.fan_speed_options = list(VacuumModes)
|
||||
v1_properties.status.fan_speed_mapping = _fan_speed_mapping
|
||||
v1_properties.status.fan_speed_name = _fan_speed_mapping.get(STATUS.fan_power)
|
||||
v1_properties.status.water_mode_options = list(WaterModes)
|
||||
v1_properties.status.water_mode_mapping = _water_mode_mapping
|
||||
v1_properties.status.water_mode_name = _water_mode_mapping.get(
|
||||
STATUS.water_box_mode
|
||||
)
|
||||
v1_properties.status.mop_route_options = list(CleanRoutes)
|
||||
v1_properties.status.mop_route_mapping = _mop_route_mapping
|
||||
v1_properties.status.mop_route_name = _mop_route_mapping.get(STATUS.mop_mode)
|
||||
v1_properties.dnd = make_dnd_timer(dataclass_template=DND_TIMER)
|
||||
v1_properties.clean_summary = make_mock_trait(
|
||||
trait_spec=CleanSummaryTrait,
|
||||
|
||||
Reference in New Issue
Block a user