From 848a0869776513a8d9c481937b1813d07937cfed Mon Sep 17 00:00:00 2001 From: sususweet Date: Tue, 30 Sep 2025 17:12:35 +0800 Subject: [PATCH] fix: device control of T0xD9 --- .../midea_auto_cloud/core/device.py | 2 +- .../midea_auto_cloud/core/lua_runtime.py | 15 +- .../midea_auto_cloud/device_mapping/T0xD9.py | 180 +++++++------ .../midea_auto_cloud/device_mapping/T0xDB.py | 254 +++++++++++------- custom_components/midea_auto_cloud/select.py | 10 +- custom_components/midea_auto_cloud/switch.py | 1 - .../midea_auto_cloud/translations/en.json | 9 + .../translations/zh-Hans.json | 9 + 8 files changed, 305 insertions(+), 175 deletions(-) diff --git a/custom_components/midea_auto_cloud/core/device.py b/custom_components/midea_auto_cloud/core/device.py index 7f3f103..e799788 100644 --- a/custom_components/midea_auto_cloud/core/device.py +++ b/custom_components/midea_auto_cloud/core/device.py @@ -77,7 +77,7 @@ class MiedaDevice(threading.Thread): self._centralized = [] self._calculate_get = [] self._calculate_set = [] - self._lua_runtime = MideaCodec(lua_file, sn=sn, subtype=subtype) if lua_file is not None else None + self._lua_runtime = MideaCodec(lua_file, device_type=self._attributes.get("device_type"), sn=sn, subtype=subtype) if lua_file is not None else None self._cloud = cloud @property diff --git a/custom_components/midea_auto_cloud/core/lua_runtime.py b/custom_components/midea_auto_cloud/core/lua_runtime.py index 1907ec7..d5a942a 100644 --- a/custom_components/midea_auto_cloud/core/lua_runtime.py +++ b/custom_components/midea_auto_cloud/core/lua_runtime.py @@ -26,8 +26,9 @@ class LuaRuntime: class MideaCodec(LuaRuntime): - def __init__(self, file, sn=None, subtype=None): + def __init__(self, file, device_type=None, sn=None, subtype=None): super().__init__(file) + self._device_type = device_type self._sn = sn self._subtype = subtype @@ -56,9 +57,21 @@ class MideaCodec(LuaRuntime): def build_control(self, append=None): query_dict = self._build_base_dict() query_dict["control"] = {} if append is None else append + # 针对T0xD9复式洗衣机特殊处理 + if self._device_type == "T0xD9": + control_keys = list(append.keys()) + if len(control_keys) > 0: + # 从第一个键名中提取前缀,例如从 'db_power' 中提取 'db' + first_key = control_keys[0] + prefix = first_key.split("_")[0] + query_dict["control"]["bucket"] = prefix + else: + query_dict["control"]["bucket"] = "db" json_str = json.dumps(query_dict) + MideaLogger.debug(f"LuaRuntime json_str {json_str}") try: result = self.json_to_data(json_str) + MideaLogger.debug(f"LuaRuntime Result {result}") return result except lupa.LuaError as e: MideaLogger.error(f"LuaRuntimeError in build_control {json_str}: {repr(e)}") diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xD9.py b/custom_components/midea_auto_cloud/device_mapping/T0xD9.py index bd5537c..173c9a9 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xD9.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xD9.py @@ -5,7 +5,7 @@ from homeassistant.components.switch import SwitchDeviceClass DEVICE_MAPPING = { "default": { - "rationale": [0, 1], + "rationale": ["off", "on"], "queries": [{}], "calculate": { "get": [ @@ -18,110 +18,135 @@ DEVICE_MAPPING = { } }, "entities": { - Platform.SWITCH: { + Platform.BINARY_SENSOR: { "db_power": { - "device_class": SwitchDeviceClass.SWITCH, + "device_class": BinarySensorDeviceClass.RUNNING, }, + }, + Platform.SWITCH: { "db_clean_notification": { "device_class": SwitchDeviceClass.SWITCH, - }, - "db_softener_needed": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "db_detergent_needed": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "db_nightly_wash": { - "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1], }, "db_baby_lock": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1], }, "db_light": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1], }, "db_steam_wash": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1], }, "db_fast_clean_wash": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1], }, "db_wash_dry_link": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1], } }, Platform.SELECT: { "db_running_status": { "options": { - "stop": {"db_running_status": "stop"}, - "start": {"db_running_status": "start"}, - "pause": {"db_running_status": "pause"}, - "finish": {"db_running_status": "finish"}, - "error": {"db_running_status": "error"} + "off": {"db_power": "off", "db_running_status": "off"}, + "standby": {"db_power": "on", "db_running_status": "standby"}, + "start": {"db_power": "on", "db_running_status": "start"}, + "pause": {"db_power": "on", "db_running_status": "pause"}, + "end": {"db_power": "on", "db_running_status": "end"}, + "fault": {"db_power": "on", "db_running_status": "fault"}, + "delay": {"db_power": "on", "db_running_status": "delay"} } }, "db_program": { "options": { - "fast_wash_30": {"db_program": "fast_wash_30"}, - "normal_wash": {"db_program": "normal_wash"}, - "heavy_wash": {"db_program": "heavy_wash"}, - "delicate_wash": {"db_program": "delicate_wash"}, + "cotton": {"db_program": "cotton"}, + "eco": {"db_program": "eco"}, + "fast_wash": {"db_program": "fast_wash"}, + "mixed_wash": {"db_program": "mixed_wash"}, + "wool": {"db_program": "wool"}, + "ssp": {"db_program": "ssp"}, + "sport_clothes": {"db_program": "sport_clothes"}, + "single_dehytration": {"db_program": "single_dehytration"}, + "rinsing_dehydration": {"db_program": "rinsing_dehydration"}, + "big": {"db_program": "big"}, + "baby_clothes": {"db_program": "baby_clothes"}, + "down_jacket": {"db_program": "down_jacket"}, + "color": {"db_program": "color"}, + "intelligent": {"db_program": "intelligent"}, "quick_wash": {"db_program": "quick_wash"}, - "eco_wash": {"db_program": "eco_wash"} - } - }, - "db_water_level": { - "options": { - "low": {"db_water_level": "1"}, - "medium": {"db_water_level": "2"}, - "high": {"db_water_level": "3"}, - "extra_high": {"db_water_level": "4"} - } - }, - "db_temperature": { - "options": { - "cold": {"db_temperature": "1"}, - "warm": {"db_temperature": "2"}, - "hot": {"db_temperature": "3"}, - "extra_hot": {"db_temperature": "4"} - } - }, - "dehydration_speed": { - "options": { - "low": {"dehydration_speed": "1"}, - "medium": {"dehydration_speed": "2"}, - "high": {"dehydration_speed": "3"}, - "extra_high": {"dehydration_speed": "4"} - } - }, - "db_detergent": { - "options": { - "none": {"db_detergent": "1"}, - "little": {"db_detergent": "2"}, - "normal": {"db_detergent": "3"}, - "more": {"db_detergent": "4"} - } - }, - "db_softener": { - "options": { - "none": {"db_softener": "1"}, - "little": {"db_softener": "2"}, - "normal": {"db_softener": "3"}, - "more": {"db_softener": "4"} - } - }, - "db_position": { - "options": { - "position_1": {"db_position": "1"}, - "position_2": {"db_position": "2"}, - "position_3": {"db_position": "3"} - } - }, - "db_location": { - "options": { - "location_1": {"db_location": "1"}, - "location_2": {"db_location": "2"}, - "location_3": {"db_location": "3"} + "shirt": {"db_program": "shirt"}, + "fiber": {"db_program": "fiber"}, + "enzyme": {"db_program": "enzyme"}, + "underwear": {"db_program": "underwear"}, + "outdoor": {"db_program": "outdoor"}, + "air_wash": {"db_program": "air_wash"}, + "single_drying": {"db_program": "single_drying"}, + "steep": {"db_program": "steep"}, + "kids": {"db_program": "kids"}, + "water_baby_clothes": {"db_program": "water_baby_clothes"}, + "fast_wash_30": {"db_program": "fast_wash_30"}, + "water_shirt": {"db_program": "water_shirt"}, + "water_mixed_wash": {"db_program": "water_mixed_wash"}, + "water_fiber": {"db_program": "water_fiber"}, + "water_kids": {"db_program": "water_kids"}, + "water_underwear": {"db_program": "water_underwear"}, + "specialist": {"db_program": "specialist"}, + "love": {"db_program": "love"}, + "water_intelligent": {"db_program": "water_intelligent"}, + "water_steep": {"db_program": "water_steep"}, + "water_fast_wash_30": {"db_program": "water_fast_wash_30"}, + "new_water_cotton": {"db_program": "new_water_cotton"}, + "water_eco": {"db_program": "water_eco"}, + "wash_drying_60": {"db_program": "wash_drying_60"}, + "self_wash_5": {"db_program": "self_wash_5"}, + "fast_wash_min": {"db_program": "fast_wash_min"}, + "mixed_wash_min": {"db_program": "mixed_wash_min"}, + "dehydration_min": {"db_program": "dehydration_min"}, + "self_wash_min": {"db_program": "self_wash_min"}, + "baby_clothes_min": {"db_program": "baby_clothes_min"}, + "silk_wash": {"db_program": "silk_wash"}, + "prevent_allergy": {"db_program": "prevent_allergy"}, + "cold_wash": {"db_program": "cold_wash"}, + "soft_wash": {"db_program": "soft_wash"}, + "remove_mite_wash": {"db_program": "remove_mite_wash"}, + "water_intense_wash": {"db_program": "water_intense_wash"}, + "fast_dry": {"db_program": "fast_dry"}, + "water_outdoor": {"db_program": "water_outdoor"}, + "spring_autumn_wash": {"db_program": "spring_autumn_wash"}, + "summer_wash": {"db_program": "summer_wash"}, + "winter_wash": {"db_program": "winter_wash"}, + "jean": {"db_program": "jean"}, + "new_clothes_wash": {"db_program": "new_clothes_wash"}, + "silk": {"db_program": "silk"}, + "insight_wash": {"db_program": "insight_wash"}, + "fitness_clothes": {"db_program": "fitness_clothes"}, + "mink": {"db_program": "mink"}, + "fresh_air": {"db_program": "fresh_air"}, + "bucket_dry": {"db_program": "bucket_dry"}, + "jacket": {"db_program": "jacket"}, + "bath_towel": {"db_program": "bath_towel"}, + "night_fresh_wash": {"db_program": "night_fresh_wash"}, + "degerm": {"db_program": "degerm"}, + "heart_wash": {"db_program": "heart_wash"}, + "water_cold_wash": {"db_program": "water_cold_wash"}, + "water_prevent_allergy": {"db_program": "water_prevent_allergy"}, + "water_remove_mite_wash": {"db_program": "water_remove_mite_wash"}, + "water_ssp": {"db_program": "water_ssp"}, + "standard": {"db_program": "standard"}, + "green_wool": {"db_program": "green_wool"}, + "cook_wash": {"db_program": "cook_wash"}, + "fresh_remove_wrinkle": {"db_program": "fresh_remove_wrinkle"}, + "steam_sterilize_wash": {"db_program": "steam_sterilize_wash"}, + "sterilize_wash": {"db_program": "sterilize_wash"}, + "white_clothes_clean": {"db_program": "white_clothes_clean"}, + "clean_stains": {"db_program": "clean_stains"}, + "prevent_cross_color": {"db_program": "prevent_cross_color"}, + "quick_dry_clothes": {"db_program": "quick_dry_clothes"}, + "yoga_clothes": {"db_program": "yoga_clothes"} } } }, @@ -149,9 +174,6 @@ DEVICE_MAPPING = { "unit_of_measurement": UnitOfTime.MINUTES, "state_class": SensorStateClass.MEASUREMENT }, - "db_device_software_version": { - "device_class": SensorDeviceClass.ENUM - }, "db_rinse_count": { "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 4187eb7..68b7840 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xDB.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xDB.py @@ -5,7 +5,7 @@ from homeassistant.components.switch import SwitchDeviceClass DEVICE_MAPPING = { "default": { - "rationale": [0, 1], + "rationale": ["off", "on"], "queries": [{}], "calculate": { "get": [ @@ -18,10 +18,12 @@ DEVICE_MAPPING = { } }, "entities": { - Platform.SWITCH: { + Platform.BINARY_SENSOR: { "power": { - "device_class": SwitchDeviceClass.SWITCH, + "device_class": BinarySensorDeviceClass.RUNNING, }, + }, + Platform.SWITCH: { "softener_lack": { "device_class": SwitchDeviceClass.SWITCH, }, @@ -66,6 +68,7 @@ DEVICE_MAPPING = { }, "silent": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": ["0", "1"], }, "speedy": { "device_class": SwitchDeviceClass.SWITCH, @@ -108,151 +111,218 @@ DEVICE_MAPPING = { }, "ultraviolet_lamp": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": ["0", "1"], }, "eye_wash": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": ["0", "1"], }, "microbubble": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": ["0", "1"], }, "wind_dispel": { "device_class": SwitchDeviceClass.SWITCH, + "rationale": ["0", "1"], }, "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": { - "standby": {"running_status": "standby"}, - "running": {"running_status": "running"}, - "pause": {"running_status": "pause"}, - "finish": {"running_status": "finish"}, - "error": {"running_status": "error"} + "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"} } }, - "db_dehydration_speed": { + "dehydration_speed": { "options": { - "low": {"db_dehydration_speed": "1"}, - "medium": {"db_dehydration_speed": "2"}, - "high": {"db_dehydration_speed": "3"}, - "extra_high": {"db_dehydration_speed": "4"} + "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"}, - "eco": {"mode": "eco"}, - "quick": {"mode": "quick"}, - "heavy": {"mode": "heavy"}, - "delicate": {"mode": "delicate"} + "factory_test": {"mode": "factory_test"}, + "service": {"mode": "service"}, + "normal_continus": {"mode": "normal_continus"} } }, "water_level": { "options": { "low": {"water_level": "low"}, - "medium": {"water_level": "medium"}, + "medium": {"water_level": "mid"}, "high": {"water_level": "high"}, - "extra_high": {"water_level": "extra_high"} + "auto": {"water_level": "auto"} } }, "program": { "options": { - "ssp": {"program": "ssp"}, "cotton": {"program": "cotton"}, - "synthetic": {"program": "synthetic"}, + "eco": {"program": "eco"}, + "fast_wash": {"program": "fast_wash"}, + "mixed_wash": {"program": "mixed_wash"}, "wool": {"program": "wool"}, - "delicate": {"program": "delicate"}, - "quick": {"program": "quick"} + "ssp": {"program": "ssp"}, + "sport_clothes": {"program": "sport_clothes"}, + "single_dehytration": {"program": "single_dehytration"}, + "rinsing_dehydration": {"program": "rinsing_dehydration"}, + "big": {"program": "big"}, + "baby_clothes": {"program": "baby_clothes"}, + "down_jacket": {"program": "down_jacket"}, + "color": {"program": "color"}, + "intelligent": {"program": "intelligent"}, + "quick_wash": {"program": "quick_wash"}, + "shirt": {"program": "shirt"}, + "fiber": {"program": "fiber"}, + "enzyme": {"program": "enzyme"}, + "underwear": {"program": "underwear"}, + "outdoor": {"program": "outdoor"}, + "air_wash": {"program": "air_wash"}, + "single_drying": {"program": "single_drying"}, + "steep": {"program": "steep"}, + "kids": {"program": "kids"}, + "water_cotton": {"program": "water_cotton"}, + "fast_wash_30": {"program": "fast_wash_30"}, + "fast_wash_60": {"program": "fast_wash_60"}, + "water_mixed_wash": {"program": "water_mixed_wash"}, + "water_fiber": {"program": "water_fiber"}, + "water_kids": {"program": "water_kids"}, + "water_underwear": {"program": "water_underwear"}, + "specialist": {"program": "specialist"}, + "love": {"program": "love"}, + "water_intelligent": {"program": "water_intelligent"}, + "water_steep": {"program": "water_steep"}, + "water_fast_wash_30": {"program": "water_fast_wash_30"}, + "new_water_cotton": {"program": "new_water_cotton"}, + "water_eco": {"program": "water_eco"}, + "wash_drying_60": {"program": "wash_drying_60"}, + "self_wash_5": {"program": "self_wash_5"}, + "fast_wash_min": {"program": "fast_wash_min"}, + "mixed_wash_min": {"program": "mixed_wash_min"}, + "dehydration_min": {"program": "dehydration_min"}, + "self_wash_min": {"program": "self_wash_min"}, + "baby_clothes_min": {"program": "baby_clothes_min"}, + "diy0": {"program": "diy0"}, + "diy1": {"program": "diy1"}, + "diy2": {"program": "diy2"}, + "silk_wash": {"program": "silk_wash"}, + "prevent_allergy": {"program": "prevent_allergy"}, + "cold_wash": {"program": "cold_wash"}, + "soft_wash": {"program": "soft_wash"}, + "remove_mite_wash": {"program": "remove_mite_wash"}, + "water_intense_wash": {"program": "water_intense_wash"}, + "fast_dry": {"program": "fast_dry"}, + "water_outdoor": {"program": "water_outdoor"}, + "spring_autumn_wash": {"program": "spring_autumn_wash"}, + "summer_wash": {"program": "summer_wash"}, + "winter_wash": {"program": "winter_wash"}, + "jean": {"program": "jean"}, + "new_clothes_wash": {"program": "new_clothes_wash"}, + "silk": {"program": "silk"}, + "insight_wash": {"program": "insight_wash"}, + "fitness_clothes": {"program": "fitness_clothes"}, + "mink": {"program": "mink"}, + "fresh_air": {"program": "fresh_air"}, + "bucket_dry": {"program": "bucket_dry"}, + "jacket": {"program": "jacket"}, + "bath_towel": {"program": "bath_towel"}, + "night_fresh_wash": {"program": "night_fresh_wash"}, + "heart_wash": {"program": "heart_wash"}, + "water_cold_wash": {"program": "water_cold_wash"}, + "water_prevent_allergy": {"program": "water_prevent_allergy"}, + "water_remove_mite_wash": {"program": "water_remove_mite_wash"}, + "water_ssp": {"program": "water_ssp"}, + "standard": {"program": "standard"}, + "green_wool": {"program": "green_wool"}, + "cook_wash": {"program": "cook_wash"}, + "fresh_remove_wrinkle": {"program": "fresh_remove_wrinkle"}, + "steam_sterilize_wash": {"program": "steam_sterilize_wash"}, + "aromatherapy": {"program": "aromatherapy"}, + "sterilize_wash": {"program": "sterilize_wash"}, + "white_clothes_clean": {"program": "white_clothes_clean"}, + "clean_stains": {"program": "clean_stains"}, + "tube_clean_all": {"program": "tube_clean_all"}, + "no_channeling_color": {"program": "no_channeling_color"}, + "scald_wash": {"program": "scald_wash"}, + "hanfu_spring_summer": {"program": "hanfu_spring_summer"}, + "hanfu_autumn_winter": {"program": "hanfu_autumn_winter"}, + "skin_care_wash": {"program": "skin_care_wash"}, + "hanfu_wash": {"program": "hanfu_wash"} } }, "temperature": { "options": { - "cold": {"temperature": "cold"}, - "warm": {"temperature": "warm"}, - "hot": {"temperature": "hot"}, - "extra_hot": {"temperature": "extra_hot"} - } - }, - "detergent_density": { - "options": { - "low": {"detergent_density": "low"}, - "medium": {"detergent_density": "medium"}, - "high": {"detergent_density": "high"}, - "extra_high": {"detergent_density": "extra_high"} - } - }, - "softener_density": { - "options": { - "low": {"softener_density": "low"}, - "medium": {"softener_density": "medium"}, - "high": {"softener_density": "high"}, - "extra_high": {"softener_density": "extra_high"} + "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": { - "none": {"detergent": "none"}, - "little": {"detergent": "little"}, - "normal": {"detergent": "normal"}, - "more": {"detergent": "more"} + "0": {"detergent": "0"}, + "1": {"detergent": "1"}, + "2": {"detergent": "2"}, + "3": {"detergent": "3"}, + "4": {"detergent": "4"}, + "5": {"detergent": "5"} } }, "softener": { "options": { - "none": {"softener": "none"}, - "little": {"softener": "little"}, - "normal": {"softener": "normal"}, - "more": {"softener": "more"} - } - }, - "season": { - "options": { - "spring": {"season": "spring"}, - "summer": {"season": "summer"}, - "autumn": {"season": "autumn"}, - "winter": {"season": "winter"} - } - }, - "disinfectant": { - "options": { - "none": {"disinfectant": "none"}, - "light": {"disinfectant": "light"}, - "medium": {"disinfectant": "medium"}, - "strong": {"disinfectant": "strong"} + "0": {"softener": "0"}, + "1": {"softener": "1"}, + "2": {"softener": "2"}, + "3": {"softener": "3"}, + "4": {"softener": "4"}, + "5": {"softener": "5"} } }, "dirty_degree": { "options": { - "light": {"dirty_degree": "light"}, - "medium": {"dirty_degree": "medium"}, - "heavy": {"dirty_degree": "heavy"}, - "extra_heavy": {"dirty_degree": "extra_heavy"} - } - }, - "stains": { - "options": { - "none": {"stains": "none"}, - "light": {"stains": "light"}, - "medium": {"stains": "medium"}, - "heavy": {"stains": "heavy"} - } - }, - "add_rinse": { - "options": { - "none": {"add_rinse": "none"}, - "one": {"add_rinse": "one"}, - "two": {"add_rinse": "two"}, - "three": {"add_rinse": "three"} + "0": {"dirty_degree": "0"}, + "1": {"dirty_degree": "1"}, + "2": {"dirty_degree": "2"}, + "3": {"dirty_degree": "3"}, + "4": {"dirty_degree": "4"} } }, "soak_count": { "options": { - "none": {"soak_count": "none"}, - "one": {"soak_count": "one"}, - "two": {"soak_count": "two"}, - "three": {"soak_count": "three"} + "0": {"soak_count": "0"}, + "1": {"soak_count": "1"}, + "2": {"soak_count": "2"}, + "3": {"soak_count": "3"}, + "4": {"soak_count": "4"}, + "5": {"soak_count": "5"} } } }, diff --git a/custom_components/midea_auto_cloud/select.py b/custom_components/midea_auto_cloud/select.py index 02c734f..fe209c9 100644 --- a/custom_components/midea_auto_cloud/select.py +++ b/custom_components/midea_auto_cloud/select.py @@ -1,11 +1,19 @@ from homeassistant.components.select import SelectEntity +from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback + from .const import DOMAIN from .midea_entity import MideaEntity from . import load_device_config -async def async_setup_entry(hass, config_entry, async_add_entities): +async def async_setup_entry( + hass: HomeAssistant, + config_entry: ConfigEntry, + async_add_entities: AddEntitiesCallback, +) -> None: account_bucket = hass.data.get(DOMAIN, {}).get("accounts", {}).get(config_entry.entry_id) if not account_bucket: async_add_entities([]) diff --git a/custom_components/midea_auto_cloud/switch.py b/custom_components/midea_auto_cloud/switch.py index 41d6952..6e5f3ee 100644 --- a/custom_components/midea_auto_cloud/switch.py +++ b/custom_components/midea_auto_cloud/switch.py @@ -5,7 +5,6 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import DOMAIN -from .core.logger import MideaLogger from .midea_entity import MideaEntity from . import load_device_config diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index 2405fb8..3045e01 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -335,6 +335,15 @@ }, "gear": { "name": "Gear" + }, + "detergent": { + "name": "Detergent" + }, + "softener": { + "name": "Softener" + }, + "temperature": { + "name": "Temperature" } }, "sensor": { diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index ac4e0e1..b811d98 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -524,6 +524,15 @@ }, "gear": { "name": "档位" + }, + "detergent": { + "name": "洗涤剂" + }, + "softener": { + "name": "柔顺剂" + }, + "temperature": { + "name": "温度" } }, "sensor": {