From 4fe689217a0b087b4e66732c0ebcd81cb3defa46 Mon Sep 17 00:00:00 2001 From: sususweet Date: Wed, 5 Nov 2025 20:58:00 +0800 Subject: [PATCH] feat: add support for washing machine T0xDA --- README.md | 3 +- README_hans.md | 1 + .../midea_auto_cloud/device_mapping/T0xDA.py | 150 ++++++++++++++++++ .../midea_auto_cloud/device_mapping/T0xDB.py | 122 +++++--------- .../midea_auto_cloud/translations/en.json | 63 +++++--- .../translations/zh-Hans.json | 63 +++++--- 6 files changed, 279 insertions(+), 123 deletions(-) create mode 100644 custom_components/midea_auto_cloud/device_mapping/T0xDA.py diff --git a/README.md b/README.md index a51f4c3..de86904 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ Get devices from MSmartHome/Midea Meiju homes through the network and control th - T0xCE Fresh Air System - T0xCF Central Air Conditioning Heating - T0xD9 Twin Tub Washing Machine -- T0xDB Front Load Washing Machine +- T0xDA Impeller Washing Machine +- T0xDB Cylinder Washing Machine - T0xDC Clothes Dryer - T0xE1 Dishwasher - T0xE2 Electric Water Heater diff --git a/README_hans.md b/README_hans.md index 41482af..40278da 100644 --- a/README_hans.md +++ b/README_hans.md @@ -37,6 +37,7 @@ - T0xCE 新风机 - T0xCF 中央空调暖家 - T0xD9 复式洗衣机 +- T0xDA 波轮洗衣机 - T0xDB 滚筒洗衣机 - T0xDC 干衣机 - T0xE1 洗碗机 diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xDA.py b/custom_components/midea_auto_cloud/device_mapping/T0xDA.py new file mode 100644 index 0000000..985a4a1 --- /dev/null +++ b/custom_components/midea_auto_cloud/device_mapping/T0xDA.py @@ -0,0 +1,150 @@ +from homeassistant.const import Platform, UnitOfElectricPotential, UnitOfTemperature, UnitOfTime +from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass +from homeassistant.components.binary_sensor import BinarySensorDeviceClass +from homeassistant.components.switch import SwitchDeviceClass + +DEVICE_MAPPING = { + "default": { + "rationale": ["off", "on"], + "queries": [{}], + "calculate": { + "get": [ + { + "lvalue": "[remain_time]", + "rvalue": "[remain_time]" + } + ], + "set": { + } + }, + "entities": { + Platform.NUMBER: { + "temperature": { + "min": 0, + "max": 100, + "step": 1 + }, + "detergent": { + "min": 0, + "max": 5, + "step": 1 + }, + "softener": { + "min": 0, + "max": 5, + "step": 1 + }, + "dehydration_speed": { + "min": 0, + "max": 1600, + "step": 100 + }, + "soak_time": { + "min": 0, + "max": 40, + "step": 10 + }, + "wash_time": { + "min": 0, + "max": 20, + "step": 1 + }, + "rinse_count": { + "min": 0, + "max": 3, + "step": 1 + }, + "dehydration_time": { + "min": 0, + "max": 9, + "step": 1 + }, + "wash_level": { + "min": 0, + "max": 8, + "step": 1 + }, + "rinse_level": { + "min": 0, + "max": 8, + "step": 1 + }, + "wash_strength": { + "min": 1, + "max": 4, + "step": 1 + }, + }, + Platform.BINARY_SENSOR: { + "softener_lack": { + "device_class": BinarySensorDeviceClass.PROBLEM, + }, + "detergent_lack": { + "device_class": BinarySensorDeviceClass.PROBLEM, + }, + "door_opened": { + "device_class": BinarySensorDeviceClass.PROBLEM, + }, + "bucket_water_overheating": { + "device_class": BinarySensorDeviceClass.PROBLEM, + }, + }, + Platform.SWITCH: { + "power": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "control_status": { + "rationale": ["pause", "start"], + }, + "lock": { + "device_class": SwitchDeviceClass.SWITCH, + }, + }, + Platform.SELECT: { + "mode": { + "options": { + "normal": {"mode": "normal"}, + "dry": {"mode": "dry"}, + "continus": {"mode": "continus"}, + } + }, + "program": { + "options": { + "标准": {"program": "standard"}, + "速洗": {"program": "fast"}, + "家纺": {"program": "blanket"}, + "羊毛": {"program": "wool"}, + "浸洗": {"program": "embathe"}, + "记忆": {"program": "memory"}, + "童装": {"program": "child"}, + "强洗": {"program": "strong_wash"}, + "桶自洁": {"program": "bucket_self_clean"}, + } + }, + }, + Platform.SENSOR: { + "running_status": { + "device_class": SensorDeviceClass.ENUM + }, + "appointment_time": { + "device_class": SensorDeviceClass.DURATION, + "unit_of_measurement": UnitOfTime.MINUTES, + "state_class": SensorStateClass.MEASUREMENT + }, + "remain_time": { + "device_class": SensorDeviceClass.DURATION, + "unit_of_measurement": UnitOfTime.MINUTES, + "state_class": SensorStateClass.MEASUREMENT + }, + "progress": { + "device_class": SensorDeviceClass.BATTERY, + "unit_of_measurement": "%", + "state_class": SensorStateClass.MEASUREMENT + }, + "error_code": { + "device_class": SensorDeviceClass.ENUM + }, + } + } + } +} diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xDB.py b/custom_components/midea_auto_cloud/device_mapping/T0xDB.py index 0cd1e0b..3dfe7b8 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xDB.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xDB.py @@ -18,6 +18,48 @@ DEVICE_MAPPING = { } }, "entities": { + Platform.NUMBER: { + "temperature": { + "min": 0, + "max": 100, + "step": 1 + }, + "detergent": { + "min": 0, + "max": 5, + "step": 1 + }, + "softener": { + "min": 0, + "max": 5, + "step": 1 + }, + "dehydration_time": { + "min": 0, + "max": 9, + "step": 1 + }, + "dehydration_speed": { + "min": 0, + "max": 1600, + "step": 100 + }, + "dirty_degree": { + "min": 0, + "max": 4, + "step": 1 + }, + "soak_count": { + "min": 0, + "max": 5, + "step": 1 + }, + "wash_time": { + "min": 0, + "max": 20, + "step": 1 + }, + }, Platform.BINARY_SENSOR: { "softener_lack": { "device_class": BinarySensorDeviceClass.PROBLEM, @@ -66,19 +108,6 @@ DEVICE_MAPPING = { }, }, Platform.SELECT: { - "dehydration_speed": { - "options": { - "0": {"dehydration_speed": "0"}, - "400": {"dehydration_speed": "400"}, - "600": {"dehydration_speed": "600"}, - "800": {"dehydration_speed": "800"}, - "1000": {"dehydration_speed": "1000"}, - "1200": {"dehydration_speed": "1200"}, - "1400": {"dehydration_speed": "1400"}, - "1600": {"dehydration_speed": "1600"}, - "1300": {"dehydration_speed": "1300"} - } - }, "mode": { "options": { "normal": {"mode": "normal"}, @@ -190,68 +219,11 @@ DEVICE_MAPPING = { "hanfu_wash": {"program": "hanfu_wash"} } }, - "temperature": { - "options": { - "0": {"temperature": "0"}, - "20": {"temperature": "20"}, - "30": {"temperature": "30"}, - "40": {"temperature": "40"}, - "50": {"temperature": "50"}, - "60": {"temperature": "60"}, - "70": {"temperature": "70"}, - "90": {"temperature": "90"}, - "95": {"temperature": "95"} - } - }, - "detergent": { - "options": { - "0": {"detergent": "0"}, - "1": {"detergent": "1"}, - "2": {"detergent": "2"}, - "3": {"detergent": "3"}, - "4": {"detergent": "4"}, - "5": {"detergent": "5"} - } - }, - "softener": { - "options": { - "0": {"softener": "0"}, - "1": {"softener": "1"}, - "2": {"softener": "2"}, - "3": {"softener": "3"}, - "4": {"softener": "4"}, - "5": {"softener": "5"} - } - }, - "dirty_degree": { - "options": { - "0": {"dirty_degree": "0"}, - "1": {"dirty_degree": "1"}, - "2": {"dirty_degree": "2"}, - "3": {"dirty_degree": "3"}, - "4": {"dirty_degree": "4"} - } - }, - "soak_count": { - "options": { - "0": {"soak_count": "0"}, - "1": {"soak_count": "1"}, - "2": {"soak_count": "2"}, - "3": {"soak_count": "3"}, - "4": {"soak_count": "4"}, - "5": {"soak_count": "5"} - } - } }, Platform.SENSOR: { "running_status": { "device_class": SensorDeviceClass.ENUM }, - "wash_time": { - "device_class": SensorDeviceClass.DURATION, - "unit_of_measurement": UnitOfTime.MINUTES, - "state_class": SensorStateClass.MEASUREMENT - }, "appointment_time": { "device_class": SensorDeviceClass.DURATION, "unit_of_measurement": UnitOfTime.MINUTES, @@ -273,11 +245,6 @@ DEVICE_MAPPING = { "unit_of_measurement": "%", "state_class": SensorStateClass.MEASUREMENT }, - "dehydration_time_value": { - "device_class": SensorDeviceClass.DURATION, - "unit_of_measurement": UnitOfTime.MINUTES, - "state_class": SensorStateClass.MEASUREMENT - }, "customize_machine_cycle": { "device_class": SensorDeviceClass.ENUM }, @@ -315,11 +282,6 @@ DEVICE_MAPPING = { "active_oxygen": { "device_class": SensorDeviceClass.ENUM }, - "dehydration_time": { - "device_class": SensorDeviceClass.DURATION, - "unit_of_measurement": UnitOfTime.MINUTES, - "state_class": SensorStateClass.MEASUREMENT - }, "cloud_cycle_jiepai_time2": { "device_class": SensorDeviceClass.DURATION, "unit_of_measurement": UnitOfTime.MINUTES, diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index eaa6125..acec49d 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -388,12 +388,6 @@ "control_type": { "name": "Control Type" }, - "dehydration_speed": { - "name": "Dehydration Speed" - }, - "db_dehydration_speed": { - "name": "DB Dehydration Speed" - }, "db_detergent": { "name": "DB Detergent" }, @@ -424,9 +418,6 @@ "detergent_density": { "name": "Detergent Density" }, - "dirty_degree": { - "name": "Dirty Degree" - }, "disinfectant": { "name": "Disinfectant" }, @@ -511,9 +502,6 @@ "season": { "name": "Season" }, - "soak_count": { - "name": "Soak Count" - }, "softener_density": { "name": "Softener Density" }, @@ -592,15 +580,6 @@ "gear": { "name": "Gear" }, - "detergent": { - "name": "Detergent" - }, - "softener": { - "name": "Softener" - }, - "temperature": { - "name": "Temperature" - }, "ptc": { "name": "PTC" }, @@ -1533,6 +1512,48 @@ "number": { "b6_lightness": { "name": "Smoke Machine Lightness" + }, + "dehydration_speed": { + "name": "Dehydration Speed" + }, + "db_dehydration_speed": { + "name": "DB Dehydration Speed" + }, + "detergent": { + "name": "Detergent" + }, + "softener": { + "name": "Softener" + }, + "temperature": { + "name": "Temperature" + }, + "soak_count": { + "name": "Soak Count" + }, + "dirty_degree": { + "name": "Dirty Degree" + }, + "soak_time": { + "name": "Soak Time" + }, + "wash_time": { + "name": "Wash Time" + }, + "rinse_count": { + "name": "Rinse Count" + }, + "dehydration_time": { + "name": "Dehydration Time" + }, + "wash_level": { + "name": "Wash Level" + }, + "rinse_level": { + "name": "Rinse Level" + }, + "wash_strength": { + "name": "Water Strength" } }, "fan": { diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index 4e81efa..7205fe9 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -392,12 +392,6 @@ "control_type": { "name": "控制类型" }, - "dehydration_speed": { - "name": "脱水转速" - }, - "db_dehydration_speed": { - "name": "脱水转速" - }, "db_detergent": { "name": "洗涤剂" }, @@ -428,9 +422,6 @@ "detergent_density": { "name": "洗涤剂浓度" }, - "dirty_degree": { - "name": "脏污程度" - }, "disinfectant": { "name": "消毒剂" }, @@ -515,9 +506,6 @@ "season": { "name": "季节" }, - "soak_count": { - "name": "浸泡次数" - }, "softener_density": { "name": "柔顺剂浓度" }, @@ -596,15 +584,6 @@ "gear": { "name": "档位" }, - "detergent": { - "name": "洗涤剂" - }, - "softener": { - "name": "柔顺剂" - }, - "temperature": { - "name": "温度" - }, "ptc": { "name": "电辅热" }, @@ -1537,6 +1516,48 @@ "number": { "b6_lightness": { "name": "烟机照明" + }, + "dehydration_speed": { + "name": "脱水转速" + }, + "db_dehydration_speed": { + "name": "脱水转速" + }, + "detergent": { + "name": "洗涤剂" + }, + "softener": { + "name": "柔顺剂" + }, + "temperature": { + "name": "温度" + }, + "soak_count": { + "name": "浸泡次数" + }, + "dirty_degree": { + "name": "脏污程度" + }, + "soak_time": { + "name": "浸泡时间" + }, + "wash_time": { + "name": "洗涤时间" + }, + "rinse_count": { + "name": "漂洗次数" + }, + "dehydration_time": { + "name": "脱水时间" + }, + "wash_level": { + "name": "洗涤水位" + }, + "rinse_level": { + "name": "漂洗水位" + }, + "wash_strength": { + "name": "水流强度" } }, "fan": {