Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/airly/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class AirlySensorEntityDescription(SensorEntityDescription):
),
AirlySensorEntityDescription(
key=ATTR_API_CO,
translation_key="co",
device_class=SensorDeviceClass.CO,
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
Expand Down
3 changes: 0 additions & 3 deletions homeassistant/components/airly/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
"sensor": {
"caqi": {
"name": "Common air quality index"
},
"co": {
"name": "[%key:component::sensor::entity_component::carbon_monoxide::name%]"
}
}
},
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/pyload/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ async def _async_update_data(self) -> PyLoadData:
raise ConfigEntryAuthFailed(
translation_domain=DOMAIN,
translation_key="setup_authentication_exception",
translation_placeholders={CONF_USERNAME: self.pyload.username},
translation_placeholders={
CONF_USERNAME: self.config_entry.data[CONF_USERNAME]
},
) from e
except CannotConnect as e:
raise UpdateFailed(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/pyload/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_polling",
"loggers": ["pyloadapi"],
"quality_scale": "platinum",
"requirements": ["PyLoadAPI==2.0.0"]
"requirements": ["PyLoadAPI==2.1.0"]
}
37 changes: 35 additions & 2 deletions homeassistant/components/roborock/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from __future__ import annotations

import asyncio
from collections.abc import Callable
from dataclasses import dataclass
import itertools
import logging
from typing import Any

from roborock.device_features import is_wash_n_fill_dock
from roborock.devices.traits.v1.consumeable import ConsumableAttribute
from roborock.exceptions import RoborockException
from roborock.roborock_message import RoborockZeoProtocol
Expand Down Expand Up @@ -43,6 +45,13 @@ class RoborockButtonDescription(ButtonEntityDescription):
"""Describes a Roborock button entity."""

attribute: ConsumableAttribute
is_dock_entity: bool = False
is_supported: Callable[[RoborockDataUpdateCoordinator], bool] = lambda _: True


def _supports_dock_consumables(coordinator: RoborockDataUpdateCoordinator) -> bool:
dock_type = coordinator.properties_api.status.dock_type
return dock_type is not None and is_wash_n_fill_dock(dock_type)


CONSUMABLE_BUTTON_DESCRIPTIONS = [
Expand Down Expand Up @@ -74,6 +83,24 @@ class RoborockButtonDescription(ButtonEntityDescription):
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
),
RoborockButtonDescription(
key="reset_dock_strainer_consumable",
translation_key="reset_dock_strainer_consumable",
attribute=ConsumableAttribute.STRAINER_WORK_TIME,
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
is_dock_entity=True,
is_supported=_supports_dock_consumables,
),
RoborockButtonDescription(
key="reset_dock_cleaning_brush_consumable",
translation_key="reset_dock_cleaning_brush_consumable",
attribute=ConsumableAttribute.CLEANING_BRUSH_WORK_TIME,
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
is_dock_entity=True,
is_supported=_supports_dock_consumables,
),
]


Expand Down Expand Up @@ -128,8 +155,9 @@ async def async_setup_entry(
description,
)
for coordinator in config_entry.runtime_data.v1
for description in CONSUMABLE_BUTTON_DESCRIPTIONS
if isinstance(coordinator, RoborockDataUpdateCoordinator)
for description in CONSUMABLE_BUTTON_DESCRIPTIONS
if description.is_supported(coordinator)
),
(
RoborockRoutineButtonEntity(
Expand Down Expand Up @@ -176,9 +204,14 @@ def __init__(
entity_description: RoborockButtonDescription,
) -> None:
"""Create a button entity."""
device_info = (
coordinator.dock_device_info
if entity_description.is_dock_entity
else coordinator.device_info
)
super().__init__(
f"{entity_description.key}_{coordinator.duid_slug}",
coordinator.device_info,
device_info,
api=coordinator.properties_api.command,
)
self.entity_description = entity_description
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/roborock/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ def __init__(
RoborockB01Props.WIND,
RoborockB01Props.WATER,
RoborockB01Props.MODE,
RoborockB01Props.CLEAN_PATH_PREFERENCE,
RoborockB01Props.QUANTITY,
]

Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/roborock/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
"reset_air_filter_consumable": {
"default": "mdi:air-filter"
},
"reset_dock_cleaning_brush_consumable": {
"default": "mdi:brush"
},
"reset_dock_strainer_consumable": {
"default": "mdi:filter"
},
"reset_main_brush_consumable": {
"default": "mdi:brush"
},
Expand Down
11 changes: 11 additions & 0 deletions homeassistant/components/roborock/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from roborock import B01Props, CleanTypeMapping
from roborock.data import (
CleanPathPreferenceMapping,
RoborockDockDustCollectionModeCode,
RoborockEnum,
WaterLevelMapping,
Expand Down Expand Up @@ -118,6 +119,16 @@ class RoborockSelectDescriptionA01(SelectEntityDescription):
options_lambda=lambda _: list(CleanTypeMapping.keys()),
entity_category=EntityCategory.CONFIG,
),
RoborockB01SelectDescription(
key="cleaning_route",
translation_key="cleaning_route",
api_fn=lambda api, value: api.set_clean_path_preference(
CleanPathPreferenceMapping.from_value(value)
),
value_fn=lambda data: data.clean_path_preference_name,
options_lambda=lambda _: list(CleanPathPreferenceMapping.keys()),
entity_category=EntityCategory.CONFIG,
),
]


Expand Down
13 changes: 13 additions & 0 deletions homeassistant/components/roborock/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
"reset_air_filter_consumable": {
"name": "Reset air filter consumable"
},
"reset_dock_cleaning_brush_consumable": {
"name": "Reset cleaning brush consumable"
},
"reset_dock_strainer_consumable": {
"name": "Reset strainer consumable"
},
"reset_main_brush_consumable": {
"name": "Reset main brush consumable"
},
Expand Down Expand Up @@ -123,6 +129,13 @@
"vacuum": "Vacuum only"
}
},
"cleaning_route": {
"name": "Cleaning route",
"state": {
"balanced": "[%key:component::roborock::entity::vacuum::roborock::state_attributes::fan_speed::state::balanced%]",
"deep": "[%key:component::roborock::entity::select::mop_mode::state::deep%]"
}
},
"detergent_type": {
"name": "Detergent type",
"state": {
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions tests/components/airly/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
'suggested_display_precision': 0,
}),
}),
'original_device_class': None,
'original_device_class': <SensorDeviceClass.CO: 'carbon_monoxide'>,
'original_icon': None,
'original_name': 'Carbon monoxide',
'platform': 'airly',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'co',
'translation_key': None,
'unique_id': '123-456-co',
'unit_of_measurement': 'μg/m³',
})
Expand All @@ -45,6 +45,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by Airly',
'device_class': 'carbon_monoxide',
'friendly_name': 'Home Carbon monoxide',
'limit': 4000,
'percent': 4,
Expand Down
1 change: 1 addition & 0 deletions tests/components/roborock/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ async def return_to_dock_side_effect():
b01_trait.find_me = AsyncMock()
b01_trait.set_fan_speed = AsyncMock()
b01_trait.set_mode = AsyncMock()
b01_trait.set_clean_path_preference = AsyncMock()
b01_trait.set_water_level = AsyncMock()
b01_trait.send = AsyncMock()
return b01_trait
Expand Down
2 changes: 2 additions & 0 deletions tests/components/roborock/mock_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from PIL import Image
from roborock.data import (
B01Props,
CleanPathPreferenceMapping,
CleanRecord,
CleanSummary,
Consumable,
Expand Down Expand Up @@ -1558,6 +1559,7 @@

Q7_B01_PROPS = B01Props(
status=WorkStatusMapping.SWEEP_MOPING,
clean_path_preference=CleanPathPreferenceMapping.BALANCED,
main_brush=5000,
side_brush=3000,
hypa=1500,
Expand Down
Loading
Loading