mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-11-12 16:01:54 +00:00
fix: device control of T0xD9
This commit is contained in:
@@ -77,7 +77,7 @@ class MiedaDevice(threading.Thread):
|
|||||||
self._centralized = []
|
self._centralized = []
|
||||||
self._calculate_get = []
|
self._calculate_get = []
|
||||||
self._calculate_set = []
|
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
|
self._cloud = cloud
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ class LuaRuntime:
|
|||||||
|
|
||||||
|
|
||||||
class MideaCodec(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)
|
super().__init__(file)
|
||||||
|
self._device_type = device_type
|
||||||
self._sn = sn
|
self._sn = sn
|
||||||
self._subtype = subtype
|
self._subtype = subtype
|
||||||
|
|
||||||
@@ -56,9 +57,21 @@ class MideaCodec(LuaRuntime):
|
|||||||
def build_control(self, append=None):
|
def build_control(self, append=None):
|
||||||
query_dict = self._build_base_dict()
|
query_dict = self._build_base_dict()
|
||||||
query_dict["control"] = {} if append is None else append
|
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)
|
json_str = json.dumps(query_dict)
|
||||||
|
MideaLogger.debug(f"LuaRuntime json_str {json_str}")
|
||||||
try:
|
try:
|
||||||
result = self.json_to_data(json_str)
|
result = self.json_to_data(json_str)
|
||||||
|
MideaLogger.debug(f"LuaRuntime Result {result}")
|
||||||
return result
|
return result
|
||||||
except lupa.LuaError as e:
|
except lupa.LuaError as e:
|
||||||
MideaLogger.error(f"LuaRuntimeError in build_control {json_str}: {repr(e)}")
|
MideaLogger.error(f"LuaRuntimeError in build_control {json_str}: {repr(e)}")
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from homeassistant.components.switch import SwitchDeviceClass
|
|||||||
|
|
||||||
DEVICE_MAPPING = {
|
DEVICE_MAPPING = {
|
||||||
"default": {
|
"default": {
|
||||||
"rationale": [0, 1],
|
"rationale": ["off", "on"],
|
||||||
"queries": [{}],
|
"queries": [{}],
|
||||||
"calculate": {
|
"calculate": {
|
||||||
"get": [
|
"get": [
|
||||||
@@ -18,110 +18,135 @@ DEVICE_MAPPING = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entities": {
|
"entities": {
|
||||||
Platform.SWITCH: {
|
Platform.BINARY_SENSOR: {
|
||||||
"db_power": {
|
"db_power": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": BinarySensorDeviceClass.RUNNING,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
Platform.SWITCH: {
|
||||||
"db_clean_notification": {
|
"db_clean_notification": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
},
|
"rationale": [0, 1],
|
||||||
"db_softener_needed": {
|
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
|
||||||
},
|
|
||||||
"db_detergent_needed": {
|
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
|
||||||
},
|
|
||||||
"db_nightly_wash": {
|
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
|
||||||
},
|
},
|
||||||
"db_baby_lock": {
|
"db_baby_lock": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": [0, 1],
|
||||||
},
|
},
|
||||||
"db_light": {
|
"db_light": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": [0, 1],
|
||||||
},
|
},
|
||||||
"db_steam_wash": {
|
"db_steam_wash": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": [0, 1],
|
||||||
},
|
},
|
||||||
"db_fast_clean_wash": {
|
"db_fast_clean_wash": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": [0, 1],
|
||||||
},
|
},
|
||||||
"db_wash_dry_link": {
|
"db_wash_dry_link": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": [0, 1],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Platform.SELECT: {
|
Platform.SELECT: {
|
||||||
"db_running_status": {
|
"db_running_status": {
|
||||||
"options": {
|
"options": {
|
||||||
"stop": {"db_running_status": "stop"},
|
"off": {"db_power": "off", "db_running_status": "off"},
|
||||||
"start": {"db_running_status": "start"},
|
"standby": {"db_power": "on", "db_running_status": "standby"},
|
||||||
"pause": {"db_running_status": "pause"},
|
"start": {"db_power": "on", "db_running_status": "start"},
|
||||||
"finish": {"db_running_status": "finish"},
|
"pause": {"db_power": "on", "db_running_status": "pause"},
|
||||||
"error": {"db_running_status": "error"}
|
"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": {
|
"db_program": {
|
||||||
"options": {
|
"options": {
|
||||||
"fast_wash_30": {"db_program": "fast_wash_30"},
|
"cotton": {"db_program": "cotton"},
|
||||||
"normal_wash": {"db_program": "normal_wash"},
|
"eco": {"db_program": "eco"},
|
||||||
"heavy_wash": {"db_program": "heavy_wash"},
|
"fast_wash": {"db_program": "fast_wash"},
|
||||||
"delicate_wash": {"db_program": "delicate_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"},
|
"quick_wash": {"db_program": "quick_wash"},
|
||||||
"eco_wash": {"db_program": "eco_wash"}
|
"shirt": {"db_program": "shirt"},
|
||||||
}
|
"fiber": {"db_program": "fiber"},
|
||||||
},
|
"enzyme": {"db_program": "enzyme"},
|
||||||
"db_water_level": {
|
"underwear": {"db_program": "underwear"},
|
||||||
"options": {
|
"outdoor": {"db_program": "outdoor"},
|
||||||
"low": {"db_water_level": "1"},
|
"air_wash": {"db_program": "air_wash"},
|
||||||
"medium": {"db_water_level": "2"},
|
"single_drying": {"db_program": "single_drying"},
|
||||||
"high": {"db_water_level": "3"},
|
"steep": {"db_program": "steep"},
|
||||||
"extra_high": {"db_water_level": "4"}
|
"kids": {"db_program": "kids"},
|
||||||
}
|
"water_baby_clothes": {"db_program": "water_baby_clothes"},
|
||||||
},
|
"fast_wash_30": {"db_program": "fast_wash_30"},
|
||||||
"db_temperature": {
|
"water_shirt": {"db_program": "water_shirt"},
|
||||||
"options": {
|
"water_mixed_wash": {"db_program": "water_mixed_wash"},
|
||||||
"cold": {"db_temperature": "1"},
|
"water_fiber": {"db_program": "water_fiber"},
|
||||||
"warm": {"db_temperature": "2"},
|
"water_kids": {"db_program": "water_kids"},
|
||||||
"hot": {"db_temperature": "3"},
|
"water_underwear": {"db_program": "water_underwear"},
|
||||||
"extra_hot": {"db_temperature": "4"}
|
"specialist": {"db_program": "specialist"},
|
||||||
}
|
"love": {"db_program": "love"},
|
||||||
},
|
"water_intelligent": {"db_program": "water_intelligent"},
|
||||||
"dehydration_speed": {
|
"water_steep": {"db_program": "water_steep"},
|
||||||
"options": {
|
"water_fast_wash_30": {"db_program": "water_fast_wash_30"},
|
||||||
"low": {"dehydration_speed": "1"},
|
"new_water_cotton": {"db_program": "new_water_cotton"},
|
||||||
"medium": {"dehydration_speed": "2"},
|
"water_eco": {"db_program": "water_eco"},
|
||||||
"high": {"dehydration_speed": "3"},
|
"wash_drying_60": {"db_program": "wash_drying_60"},
|
||||||
"extra_high": {"dehydration_speed": "4"}
|
"self_wash_5": {"db_program": "self_wash_5"},
|
||||||
}
|
"fast_wash_min": {"db_program": "fast_wash_min"},
|
||||||
},
|
"mixed_wash_min": {"db_program": "mixed_wash_min"},
|
||||||
"db_detergent": {
|
"dehydration_min": {"db_program": "dehydration_min"},
|
||||||
"options": {
|
"self_wash_min": {"db_program": "self_wash_min"},
|
||||||
"none": {"db_detergent": "1"},
|
"baby_clothes_min": {"db_program": "baby_clothes_min"},
|
||||||
"little": {"db_detergent": "2"},
|
"silk_wash": {"db_program": "silk_wash"},
|
||||||
"normal": {"db_detergent": "3"},
|
"prevent_allergy": {"db_program": "prevent_allergy"},
|
||||||
"more": {"db_detergent": "4"}
|
"cold_wash": {"db_program": "cold_wash"},
|
||||||
}
|
"soft_wash": {"db_program": "soft_wash"},
|
||||||
},
|
"remove_mite_wash": {"db_program": "remove_mite_wash"},
|
||||||
"db_softener": {
|
"water_intense_wash": {"db_program": "water_intense_wash"},
|
||||||
"options": {
|
"fast_dry": {"db_program": "fast_dry"},
|
||||||
"none": {"db_softener": "1"},
|
"water_outdoor": {"db_program": "water_outdoor"},
|
||||||
"little": {"db_softener": "2"},
|
"spring_autumn_wash": {"db_program": "spring_autumn_wash"},
|
||||||
"normal": {"db_softener": "3"},
|
"summer_wash": {"db_program": "summer_wash"},
|
||||||
"more": {"db_softener": "4"}
|
"winter_wash": {"db_program": "winter_wash"},
|
||||||
}
|
"jean": {"db_program": "jean"},
|
||||||
},
|
"new_clothes_wash": {"db_program": "new_clothes_wash"},
|
||||||
"db_position": {
|
"silk": {"db_program": "silk"},
|
||||||
"options": {
|
"insight_wash": {"db_program": "insight_wash"},
|
||||||
"position_1": {"db_position": "1"},
|
"fitness_clothes": {"db_program": "fitness_clothes"},
|
||||||
"position_2": {"db_position": "2"},
|
"mink": {"db_program": "mink"},
|
||||||
"position_3": {"db_position": "3"}
|
"fresh_air": {"db_program": "fresh_air"},
|
||||||
}
|
"bucket_dry": {"db_program": "bucket_dry"},
|
||||||
},
|
"jacket": {"db_program": "jacket"},
|
||||||
"db_location": {
|
"bath_towel": {"db_program": "bath_towel"},
|
||||||
"options": {
|
"night_fresh_wash": {"db_program": "night_fresh_wash"},
|
||||||
"location_1": {"db_location": "1"},
|
"degerm": {"db_program": "degerm"},
|
||||||
"location_2": {"db_location": "2"},
|
"heart_wash": {"db_program": "heart_wash"},
|
||||||
"location_3": {"db_location": "3"}
|
"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,
|
"unit_of_measurement": UnitOfTime.MINUTES,
|
||||||
"state_class": SensorStateClass.MEASUREMENT
|
"state_class": SensorStateClass.MEASUREMENT
|
||||||
},
|
},
|
||||||
"db_device_software_version": {
|
|
||||||
"device_class": SensorDeviceClass.ENUM
|
|
||||||
},
|
|
||||||
"db_rinse_count": {
|
"db_rinse_count": {
|
||||||
"device_class": SensorDeviceClass.ENUM
|
"device_class": SensorDeviceClass.ENUM
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from homeassistant.components.switch import SwitchDeviceClass
|
|||||||
|
|
||||||
DEVICE_MAPPING = {
|
DEVICE_MAPPING = {
|
||||||
"default": {
|
"default": {
|
||||||
"rationale": [0, 1],
|
"rationale": ["off", "on"],
|
||||||
"queries": [{}],
|
"queries": [{}],
|
||||||
"calculate": {
|
"calculate": {
|
||||||
"get": [
|
"get": [
|
||||||
@@ -18,10 +18,12 @@ DEVICE_MAPPING = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entities": {
|
"entities": {
|
||||||
Platform.SWITCH: {
|
Platform.BINARY_SENSOR: {
|
||||||
"power": {
|
"power": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": BinarySensorDeviceClass.RUNNING,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
Platform.SWITCH: {
|
||||||
"softener_lack": {
|
"softener_lack": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
},
|
},
|
||||||
@@ -66,6 +68,7 @@ DEVICE_MAPPING = {
|
|||||||
},
|
},
|
||||||
"silent": {
|
"silent": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": ["0", "1"],
|
||||||
},
|
},
|
||||||
"speedy": {
|
"speedy": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
@@ -108,151 +111,218 @@ DEVICE_MAPPING = {
|
|||||||
},
|
},
|
||||||
"ultraviolet_lamp": {
|
"ultraviolet_lamp": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": ["0", "1"],
|
||||||
},
|
},
|
||||||
"eye_wash": {
|
"eye_wash": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": ["0", "1"],
|
||||||
},
|
},
|
||||||
"microbubble": {
|
"microbubble": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": ["0", "1"],
|
||||||
},
|
},
|
||||||
"wind_dispel": {
|
"wind_dispel": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": ["0", "1"],
|
||||||
},
|
},
|
||||||
"cycle_memory": {
|
"cycle_memory": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
}
|
},
|
||||||
|
"disinfectant": {
|
||||||
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": ["0", "1"],
|
||||||
|
},
|
||||||
|
"add_rinse": {
|
||||||
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
"rationale": ["0", "1"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Platform.SELECT: {
|
Platform.SELECT: {
|
||||||
"running_status": {
|
"running_status": {
|
||||||
"options": {
|
"options": {
|
||||||
"standby": {"running_status": "standby"},
|
"off": {"power": "off", "running_status": "off"},
|
||||||
"running": {"running_status": "running"},
|
"standby": {"power": "on", "running_status": "standby"},
|
||||||
"pause": {"running_status": "pause"},
|
"start": {"power": "on", "running_status": "start"},
|
||||||
"finish": {"running_status": "finish"},
|
"pause": {"power": "on", "running_status": "pause"},
|
||||||
"error": {"running_status": "error"}
|
"end": {"power": "on", "running_status": "end"},
|
||||||
|
"fault": {"power": "on", "running_status": "fault"},
|
||||||
|
"delay": {"power": "on", "running_status": "delay"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"db_dehydration_speed": {
|
"dehydration_speed": {
|
||||||
"options": {
|
"options": {
|
||||||
"low": {"db_dehydration_speed": "1"},
|
"0": {"dehydration_speed": "0"},
|
||||||
"medium": {"db_dehydration_speed": "2"},
|
"400": {"dehydration_speed": "400"},
|
||||||
"high": {"db_dehydration_speed": "3"},
|
"600": {"dehydration_speed": "600"},
|
||||||
"extra_high": {"db_dehydration_speed": "4"}
|
"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": {
|
"mode": {
|
||||||
"options": {
|
"options": {
|
||||||
"normal": {"mode": "normal"},
|
"normal": {"mode": "normal"},
|
||||||
"eco": {"mode": "eco"},
|
"factory_test": {"mode": "factory_test"},
|
||||||
"quick": {"mode": "quick"},
|
"service": {"mode": "service"},
|
||||||
"heavy": {"mode": "heavy"},
|
"normal_continus": {"mode": "normal_continus"}
|
||||||
"delicate": {"mode": "delicate"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"water_level": {
|
"water_level": {
|
||||||
"options": {
|
"options": {
|
||||||
"low": {"water_level": "low"},
|
"low": {"water_level": "low"},
|
||||||
"medium": {"water_level": "medium"},
|
"medium": {"water_level": "mid"},
|
||||||
"high": {"water_level": "high"},
|
"high": {"water_level": "high"},
|
||||||
"extra_high": {"water_level": "extra_high"}
|
"auto": {"water_level": "auto"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"program": {
|
"program": {
|
||||||
"options": {
|
"options": {
|
||||||
"ssp": {"program": "ssp"},
|
|
||||||
"cotton": {"program": "cotton"},
|
"cotton": {"program": "cotton"},
|
||||||
"synthetic": {"program": "synthetic"},
|
"eco": {"program": "eco"},
|
||||||
|
"fast_wash": {"program": "fast_wash"},
|
||||||
|
"mixed_wash": {"program": "mixed_wash"},
|
||||||
"wool": {"program": "wool"},
|
"wool": {"program": "wool"},
|
||||||
"delicate": {"program": "delicate"},
|
"ssp": {"program": "ssp"},
|
||||||
"quick": {"program": "quick"}
|
"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": {
|
"temperature": {
|
||||||
"options": {
|
"options": {
|
||||||
"cold": {"temperature": "cold"},
|
"0": {"temperature": "0"},
|
||||||
"warm": {"temperature": "warm"},
|
"20": {"temperature": "20"},
|
||||||
"hot": {"temperature": "hot"},
|
"30": {"temperature": "30"},
|
||||||
"extra_hot": {"temperature": "extra_hot"}
|
"40": {"temperature": "40"},
|
||||||
}
|
"50": {"temperature": "50"},
|
||||||
},
|
"60": {"temperature": "60"},
|
||||||
"detergent_density": {
|
"70": {"temperature": "70"},
|
||||||
"options": {
|
"90": {"temperature": "90"},
|
||||||
"low": {"detergent_density": "low"},
|
"95": {"temperature": "95"}
|
||||||
"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"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"detergent": {
|
"detergent": {
|
||||||
"options": {
|
"options": {
|
||||||
"none": {"detergent": "none"},
|
"0": {"detergent": "0"},
|
||||||
"little": {"detergent": "little"},
|
"1": {"detergent": "1"},
|
||||||
"normal": {"detergent": "normal"},
|
"2": {"detergent": "2"},
|
||||||
"more": {"detergent": "more"}
|
"3": {"detergent": "3"},
|
||||||
|
"4": {"detergent": "4"},
|
||||||
|
"5": {"detergent": "5"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"softener": {
|
"softener": {
|
||||||
"options": {
|
"options": {
|
||||||
"none": {"softener": "none"},
|
"0": {"softener": "0"},
|
||||||
"little": {"softener": "little"},
|
"1": {"softener": "1"},
|
||||||
"normal": {"softener": "normal"},
|
"2": {"softener": "2"},
|
||||||
"more": {"softener": "more"}
|
"3": {"softener": "3"},
|
||||||
}
|
"4": {"softener": "4"},
|
||||||
},
|
"5": {"softener": "5"}
|
||||||
"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"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dirty_degree": {
|
"dirty_degree": {
|
||||||
"options": {
|
"options": {
|
||||||
"light": {"dirty_degree": "light"},
|
"0": {"dirty_degree": "0"},
|
||||||
"medium": {"dirty_degree": "medium"},
|
"1": {"dirty_degree": "1"},
|
||||||
"heavy": {"dirty_degree": "heavy"},
|
"2": {"dirty_degree": "2"},
|
||||||
"extra_heavy": {"dirty_degree": "extra_heavy"}
|
"3": {"dirty_degree": "3"},
|
||||||
}
|
"4": {"dirty_degree": "4"}
|
||||||
},
|
|
||||||
"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"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"soak_count": {
|
"soak_count": {
|
||||||
"options": {
|
"options": {
|
||||||
"none": {"soak_count": "none"},
|
"0": {"soak_count": "0"},
|
||||||
"one": {"soak_count": "one"},
|
"1": {"soak_count": "1"},
|
||||||
"two": {"soak_count": "two"},
|
"2": {"soak_count": "2"},
|
||||||
"three": {"soak_count": "three"}
|
"3": {"soak_count": "3"},
|
||||||
|
"4": {"soak_count": "4"},
|
||||||
|
"5": {"soak_count": "5"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
from homeassistant.components.select import SelectEntity
|
from homeassistant.components.select import SelectEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .midea_entity import MideaEntity
|
from .midea_entity import MideaEntity
|
||||||
from . import load_device_config
|
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)
|
account_bucket = hass.data.get(DOMAIN, {}).get("accounts", {}).get(config_entry.entry_id)
|
||||||
if not account_bucket:
|
if not account_bucket:
|
||||||
async_add_entities([])
|
async_add_entities([])
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .core.logger import MideaLogger
|
|
||||||
from .midea_entity import MideaEntity
|
from .midea_entity import MideaEntity
|
||||||
from . import load_device_config
|
from . import load_device_config
|
||||||
|
|
||||||
|
|||||||
@@ -335,6 +335,15 @@
|
|||||||
},
|
},
|
||||||
"gear": {
|
"gear": {
|
||||||
"name": "Gear"
|
"name": "Gear"
|
||||||
|
},
|
||||||
|
"detergent": {
|
||||||
|
"name": "Detergent"
|
||||||
|
},
|
||||||
|
"softener": {
|
||||||
|
"name": "Softener"
|
||||||
|
},
|
||||||
|
"temperature": {
|
||||||
|
"name": "Temperature"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
|||||||
@@ -524,6 +524,15 @@
|
|||||||
},
|
},
|
||||||
"gear": {
|
"gear": {
|
||||||
"name": "档位"
|
"name": "档位"
|
||||||
|
},
|
||||||
|
"detergent": {
|
||||||
|
"name": "洗涤剂"
|
||||||
|
},
|
||||||
|
"softener": {
|
||||||
|
"name": "柔顺剂"
|
||||||
|
},
|
||||||
|
"temperature": {
|
||||||
|
"name": "温度"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
|||||||
Reference in New Issue
Block a user