Add door warning to Midea (#182579)

This commit is contained in:
Simone Chemelli
2026-09-18 14:19:34 +00:00
committed by GitHub
parent a8372415e4
commit f83552c100
4 changed files with 71 additions and 0 deletions
@@ -24,6 +24,12 @@ BINARY_SENSORS: list[BinarySensorEntityDescription] = [
key="door",
device_class=BinarySensorDeviceClass.OPENING,
),
BinarySensorEntityDescription(
key="door_warn",
translation_key="door_warn",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
),
BinarySensorEntityDescription(
key="rinse_aid",
translation_key="rinse_aid",
@@ -118,6 +118,9 @@
"arofene_link": {
"name": "Methanal"
},
"door_warn": {
"name": "Door warning"
},
"fall_asleep_status": {
"name": "Fall asleep"
},
@@ -101,6 +101,57 @@
'state': 'on',
})
# ---
# name: test_all_entities[dc][binary_sensor.clothes_dryer_door_warning-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.clothes_dryer_door_warning',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Door warning',
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Door warning',
'platform': 'midea',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'door_warn',
'unique_id': '12345678_door_warn',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[dc][binary_sensor.clothes_dryer_door_warning-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'problem',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Clothes Dryer Door warning',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.clothes_dryer_door_warning',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_all_entities[e1][binary_sensor.dishwasher_opening-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -5,6 +5,7 @@ from unittest.mock import patch
from midealocal.const import DeviceType
from midealocal.devices.ac import DeviceAttributes as ACAttributes
from midealocal.devices.dc import DeviceAttributes as DCAttributes
from midealocal.devices.e1 import DeviceAttributes as E1Attributes
from midealocal.devices.x26 import DeviceAttributes as X26Attributes
import pytest
@@ -62,10 +63,20 @@ def _x26_device() -> DummyDevice:
)
def _dc_device() -> DummyDevice:
return DummyDevice(
DeviceType.DC,
attributes={
DCAttributes.door_warn: True,
},
)
@pytest.mark.parametrize(
"device",
[
pytest.param(_ac_device(), id="ac"),
pytest.param(_dc_device(), id="dc"),
pytest.param(_e1_device(), id="e1"),
pytest.param(_x26_device(), id="x26"),
],