From f83552c100a4182f60852d8d90d49b8859bc9bb2 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Fri, 18 Sep 2026 16:19:34 +0200 Subject: [PATCH] Add door warning to Midea (#182579) --- .../components/midea/binary_sensor.py | 6 +++ homeassistant/components/midea/strings.json | 3 ++ .../midea/snapshots/test_binary_sensor.ambr | 51 +++++++++++++++++++ tests/components/midea/test_binary_sensor.py | 11 ++++ 4 files changed, 71 insertions(+) diff --git a/homeassistant/components/midea/binary_sensor.py b/homeassistant/components/midea/binary_sensor.py index 16978cce52ca..3c1e715c5f80 100644 --- a/homeassistant/components/midea/binary_sensor.py +++ b/homeassistant/components/midea/binary_sensor.py @@ -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", diff --git a/homeassistant/components/midea/strings.json b/homeassistant/components/midea/strings.json index 4dd19acf76bc..8ea20f88c3bb 100644 --- a/homeassistant/components/midea/strings.json +++ b/homeassistant/components/midea/strings.json @@ -118,6 +118,9 @@ "arofene_link": { "name": "Methanal" }, + "door_warn": { + "name": "Door warning" + }, "fall_asleep_status": { "name": "Fall asleep" }, diff --git a/tests/components/midea/snapshots/test_binary_sensor.ambr b/tests/components/midea/snapshots/test_binary_sensor.ambr index 5d4b49329e92..af38b4a898a3 100644 --- a/tests/components/midea/snapshots/test_binary_sensor.ambr +++ b/tests/components/midea/snapshots/test_binary_sensor.ambr @@ -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': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': , + 'entity_id': 'binary_sensor.clothes_dryer_door_warning', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Door warning', + 'options': dict({ + }), + 'original_device_class': , + '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({ + : 'problem', + : 'Clothes Dryer Door warning', + }), + 'context': , + 'entity_id': 'binary_sensor.clothes_dryer_door_warning', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- # name: test_all_entities[e1][binary_sensor.dishwasher_opening-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/midea/test_binary_sensor.py b/tests/components/midea/test_binary_sensor.py index 62cd1b5e2686..946fa571599c 100644 --- a/tests/components/midea/test_binary_sensor.py +++ b/tests/components/midea/test_binary_sensor.py @@ -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"), ],