mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
parent
9ef4b2e5f5
commit
ab3b0c9075
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from roborock.containers import RoborockStateCode
|
from roborock.containers import RoborockErrorCode, RoborockStateCode
|
||||||
from roborock.roborock_typing import DeviceProp
|
from roborock.roborock_typing import DeviceProp
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
@ -113,6 +113,15 @@ SENSOR_DESCRIPTIONS = [
|
|||||||
value_fn=lambda data: data.clean_summary.square_meter_clean_area,
|
value_fn=lambda data: data.clean_summary.square_meter_clean_area,
|
||||||
native_unit_of_measurement=AREA_SQUARE_METERS,
|
native_unit_of_measurement=AREA_SQUARE_METERS,
|
||||||
),
|
),
|
||||||
|
RoborockSensorDescription(
|
||||||
|
key="vacuum_error",
|
||||||
|
icon="mdi:alert-circle",
|
||||||
|
translation_key="vacuum_error",
|
||||||
|
device_class=SensorDeviceClass.ENUM,
|
||||||
|
value_fn=lambda data: data.status.error_code.name,
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
options=RoborockErrorCode.keys(),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,6 +79,38 @@
|
|||||||
},
|
},
|
||||||
"total_cleaning_area": {
|
"total_cleaning_area": {
|
||||||
"name": "Total cleaning area"
|
"name": "Total cleaning area"
|
||||||
|
},
|
||||||
|
"vacuum_error": {
|
||||||
|
"name": "Vacuum error",
|
||||||
|
"state": {
|
||||||
|
"none": "None",
|
||||||
|
"lidar_blocked": "Lidar blocked",
|
||||||
|
"bumper_stuck": "Bumper stuck",
|
||||||
|
"wheels_suspended": "Wheels suspended",
|
||||||
|
"cliff_sensor_error": "Cliff sensor error",
|
||||||
|
"main_brush_jammed": "Main brush jammed",
|
||||||
|
"side_brush_jammed": "Side brush jammed",
|
||||||
|
"wheels_jammed": "Wheels jammed",
|
||||||
|
"robot_trapped": "Robot trapped",
|
||||||
|
"no_dustbin": "No dustbin",
|
||||||
|
"low_battery": "Low battery",
|
||||||
|
"charging_error": "Charging error",
|
||||||
|
"battery_error": "Battery error",
|
||||||
|
"wall_sensor_dirty": "Wall sensor dirty",
|
||||||
|
"robot_tilted": "Robot tilted",
|
||||||
|
"side_brush_error": "Side brush error",
|
||||||
|
"fan_error": "Fan error",
|
||||||
|
"vertical_bumper_pressed": "Vertical bumper pressed",
|
||||||
|
"dock_locator_error": "Dock locator error",
|
||||||
|
"return_to_dock_fail": "Return to dock fail",
|
||||||
|
"nogo_zone_detected": "No-go zone detected",
|
||||||
|
"vibrarise_jammed": "VibraRise jammed",
|
||||||
|
"robot_on_carpet": "Robot on carpet",
|
||||||
|
"filter_blocked": "Filter blocked",
|
||||||
|
"invisible_wall_detected": "Invisible wall detected",
|
||||||
|
"cannot_cross_carpet": "Cannot cross carpet",
|
||||||
|
"internal_error": "Internal error"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"select": {
|
"select": {
|
||||||
|
@ -14,7 +14,7 @@ from tests.common import MockConfigEntry
|
|||||||
|
|
||||||
async def test_sensors(hass: HomeAssistant, setup_entry: MockConfigEntry) -> None:
|
async def test_sensors(hass: HomeAssistant, setup_entry: MockConfigEntry) -> None:
|
||||||
"""Test sensors and check test values are correctly set."""
|
"""Test sensors and check test values are correctly set."""
|
||||||
assert len(hass.states.async_all("sensor")) == 9
|
assert len(hass.states.async_all("sensor")) == 10
|
||||||
assert hass.states.get("sensor.roborock_s7_maxv_main_brush_time_left").state == str(
|
assert hass.states.get("sensor.roborock_s7_maxv_main_brush_time_left").state == str(
|
||||||
MAIN_BRUSH_REPLACE_TIME - 74382
|
MAIN_BRUSH_REPLACE_TIME - 74382
|
||||||
)
|
)
|
||||||
@ -36,3 +36,4 @@ async def test_sensors(hass: HomeAssistant, setup_entry: MockConfigEntry) -> Non
|
|||||||
hass.states.get("sensor.roborock_s7_maxv_total_cleaning_area").state == "1159.2"
|
hass.states.get("sensor.roborock_s7_maxv_total_cleaning_area").state == "1159.2"
|
||||||
)
|
)
|
||||||
assert hass.states.get("sensor.roborock_s7_maxv_cleaning_area").state == "21.0"
|
assert hass.states.get("sensor.roborock_s7_maxv_cleaning_area").state == "21.0"
|
||||||
|
assert hass.states.get("sensor.roborock_s7_maxv_vacuum_error").state == "none"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user