mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add plate sensors for Miele hobs (#144400)
* Add plate sensors for miele hobs * Address review comments * Update snapshot
This commit is contained in:
parent
2fdda91cb8
commit
48520d90ef
@ -53,6 +53,35 @@
|
||||
"spin_speed": {
|
||||
"default": "mdi:sync"
|
||||
},
|
||||
"plate": {
|
||||
"default": "mdi:circle-outline",
|
||||
"state": {
|
||||
"0": "mdi:circle-outline",
|
||||
"110": "mdi:alpha-w-circle-outline",
|
||||
"220": "mdi:alpha-w-circle-outline",
|
||||
"1": "mdi:circle-slice-1",
|
||||
"2": "mdi:circle-slice-1",
|
||||
"3": "mdi:circle-slice-2",
|
||||
"4": "mdi:circle-slice-2",
|
||||
"5": "mdi:circle-slice-3",
|
||||
"6": "mdi:circle-slice-3",
|
||||
"7": "mdi:circle-slice-4",
|
||||
"8": "mdi:circle-slice-4",
|
||||
"9": "mdi:circle-slice-5",
|
||||
"10": "mdi:circle-slice-5",
|
||||
"11": "mdi:circle-slice-5",
|
||||
"12": "mdi:circle-slice-6",
|
||||
"13": "mdi:circle-slice-6",
|
||||
"14": "mdi:circle-slice-6",
|
||||
"15": "mdi:circle-slice-7",
|
||||
"16": "mdi:circle-slice-7",
|
||||
"17": "mdi:circle-slice-8",
|
||||
"18": "mdi:circle-slice-8",
|
||||
"117": "mdi:alpha-b-circle-outline",
|
||||
"118": "mdi:alpha-b-circle-outline",
|
||||
"217": "mdi:alpha-b-circle-outline"
|
||||
}
|
||||
},
|
||||
"program_type": {
|
||||
"default": "mdi:state-machine"
|
||||
},
|
||||
|
@ -45,6 +45,56 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DISABLED_TEMPERATURE = -32768
|
||||
|
||||
PLATE_POWERS = [
|
||||
"0",
|
||||
"110",
|
||||
"220",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"16",
|
||||
"17",
|
||||
"18",
|
||||
"117",
|
||||
"118",
|
||||
"217",
|
||||
]
|
||||
|
||||
|
||||
DEFAULT_PLATE_COUNT = 4
|
||||
|
||||
PLATE_COUNT = {
|
||||
"KM7678": 6,
|
||||
"KM7697": 6,
|
||||
"KM7878": 6,
|
||||
"KM7897": 6,
|
||||
"KMDA7633": 5,
|
||||
"KMDA7634": 5,
|
||||
"KMDA7774": 5,
|
||||
"KMX": 6,
|
||||
}
|
||||
|
||||
|
||||
def _get_plate_count(tech_type: str) -> int:
|
||||
"""Get number of zones for hob."""
|
||||
stripped = tech_type.replace(" ", "")
|
||||
for prefix, plates in PLATE_COUNT.items():
|
||||
if stripped.startswith(prefix):
|
||||
return plates
|
||||
return DEFAULT_PLATE_COUNT
|
||||
|
||||
|
||||
def _convert_duration(value_list: list[int]) -> int | None:
|
||||
"""Convert duration to minutes."""
|
||||
@ -56,7 +106,7 @@ class MieleSensorDescription(SensorEntityDescription):
|
||||
"""Class describing Miele sensor entities."""
|
||||
|
||||
value_fn: Callable[[MieleDevice], StateType]
|
||||
zone: int | None = None
|
||||
zone: int = 1
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -341,7 +391,6 @@ SENSOR_TYPES: Final[tuple[MieleSensorDefinition, ...]] = (
|
||||
),
|
||||
description=MieleSensorDescription(
|
||||
key="state_temperature_1",
|
||||
zone=1,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
@ -389,7 +438,6 @@ SENSOR_TYPES: Final[tuple[MieleSensorDefinition, ...]] = (
|
||||
description=MieleSensorDescription(
|
||||
key="state_core_target_temperature",
|
||||
translation_key="core_target_temperature",
|
||||
zone=1,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
@ -433,7 +481,6 @@ SENSOR_TYPES: Final[tuple[MieleSensorDefinition, ...]] = (
|
||||
description=MieleSensorDescription(
|
||||
key="state_core_temperature",
|
||||
translation_key="core_temperature",
|
||||
zone=1,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
@ -443,6 +490,25 @@ SENSOR_TYPES: Final[tuple[MieleSensorDefinition, ...]] = (
|
||||
),
|
||||
),
|
||||
),
|
||||
*(
|
||||
MieleSensorDefinition(
|
||||
types=(
|
||||
MieleAppliance.HOB_HIGHLIGHT,
|
||||
MieleAppliance.HOB_INDUCT_EXTR,
|
||||
MieleAppliance.HOB_INDUCTION,
|
||||
),
|
||||
description=MieleSensorDescription(
|
||||
key="state_plate_step",
|
||||
translation_key="plate",
|
||||
translation_placeholders={"plate_no": str(i)},
|
||||
zone=i,
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=PLATE_POWERS,
|
||||
value_fn=lambda value: value.state_plate_step[0].value_raw,
|
||||
),
|
||||
)
|
||||
for i in range(1, 7)
|
||||
),
|
||||
MieleSensorDefinition(
|
||||
types=(
|
||||
MieleAppliance.WASHER_DRYER,
|
||||
@ -492,6 +558,8 @@ async def async_setup_entry(
|
||||
entity_class = MieleProgramIdSensor
|
||||
case "state_program_phase":
|
||||
entity_class = MielePhaseSensor
|
||||
case "state_plate_step":
|
||||
entity_class = MielePlateSensor
|
||||
case _:
|
||||
entity_class = MieleSensor
|
||||
if (
|
||||
@ -499,6 +567,10 @@ async def async_setup_entry(
|
||||
== SensorDeviceClass.TEMPERATURE
|
||||
and definition.description.value_fn(device)
|
||||
== DISABLED_TEMPERATURE / 100
|
||||
) or (
|
||||
definition.description.key == "state_plate_step"
|
||||
and definition.description.zone
|
||||
> _get_plate_count(device.tech_type)
|
||||
):
|
||||
# Don't create entity if API signals that datapoint is disabled
|
||||
continue
|
||||
@ -552,6 +624,33 @@ class MieleSensor(MieleEntity, SensorEntity):
|
||||
return self.entity_description.value_fn(self.device)
|
||||
|
||||
|
||||
class MielePlateSensor(MieleSensor):
|
||||
"""Representation of a Sensor."""
|
||||
|
||||
entity_description: MieleSensorDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: MieleDataUpdateCoordinator,
|
||||
device_id: str,
|
||||
description: MieleSensorDescription,
|
||||
) -> None:
|
||||
"""Initialize the plate sensor."""
|
||||
super().__init__(coordinator, device_id, description)
|
||||
self._attr_unique_id = f"{device_id}-{description.key}-{description.zone}"
|
||||
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return the state of the plate sensor."""
|
||||
# state_plate_step is [] if all zones are off
|
||||
plate_power = (
|
||||
self.device.state_plate_step[self.entity_description.zone - 1].value_raw
|
||||
if self.device.state_plate_step
|
||||
else 0
|
||||
)
|
||||
return str(plate_power)
|
||||
|
||||
|
||||
class MieleStatusSensor(MieleSensor):
|
||||
"""Representation of the status sensor."""
|
||||
|
||||
|
@ -191,6 +191,35 @@
|
||||
"energy_consumption": {
|
||||
"name": "Energy consumption"
|
||||
},
|
||||
"plate": {
|
||||
"name": "Plate {plate_no}",
|
||||
"state": {
|
||||
"0": "0",
|
||||
"110": "Warming",
|
||||
"220": "%key::component::miele::sensor::plate::state::110%",
|
||||
"1": "1",
|
||||
"2": "1\u2022",
|
||||
"3": "2",
|
||||
"4": "2\u2022",
|
||||
"5": "3",
|
||||
"6": "3\u2022",
|
||||
"7": "4",
|
||||
"8": "4\u2022",
|
||||
"9": "5",
|
||||
"10": "5\u2022",
|
||||
"11": "6",
|
||||
"12": "6\u2022",
|
||||
"13": "7",
|
||||
"14": "7\u2022",
|
||||
"15": "8",
|
||||
"16": "8\u2022",
|
||||
"17": "9",
|
||||
"18": "9\u2022",
|
||||
"117": "Boost",
|
||||
"118": "%key::component::miele::sensor::plate::state::117%",
|
||||
"217": "%key::component::miele::sensor::plate::state::117%"
|
||||
}
|
||||
},
|
||||
"drying_step": {
|
||||
"name": "Drying step",
|
||||
"state": {
|
||||
|
168
tests/components/miele/fixtures/hob.json
Normal file
168
tests/components/miele/fixtures/hob.json
Normal file
@ -0,0 +1,168 @@
|
||||
{
|
||||
"DummyAppliance_hob_w_extr": {
|
||||
"ident": {
|
||||
"type": {
|
||||
"key_localized": "Device type",
|
||||
"value_raw": 74,
|
||||
"value_localized": "Hob with vapour extraction"
|
||||
},
|
||||
"deviceName": "KDMA7774 | APP2-2",
|
||||
"protocolVersion": 2,
|
||||
"deviceIdentLabel": {
|
||||
"fabNumber": "**REDACTED**",
|
||||
"fabIndex": "00",
|
||||
"techType": "KMDA7774-1 R01",
|
||||
"matNumber": "10974770",
|
||||
"swids": [
|
||||
"4088",
|
||||
"20269",
|
||||
"25122",
|
||||
"4194",
|
||||
"20270",
|
||||
"25077",
|
||||
"4194",
|
||||
"20270",
|
||||
"25077",
|
||||
"4215",
|
||||
"20270",
|
||||
"25134",
|
||||
"4438",
|
||||
"20314",
|
||||
"25128"
|
||||
]
|
||||
},
|
||||
"xkmIdentLabel": {
|
||||
"techType": "EK039W",
|
||||
"releaseVersion": "02.72"
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"ProgramID": {
|
||||
"value_raw": 0,
|
||||
"value_localized": "",
|
||||
"key_localized": "Program name"
|
||||
},
|
||||
"status": {
|
||||
"value_raw": 5,
|
||||
"value_localized": "In use",
|
||||
"key_localized": "status"
|
||||
},
|
||||
"programType": {
|
||||
"value_raw": 0,
|
||||
"value_localized": "",
|
||||
"key_localized": "Program type"
|
||||
},
|
||||
"programPhase": {
|
||||
"value_raw": 0,
|
||||
"value_localized": "",
|
||||
"key_localized": "Program phase"
|
||||
},
|
||||
"remainingTime": [0, 0],
|
||||
"startTime": [0, 0],
|
||||
"targetTemperature": [
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
},
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
},
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
}
|
||||
],
|
||||
"coreTargetTemperature": [
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
}
|
||||
],
|
||||
"temperature": [
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
},
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
},
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
}
|
||||
],
|
||||
"coreTemperature": [
|
||||
{
|
||||
"value_raw": -32768,
|
||||
"value_localized": null,
|
||||
"unit": "Celsius"
|
||||
}
|
||||
],
|
||||
"signalInfo": false,
|
||||
"signalFailure": false,
|
||||
"signalDoor": false,
|
||||
"remoteEnable": {
|
||||
"fullRemoteControl": true,
|
||||
"smartGrid": false,
|
||||
"mobileStart": false
|
||||
},
|
||||
"ambientLight": null,
|
||||
"light": null,
|
||||
"elapsedTime": [],
|
||||
"spinningSpeed": {
|
||||
"unit": "rpm",
|
||||
"value_raw": null,
|
||||
"value_localized": null,
|
||||
"key_localized": "Spin speed"
|
||||
},
|
||||
"dryingStep": {
|
||||
"value_raw": null,
|
||||
"value_localized": "",
|
||||
"key_localized": "Drying level"
|
||||
},
|
||||
"ventilationStep": {
|
||||
"value_raw": null,
|
||||
"value_localized": "",
|
||||
"key_localized": "Fan level"
|
||||
},
|
||||
"plateStep": [
|
||||
{
|
||||
"value_raw": 0,
|
||||
"value_localized": 0,
|
||||
"key_localized": "Power level"
|
||||
},
|
||||
{
|
||||
"value_raw": 110,
|
||||
"value_localized": 2,
|
||||
"key_localized": "Power level"
|
||||
},
|
||||
{
|
||||
"value_raw": 8,
|
||||
"value_localized": 4,
|
||||
"key_localized": "Power level"
|
||||
},
|
||||
{
|
||||
"value_raw": 15,
|
||||
"value_localized": 8,
|
||||
"key_localized": "Power level"
|
||||
},
|
||||
{
|
||||
"value_raw": 117,
|
||||
"value_localized": 10,
|
||||
"key_localized": "Power level"
|
||||
}
|
||||
],
|
||||
"ecoFeedback": null,
|
||||
"batteryLevel": null
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,599 @@
|
||||
# serializer version: 1
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'autocleaning',
|
||||
'failure',
|
||||
'idle',
|
||||
'in_use',
|
||||
'not_connected',
|
||||
'off',
|
||||
'on',
|
||||
'pause',
|
||||
'program_ended',
|
||||
'program_interrupted',
|
||||
'programmed',
|
||||
'rinse_hold',
|
||||
'service',
|
||||
'supercooling',
|
||||
'supercooling_superfreezing',
|
||||
'superfreezing',
|
||||
'superheating',
|
||||
'waiting_to_start',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hob_with_extraction',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'original_icon': 'mdi:pot-steam-outline',
|
||||
'original_name': None,
|
||||
'platform': 'miele',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'status',
|
||||
'unique_id': 'DummyAppliance_hob_w_extr-state_status',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'enum',
|
||||
'friendly_name': 'Hob with extraction',
|
||||
'icon': 'mdi:pot-steam-outline',
|
||||
'options': list([
|
||||
'autocleaning',
|
||||
'failure',
|
||||
'idle',
|
||||
'in_use',
|
||||
'not_connected',
|
||||
'off',
|
||||
'on',
|
||||
'pause',
|
||||
'program_ended',
|
||||
'program_interrupted',
|
||||
'programmed',
|
||||
'rinse_hold',
|
||||
'service',
|
||||
'supercooling',
|
||||
'supercooling_superfreezing',
|
||||
'superfreezing',
|
||||
'superheating',
|
||||
'waiting_to_start',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hob_with_extraction',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'in_use',
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_1',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Plate 1',
|
||||
'platform': 'miele',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'plate',
|
||||
'unique_id': 'DummyAppliance_hob_w_extr-state_plate_step-1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'enum',
|
||||
'friendly_name': 'Hob with extraction Plate 1',
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0',
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_2',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Plate 2',
|
||||
'platform': 'miele',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'plate',
|
||||
'unique_id': 'DummyAppliance_hob_w_extr-state_plate_step-2',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'enum',
|
||||
'friendly_name': 'Hob with extraction Plate 2',
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '110',
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_3-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_3',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Plate 3',
|
||||
'platform': 'miele',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'plate',
|
||||
'unique_id': 'DummyAppliance_hob_w_extr-state_plate_step-3',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_3-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'enum',
|
||||
'friendly_name': 'Hob with extraction Plate 3',
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_3',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '8',
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_4-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_4',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Plate 4',
|
||||
'platform': 'miele',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'plate',
|
||||
'unique_id': 'DummyAppliance_hob_w_extr-state_plate_step-4',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_4-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'enum',
|
||||
'friendly_name': 'Hob with extraction Plate 4',
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_4',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '15',
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_5-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_5',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Plate 5',
|
||||
'platform': 'miele',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'plate',
|
||||
'unique_id': 'DummyAppliance_hob_w_extr-state_plate_step-5',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_hob_sensor_states[platforms0-hob.json][sensor.hob_with_extraction_plate_5-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'enum',
|
||||
'friendly_name': 'Hob with extraction Plate 5',
|
||||
'options': list([
|
||||
'0',
|
||||
'110',
|
||||
'220',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'10',
|
||||
'11',
|
||||
'12',
|
||||
'13',
|
||||
'14',
|
||||
'15',
|
||||
'16',
|
||||
'17',
|
||||
'18',
|
||||
'117',
|
||||
'118',
|
||||
'217',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hob_with_extraction_plate_5',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '117',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_states[platforms0][sensor.freezer-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
@ -24,3 +24,18 @@ async def test_sensor_states(
|
||||
"""Test sensor state."""
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, setup_platform.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("load_device_file", ["hob.json"])
|
||||
@pytest.mark.parametrize("platforms", [(SENSOR_DOMAIN,)])
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_hob_sensor_states(
|
||||
hass: HomeAssistant,
|
||||
mock_miele_client: MagicMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
entity_registry: er.EntityRegistry,
|
||||
setup_platform: None,
|
||||
) -> None:
|
||||
"""Test sensor state."""
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, setup_platform.entry_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user