From 03287142275aaa69ee40fc012cf1cf7712671854 Mon Sep 17 00:00:00 2001 From: sususweet Date: Sun, 5 Oct 2025 10:27:57 +0800 Subject: [PATCH] feat: update device support for central air conditioner and washer. --- custom_components/midea_auto_cloud/climate.py | 6 + .../midea_auto_cloud/device_mapping/T0xDB.py | 150 ++---------------- .../midea_auto_cloud/device_mapping/T0xDC.py | 129 +++++++-------- .../midea_auto_cloud/device_mapping/T0xE3.py | 1 + .../midea_auto_cloud/translations/en.json | 27 ++-- .../translations/zh-Hans.json | 27 ++-- 6 files changed, 119 insertions(+), 221 deletions(-) diff --git a/custom_components/midea_auto_cloud/climate.py b/custom_components/midea_auto_cloud/climate.py index abed8ba..b0a2b7b 100644 --- a/custom_components/midea_auto_cloud/climate.py +++ b/custom_components/midea_auto_cloud/climate.py @@ -193,6 +193,12 @@ class MideaClimateEntity(MideaEntity, ClimateEntity): async def async_turn_off(self): await self._async_set_status_on_off(self._key_power, False) + async def async_toggle(self): + if self.is_on: + await self.async_turn_off() + else: + await self.async_turn_on() + async def async_set_temperature(self, **kwargs): if ATTR_TEMPERATURE not in kwargs: return diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xDB.py b/custom_components/midea_auto_cloud/device_mapping/T0xDB.py index 68b7840..0cd1e0b 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xDB.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xDB.py @@ -19,59 +19,25 @@ DEVICE_MAPPING = { }, "entities": { Platform.BINARY_SENSOR: { - "power": { - "device_class": BinarySensorDeviceClass.RUNNING, + "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: { - "softener_lack": { + "power": { "device_class": SwitchDeviceClass.SWITCH, }, - "detergent_lack": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "door_opened": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "bucket_water_overheating": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "memory": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "appointment": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "spray_wash": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "old_speedy": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "nightly": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "down_light": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "easy_ironing": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "super_clean_wash": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "intelligent_wash": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "strong_wash": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "silent": { - "device_class": SwitchDeviceClass.SWITCH, - "rationale": ["0", "1"], - }, - "speedy": { - "device_class": SwitchDeviceClass.SWITCH, + "control_status": { + "rationale": ["pause", "start"], }, "lock": { "device_class": SwitchDeviceClass.SWITCH, @@ -79,36 +45,6 @@ DEVICE_MAPPING = { "flocks_switcher": { "device_class": SwitchDeviceClass.SWITCH, }, - "fresh_anion_switch": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "dry_weighing_already": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "keep_fresh_status": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "drying_tunnel_overheating": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "fast_clean_wash": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "steam_wash": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "beforehand_wash": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "ai_flag": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "water_plus": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "soak": { - "device_class": SwitchDeviceClass.SWITCH, - }, "ultraviolet_lamp": { "device_class": SwitchDeviceClass.SWITCH, "rationale": ["0", "1"], @@ -128,27 +64,8 @@ DEVICE_MAPPING = { "cycle_memory": { "device_class": SwitchDeviceClass.SWITCH, }, - "disinfectant": { - "device_class": SwitchDeviceClass.SWITCH, - "rationale": ["0", "1"], - }, - "add_rinse": { - "device_class": SwitchDeviceClass.SWITCH, - "rationale": ["0", "1"], - }, }, Platform.SELECT: { - "running_status": { - "options": { - "off": {"power": "off", "running_status": "off"}, - "standby": {"power": "on", "running_status": "standby"}, - "start": {"power": "on", "running_status": "start"}, - "pause": {"power": "on", "running_status": "pause"}, - "end": {"power": "on", "running_status": "end"}, - "fault": {"power": "on", "running_status": "fault"}, - "delay": {"power": "on", "running_status": "delay"} - } - }, "dehydration_speed": { "options": { "0": {"dehydration_speed": "0"}, @@ -327,6 +244,9 @@ DEVICE_MAPPING = { } }, Platform.SENSOR: { + "running_status": { + "device_class": SensorDeviceClass.ENUM + }, "wash_time": { "device_class": SensorDeviceClass.DURATION, "unit_of_measurement": UnitOfTime.MINUTES, @@ -353,44 +273,11 @@ DEVICE_MAPPING = { "unit_of_measurement": "%", "state_class": SensorStateClass.MEASUREMENT }, - "cloud_cycle_low": { - "device_class": SensorDeviceClass.ENUM - }, - "cloud_cycle_high": { - "device_class": SensorDeviceClass.ENUM - }, - "cloud_cycle_jiepai1": { - "device_class": SensorDeviceClass.ENUM - }, - "cloud_cycle_jiepai2": { - "device_class": SensorDeviceClass.ENUM - }, - "cloud_cycle_jiepai3": { - "device_class": SensorDeviceClass.ENUM - }, - "cloud_cycle_jiepai4": { - "device_class": SensorDeviceClass.ENUM - }, - "cloud_cycle_jiepai_time1": { - "device_class": SensorDeviceClass.DURATION, - "unit_of_measurement": UnitOfTime.MINUTES, - "state_class": SensorStateClass.MEASUREMENT - }, "dehydration_time_value": { "device_class": SensorDeviceClass.DURATION, "unit_of_measurement": UnitOfTime.MINUTES, "state_class": SensorStateClass.MEASUREMENT }, - "cloud_cycle_jiepai_time3": { - "device_class": SensorDeviceClass.DURATION, - "unit_of_measurement": UnitOfTime.MINUTES, - "state_class": SensorStateClass.MEASUREMENT - }, - "cloud_cycle_jiepai_time4": { - "device_class": SensorDeviceClass.DURATION, - "unit_of_measurement": UnitOfTime.MINUTES, - "state_class": SensorStateClass.MEASUREMENT - }, "customize_machine_cycle": { "device_class": SensorDeviceClass.ENUM }, @@ -416,9 +303,6 @@ DEVICE_MAPPING = { "unit_of_measurement": UnitOfTime.MINUTES, "state_class": SensorStateClass.MEASUREMENT }, - "device_software_version": { - "device_class": SensorDeviceClass.ENUM - }, "expert_step": { "device_class": SensorDeviceClass.ENUM }, diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xDC.py b/custom_components/midea_auto_cloud/device_mapping/T0xDC.py index 4e657d1..cdd1093 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xDC.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xDC.py @@ -7,14 +7,15 @@ DEVICE_MAPPING = { "default": { "rationale": ["off", "on"], "queries": [{}], - "centralized": [ - "power", "ai_switch", "light", "appointment", "prevent_wrinkle_switch", - "steam_switch", "damp_dry_signal", "eco_dry_switch", "bucket_clean_switch", - "water_box", "baby_lock", "remind_sound", "steam", "prevent_wrinkle", - "material", "sterilize", "dryness_level", "dry_temp", "intensity", "program" - ], + "centralized": [], "entities": { Platform.SWITCH: { + "power": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "control_status": { + "rationale": ["pause", "start"], + }, "ai_switch": { "device_class": SwitchDeviceClass.SWITCH, "rationale": [0, 1] @@ -23,10 +24,6 @@ DEVICE_MAPPING = { "device_class": SwitchDeviceClass.SWITCH, "rationale": [0, 1] }, - "appointment": { - "device_class": SwitchDeviceClass.SWITCH, - "rationale": [0, 1] - }, "prevent_wrinkle_switch": { "device_class": SwitchDeviceClass.SWITCH, "rationale": [0, 1] @@ -63,9 +60,6 @@ DEVICE_MAPPING = { "device_class": SwitchDeviceClass.SWITCH, "rationale": [0, 1] }, - "power": { - "device_class": SwitchDeviceClass.SWITCH, - } }, Platform.BINARY_SENSOR: { "door_warn": { @@ -73,61 +67,68 @@ DEVICE_MAPPING = { } }, Platform.SELECT: { - "prevent_wrinkle": { - "options": { - "off": {"prevent_wrinkle": "0"}, - "low": {"prevent_wrinkle": "1"}, - "medium": {"prevent_wrinkle": "2"}, - "high": {"prevent_wrinkle": "3"} - } - }, - "material": { - "options": { - "cotton": {"material": "0"}, - "synthetic": {"material": "1"}, - "wool": {"material": "2"}, - "delicate": {"material": "3"}, - "mixed": {"material": "4"} - } - }, - "sterilize": { - "options": { - "off": {"sterilize": "0"}, - "on": {"sterilize": "1"} - } - }, - "dryness_level": { - "options": { - "extra_dry": {"dryness_level": "0"}, - "dry": {"dryness_level": "1"}, - "normal": {"dryness_level": "2"}, - "damp": {"dryness_level": "3"} - } - }, - "dry_temp": { - "options": { - "low": {"dry_temp": "0"}, - "medium": {"dry_temp": "1"}, - "high": {"dry_temp": "2"}, - "extra_high": {"dry_temp": "3"} - } - }, - "intensity": { - "options": { - "low": {"intensity": "0"}, - "medium": {"intensity": "1"}, - "high": {"intensity": "2"} - } - }, "program": { "options": { - "mixed_wash": {"program": "mixed_wash"}, "cotton": {"program": "cotton"}, - "synthetic": {"program": "synthetic"}, + "fiber": {"program": "fiber"}, + "mixed_wash": {"program": "mixed_wash"}, + "jean": {"program": "jean"}, + "bedsheet": {"program": "bedsheet"}, + "outdoor": {"program": "outdoor"}, + "down_jacket": {"program": "down_jacket"}, + "plush": {"program": "plush"}, "wool": {"program": "wool"}, - "delicate": {"program": "delicate"}, - "quick": {"program": "quick"}, - "eco": {"program": "eco"} + "dehumidify": {"program": "dehumidify"}, + "cold_air_fresh_air": {"program": "cold_air_fresh_air"}, + "hot_air_dry": {"program": "hot_air_dry"}, + "sport_clothes": {"program": "sport_clothes"}, + "underwear": {"program": "underwear"}, + "baby_clothes": {"program": "baby_clothes"}, + "shirt": {"program": "shirt"}, + "standard": {"program": "standard"}, + "quick_dry": {"program": "quick_dry"}, + "fresh_air": {"program": "fresh_air"}, + "low_temp_dry": {"program": "low_temp_dry"}, + "eco_dry": {"program": "eco_dry"}, + "quick_dry_30": {"program": "quick_dry_30"}, + "towel": {"program": "towel"}, + "intelligent_dry": {"program": "intelligent_dry"}, + "steam_care": {"program": "steam_care"}, + "big": {"program": "big"}, + "fixed_time_dry": {"program": "fixed_time_dry"}, + "night_dry": {"program": "night_dry"}, + "bracket_dry": {"program": "bracket_dry"}, + "western_trouser": {"program": "western_trouser"}, + "dehumidification": {"program": "dehumidification"}, + "smart_dry": {"program": "smart_dry"}, + "four_piece_suit": {"program": "four_piece_suit"}, + "warm_clothes": {"program": "warm_clothes"}, + "quick_dry_20": {"program": "quick_dry_20"}, + "steam_sterilize": {"program": "steam_sterilize"}, + "enzyme": {"program": "enzyme"}, + "big_60": {"program": "big_60"}, + "steam_no_iron": {"program": "steam_no_iron"}, + "air_wash": {"program": "air_wash"}, + "bed_clothes": {"program": "bed_clothes"}, + "little_fast_dry": {"program": "little_fast_dry"}, + "small_piece_dry": {"program": "small_piece_dry"}, + "big_dry": {"program": "big_dry"}, + "wool_nurse": {"program": "wool_nurse"}, + "sun_quilt": {"program": "sun_quilt"}, + "fresh_remove_smell": {"program": "fresh_remove_smell"}, + "bucket_self_clean": {"program": "bucket_self_clean"}, + "silk": {"program": "silk"}, + "sterilize": {"program": "sterilize"}, + "heavy_duty": {"program": "heavy_duty"}, + "towel_warmer": {"program": "towel_warmer"}, + "air_fluff": {"program": "air_fluff"}, + "delicates": {"program": "delicates"}, + "time_drying_30": {"program": "time_drying_30"}, + "time_drying_60": {"program": "time_drying_60"}, + "time_drying_90": {"program": "time_drying_90"}, + "dry_softnurse": {"program": "dry_softnurse"}, + "uniforms": {"program": "uniforms"}, + "remove_electricity": {"program": "remove_electricity"} } } }, diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xE3.py b/custom_components/midea_auto_cloud/device_mapping/T0xE3.py index be71f74..b9b163d 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xE3.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xE3.py @@ -17,6 +17,7 @@ DEVICE_MAPPING = { Platform.SWITCH: { "bubble": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1] }, "cold_water": { "device_class": SwitchDeviceClass.SWITCH, diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index bc1b0af..bc93080 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -123,6 +123,18 @@ }, "entity": { "binary_sensor": { + "softener_lack": { + "name": "Softener Lack" + }, + "detergent_lack": { + "name": "Detergent Lack" + }, + "door_opened": { + "name": "Door Opened" + }, + "bucket_water_overheating": { + "name": "Bucket Water Overheating" + }, "air_status": { "name": "Air Running" }, @@ -1445,6 +1457,9 @@ } }, "switch": { + "control_status": { + "name": "Start Pause" + }, "add_water_flag": { "name": "Add Water Flag" }, @@ -1652,9 +1667,6 @@ "bucket_clean_switch": { "name": "Bucket Clean Switch" }, - "bucket_water_overheating": { - "name": "Bucket Water Overheating" - }, "buzzer": { "name": "Buzzer" }, @@ -1736,9 +1748,6 @@ "defrost_state": { "name": "Defrost State" }, - "detergent_lack": { - "name": "Detergent Lack" - }, "disinfect_on_off": { "name": "Disinfect On Off" }, @@ -1751,9 +1760,6 @@ "door_middlestair": { "name": "Door Middle Stair" }, - "door_opened": { - "name": "Door Opened" - }, "door_upstair": { "name": "Door Up Stair" }, @@ -2009,9 +2015,6 @@ "soften": { "name": "Soften" }, - "softener_lack": { - "name": "Softener Lack" - }, "speedy": { "name": "Speedy" }, diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index 4eac9d1..543c272 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -198,6 +198,18 @@ "door_status": { "name": "门状态" }, + "softener_lack": { + "name": "柔顺剂不足" + }, + "detergent_lack": { + "name": "洗涤剂不足" + }, + "door_opened": { + "name": "门已打开" + }, + "bucket_water_overheating": { + "name": "桶内水温过热" + }, "ele_exception": { "name": "电气异常" }, @@ -1625,6 +1637,9 @@ "ai_switch": { "name": "AI开关" }, + "control_status": { + "name": "启停" + }, "airdry_on_off": { "name": "风干开关" }, @@ -1652,9 +1667,6 @@ "bucket_clean_switch": { "name": "桶清洁开关" }, - "bucket_water_overheating": { - "name": "桶内水温过热" - }, "buzzer": { "name": "蜂鸣器" }, @@ -1736,9 +1748,6 @@ "defrost_state": { "name": "除霜状态" }, - "detergent_lack": { - "name": "洗涤剂不足" - }, "disinfect_on_off": { "name": "消毒开关" }, @@ -1751,9 +1760,6 @@ "door_middlestair": { "name": "中层门" }, - "door_opened": { - "name": "门已打开" - }, "door_upstair": { "name": "上层门" }, @@ -2009,9 +2015,6 @@ "soften": { "name": "软化" }, - "softener_lack": { - "name": "柔顺剂不足" - }, "speedy": { "name": "快速" },