mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Add consumables for tplink tapo vacuums (#136510)
Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
6d91f8d86c
commit
c7176f6849
@ -72,6 +72,21 @@ BUTTON_DESCRIPTIONS: Final = [
|
|||||||
),
|
),
|
||||||
TPLinkButtonEntityDescription(key="pair"),
|
TPLinkButtonEntityDescription(key="pair"),
|
||||||
TPLinkButtonEntityDescription(key="unpair"),
|
TPLinkButtonEntityDescription(key="unpair"),
|
||||||
|
TPLinkButtonEntityDescription(
|
||||||
|
key="main_brush_reset",
|
||||||
|
),
|
||||||
|
TPLinkButtonEntityDescription(
|
||||||
|
key="side_brush_reset",
|
||||||
|
),
|
||||||
|
TPLinkButtonEntityDescription(
|
||||||
|
key="sensor_reset",
|
||||||
|
),
|
||||||
|
TPLinkButtonEntityDescription(
|
||||||
|
key="filter_reset",
|
||||||
|
),
|
||||||
|
TPLinkButtonEntityDescription(
|
||||||
|
key="charging_contacts_reset",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
BUTTON_DESCRIPTIONS_MAP = {desc.key: desc for desc in BUTTON_DESCRIPTIONS}
|
BUTTON_DESCRIPTIONS_MAP = {desc.key: desc for desc in BUTTON_DESCRIPTIONS}
|
||||||
|
@ -32,7 +32,20 @@
|
|||||||
},
|
},
|
||||||
"tilt_down": {
|
"tilt_down": {
|
||||||
"default": "mdi:chevron-down"
|
"default": "mdi:chevron-down"
|
||||||
}
|
},
|
||||||
|
"main_brush_reset": {
|
||||||
|
"default": "mdi:brush"
|
||||||
|
},
|
||||||
|
"side_brush_reset": {
|
||||||
|
"default": "mdi:brush"
|
||||||
|
},
|
||||||
|
"sensor_reset": {
|
||||||
|
"default": "mdi:eye-outline"
|
||||||
|
},
|
||||||
|
"filter_reset": {
|
||||||
|
"default": "mdi:air-filter"
|
||||||
|
},
|
||||||
|
"charging_contacts_reset": {}
|
||||||
},
|
},
|
||||||
"select": {
|
"select": {
|
||||||
"light_preset": {
|
"light_preset": {
|
||||||
@ -134,6 +147,32 @@
|
|||||||
"water_alert_timestamp": {
|
"water_alert_timestamp": {
|
||||||
"default": "mdi:clock-alert-outline"
|
"default": "mdi:clock-alert-outline"
|
||||||
},
|
},
|
||||||
|
"main_brush_remaining": {
|
||||||
|
"default": "mdi:brush"
|
||||||
|
},
|
||||||
|
"main_brush_used": {
|
||||||
|
"default": "mdi:brush"
|
||||||
|
},
|
||||||
|
"side_brush_remaining": {
|
||||||
|
"default": "mdi:brush"
|
||||||
|
},
|
||||||
|
"side_brush_used": {
|
||||||
|
"default": "mdi:brush"
|
||||||
|
},
|
||||||
|
"filter_remaining": {
|
||||||
|
"default": "mdi:air-filter"
|
||||||
|
},
|
||||||
|
"filter_used": {
|
||||||
|
"default": "mdi:air-filter"
|
||||||
|
},
|
||||||
|
"sensor_remaining": {
|
||||||
|
"default": "mdi:eye-outline"
|
||||||
|
},
|
||||||
|
"sensor_used": {
|
||||||
|
"default": "mdi:eye-outline"
|
||||||
|
},
|
||||||
|
"charging_contacts_remaining": {},
|
||||||
|
"charging_contacts_used": {},
|
||||||
"vacuum_error": {
|
"vacuum_error": {
|
||||||
"default": "mdi:alert-circle"
|
"default": "mdi:alert-circle"
|
||||||
}
|
}
|
||||||
|
@ -4,6 +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 operator import methodcaller
|
||||||
from typing import TYPE_CHECKING, Any, cast
|
from typing import TYPE_CHECKING, Any, cast
|
||||||
|
|
||||||
from kasa import Feature
|
from kasa import Feature
|
||||||
@ -16,6 +17,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
@ -37,6 +39,8 @@ class TPLinkSensorEntityDescription(
|
|||||||
# Coordinator is used to centralize the data updates
|
# Coordinator is used to centralize the data updates
|
||||||
PARALLEL_UPDATES = 0
|
PARALLEL_UPDATES = 0
|
||||||
|
|
||||||
|
_TOTAL_SECONDS_METHOD_CALLER = methodcaller("total_seconds")
|
||||||
|
|
||||||
SENSOR_DESCRIPTIONS: tuple[TPLinkSensorEntityDescription, ...] = (
|
SENSOR_DESCRIPTIONS: tuple[TPLinkSensorEntityDescription, ...] = (
|
||||||
TPLinkSensorEntityDescription(
|
TPLinkSensorEntityDescription(
|
||||||
key="current_consumption",
|
key="current_consumption",
|
||||||
@ -120,6 +124,76 @@ SENSOR_DESCRIPTIONS: tuple[TPLinkSensorEntityDescription, ...] = (
|
|||||||
TPLinkSensorEntityDescription(
|
TPLinkSensorEntityDescription(
|
||||||
key="alarm_source",
|
key="alarm_source",
|
||||||
),
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="main_brush_remaining",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="main_brush_used",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="side_brush_remaining",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="side_brush_used",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="filter_remaining",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="filter_used",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="sensor_remaining",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="sensor_used",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="charging_contacts_remaining",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
|
TPLinkSensorEntityDescription(
|
||||||
|
key="charging_contacts_used",
|
||||||
|
device_class=SensorDeviceClass.DURATION,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
suggested_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
|
convert_fn=_TOTAL_SECONDS_METHOD_CALLER,
|
||||||
|
),
|
||||||
TPLinkSensorEntityDescription(
|
TPLinkSensorEntityDescription(
|
||||||
key="vacuum_error",
|
key="vacuum_error",
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
|
@ -147,6 +147,21 @@
|
|||||||
},
|
},
|
||||||
"unpair": {
|
"unpair": {
|
||||||
"name": "Unpair device"
|
"name": "Unpair device"
|
||||||
|
},
|
||||||
|
"main_brush_reset": {
|
||||||
|
"name": "Reset main brush consumable"
|
||||||
|
},
|
||||||
|
"side_brush_reset": {
|
||||||
|
"name": "Reset side brush consumable"
|
||||||
|
},
|
||||||
|
"sensor_reset": {
|
||||||
|
"name": "Reset sensor consumable"
|
||||||
|
},
|
||||||
|
"filter_reset": {
|
||||||
|
"name": "Reset filter consumable"
|
||||||
|
},
|
||||||
|
"charging_contacts_reset": {
|
||||||
|
"name": "Reset charging contacts consumable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
@ -202,6 +217,36 @@
|
|||||||
"alarm_source": {
|
"alarm_source": {
|
||||||
"name": "Alarm source"
|
"name": "Alarm source"
|
||||||
},
|
},
|
||||||
|
"main_brush_remaining": {
|
||||||
|
"name": "Main brush remaining"
|
||||||
|
},
|
||||||
|
"main_brush_used": {
|
||||||
|
"name": "Main brush used"
|
||||||
|
},
|
||||||
|
"side_brush_remaining": {
|
||||||
|
"name": "Side brush remaining"
|
||||||
|
},
|
||||||
|
"side_brush_used": {
|
||||||
|
"name": "Side brush used"
|
||||||
|
},
|
||||||
|
"filter_remaining": {
|
||||||
|
"name": "Filter remaining"
|
||||||
|
},
|
||||||
|
"filter_used": {
|
||||||
|
"name": "Filter used"
|
||||||
|
},
|
||||||
|
"sensor_remaining": {
|
||||||
|
"name": "Sensor remaining"
|
||||||
|
},
|
||||||
|
"sensor_used": {
|
||||||
|
"name": "Sensor used"
|
||||||
|
},
|
||||||
|
"charging_contacts_remaining": {
|
||||||
|
"name": "Charging contacts remaining"
|
||||||
|
},
|
||||||
|
"charging_contacts_used": {
|
||||||
|
"name": "Charging contacts used"
|
||||||
|
},
|
||||||
"vacuum_error": {
|
"vacuum_error": {
|
||||||
"name": "Error",
|
"name": "Error",
|
||||||
"state": {
|
"state": {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from dataclasses import replace
|
from dataclasses import replace
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
|
|
||||||
@ -279,6 +279,8 @@ def _mocked_feature(
|
|||||||
if enum_type := fixture.get("enum_type"):
|
if enum_type := fixture.get("enum_type"):
|
||||||
val = FIXTURE_ENUM_TYPES[enum_type](fixture["value"])
|
val = FIXTURE_ENUM_TYPES[enum_type](fixture["value"])
|
||||||
fixture["value"] = val
|
fixture["value"] = val
|
||||||
|
if timedelta_type := fixture.get("timedelta_type"):
|
||||||
|
fixture["value"] = timedelta(**{timedelta_type: fixture["value"]})
|
||||||
|
|
||||||
else:
|
else:
|
||||||
assert require_fixture is False, (
|
assert require_fixture is False, (
|
||||||
|
@ -407,5 +407,90 @@
|
|||||||
"value": "<Action>",
|
"value": "<Action>",
|
||||||
"type": "Action",
|
"type": "Action",
|
||||||
"category": "Debug"
|
"category": "Debug"
|
||||||
|
},
|
||||||
|
"main_brush_reset": {
|
||||||
|
"value": "<Action>",
|
||||||
|
"type": "Action",
|
||||||
|
"category": "Debug"
|
||||||
|
},
|
||||||
|
"side_brush_reset": {
|
||||||
|
"value": "<Action>",
|
||||||
|
"type": "Action",
|
||||||
|
"category": "Debug"
|
||||||
|
},
|
||||||
|
"sensor_reset": {
|
||||||
|
"value": "<Action>",
|
||||||
|
"type": "Action",
|
||||||
|
"category": "Debug"
|
||||||
|
},
|
||||||
|
"filter_reset": {
|
||||||
|
"value": "<Action>",
|
||||||
|
"type": "Action",
|
||||||
|
"category": "Debug"
|
||||||
|
},
|
||||||
|
"charging_contacts_reset": {
|
||||||
|
"value": "<Action>",
|
||||||
|
"type": "Action",
|
||||||
|
"category": "Debug"
|
||||||
|
},
|
||||||
|
"main_brush_remaining": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"main_brush_used": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"side_brush_remaining": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"side_brush_used": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"filter_remaining": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"filter_used": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"sensor_remaining": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"sensor_used": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"charging_contacts_remaining": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
|
},
|
||||||
|
"charging_contacts_used": {
|
||||||
|
"value": 360,
|
||||||
|
"type": "Sensor",
|
||||||
|
"category": "Debug",
|
||||||
|
"timedelta_type": "minutes"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,171 @@
|
|||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[button.my_device_reset_charging_contacts_consumable-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.my_device_reset_charging_contacts_consumable',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Reset charging contacts consumable',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'charging_contacts_reset',
|
||||||
|
'unique_id': '123456789ABCDEFGH_charging_contacts_reset',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[button.my_device_reset_filter_consumable-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.my_device_reset_filter_consumable',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Reset filter consumable',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'filter_reset',
|
||||||
|
'unique_id': '123456789ABCDEFGH_filter_reset',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[button.my_device_reset_main_brush_consumable-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.my_device_reset_main_brush_consumable',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Reset main brush consumable',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'main_brush_reset',
|
||||||
|
'unique_id': '123456789ABCDEFGH_main_brush_reset',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[button.my_device_reset_sensor_consumable-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.my_device_reset_sensor_consumable',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Reset sensor consumable',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'sensor_reset',
|
||||||
|
'unique_id': '123456789ABCDEFGH_sensor_reset',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[button.my_device_reset_side_brush_consumable-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.my_device_reset_side_brush_consumable',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Reset side brush consumable',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'side_brush_reset',
|
||||||
|
'unique_id': '123456789ABCDEFGH_side_brush_reset',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[button.my_device_restart-entry]
|
# name: test_states[button.my_device_restart-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
|
@ -166,6 +166,78 @@
|
|||||||
'state': '85',
|
'state': '85',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_charging_contacts_remaining-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_charging_contacts_remaining',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Charging contacts remaining',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'charging_contacts_remaining',
|
||||||
|
'unique_id': '123456789ABCDEFGH_charging_contacts_remaining',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_charging_contacts_used-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_charging_contacts_used',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Charging contacts used',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'charging_contacts_used',
|
||||||
|
'unique_id': '123456789ABCDEFGH_charging_contacts_used',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[sensor.my_device_current-entry]
|
# name: test_states[sensor.my_device_current-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@ -383,6 +455,78 @@
|
|||||||
'state': 'ok',
|
'state': 'ok',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_filter_remaining-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_filter_remaining',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Filter remaining',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'filter_remaining',
|
||||||
|
'unique_id': '123456789ABCDEFGH_filter_remaining',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_filter_used-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_filter_used',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Filter used',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'filter_used',
|
||||||
|
'unique_id': '123456789ABCDEFGH_filter_used',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[sensor.my_device_humidity-entry]
|
# name: test_states[sensor.my_device_humidity-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@ -481,6 +625,78 @@
|
|||||||
'state': '2024-06-24T09:03:11+00:00',
|
'state': '2024-06-24T09:03:11+00:00',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_main_brush_remaining-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_main_brush_remaining',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Main brush remaining',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'main_brush_remaining',
|
||||||
|
'unique_id': '123456789ABCDEFGH_main_brush_remaining',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_main_brush_used-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_main_brush_used',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Main brush used',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'main_brush_used',
|
||||||
|
'unique_id': '123456789ABCDEFGH_main_brush_used',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[sensor.my_device_on_since-entry]
|
# name: test_states[sensor.my_device_on_since-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@ -547,6 +763,150 @@
|
|||||||
'unit_of_measurement': '%',
|
'unit_of_measurement': '%',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_sensor_remaining-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_sensor_remaining',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Sensor remaining',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'sensor_remaining',
|
||||||
|
'unique_id': '123456789ABCDEFGH_sensor_remaining',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_sensor_used-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_sensor_used',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Sensor used',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'sensor_used',
|
||||||
|
'unique_id': '123456789ABCDEFGH_sensor_used',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_side_brush_remaining-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_side_brush_remaining',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Side brush remaining',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'side_brush_remaining',
|
||||||
|
'unique_id': '123456789ABCDEFGH_side_brush_remaining',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[sensor.my_device_side_brush_used-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'sensor.my_device_side_brush_used',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Side brush used',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'side_brush_used',
|
||||||
|
'unique_id': '123456789ABCDEFGH_side_brush_used',
|
||||||
|
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[sensor.my_device_signal_level-entry]
|
# name: test_states[sensor.my_device_signal_level-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user