feat: update device support for central air conditioner and washer.

This commit is contained in:
sususweet
2025-10-05 10:27:57 +08:00
parent bd4666e1bd
commit 0328714227
6 changed files with 119 additions and 221 deletions

View File

@@ -193,6 +193,12 @@ class MideaClimateEntity(MideaEntity, ClimateEntity):
async def async_turn_off(self): async def async_turn_off(self):
await self._async_set_status_on_off(self._key_power, False) 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): async def async_set_temperature(self, **kwargs):
if ATTR_TEMPERATURE not in kwargs: if ATTR_TEMPERATURE not in kwargs:
return return

View File

@@ -19,59 +19,25 @@ DEVICE_MAPPING = {
}, },
"entities": { "entities": {
Platform.BINARY_SENSOR: { Platform.BINARY_SENSOR: {
"power": { "softener_lack": {
"device_class": BinarySensorDeviceClass.RUNNING, "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: { Platform.SWITCH: {
"softener_lack": { "power": {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
}, },
"detergent_lack": { "control_status": {
"device_class": SwitchDeviceClass.SWITCH, "rationale": ["pause", "start"],
},
"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,
}, },
"lock": { "lock": {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
@@ -79,36 +45,6 @@ DEVICE_MAPPING = {
"flocks_switcher": { "flocks_switcher": {
"device_class": SwitchDeviceClass.SWITCH, "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": { "ultraviolet_lamp": {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
"rationale": ["0", "1"], "rationale": ["0", "1"],
@@ -128,27 +64,8 @@ DEVICE_MAPPING = {
"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": {
"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": { "dehydration_speed": {
"options": { "options": {
"0": {"dehydration_speed": "0"}, "0": {"dehydration_speed": "0"},
@@ -327,6 +244,9 @@ DEVICE_MAPPING = {
} }
}, },
Platform.SENSOR: { Platform.SENSOR: {
"running_status": {
"device_class": SensorDeviceClass.ENUM
},
"wash_time": { "wash_time": {
"device_class": SensorDeviceClass.DURATION, "device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES, "unit_of_measurement": UnitOfTime.MINUTES,
@@ -353,44 +273,11 @@ DEVICE_MAPPING = {
"unit_of_measurement": "%", "unit_of_measurement": "%",
"state_class": SensorStateClass.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": { "dehydration_time_value": {
"device_class": SensorDeviceClass.DURATION, "device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES, "unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT "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": { "customize_machine_cycle": {
"device_class": SensorDeviceClass.ENUM "device_class": SensorDeviceClass.ENUM
}, },
@@ -416,9 +303,6 @@ DEVICE_MAPPING = {
"unit_of_measurement": UnitOfTime.MINUTES, "unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT "state_class": SensorStateClass.MEASUREMENT
}, },
"device_software_version": {
"device_class": SensorDeviceClass.ENUM
},
"expert_step": { "expert_step": {
"device_class": SensorDeviceClass.ENUM "device_class": SensorDeviceClass.ENUM
}, },

View File

@@ -7,14 +7,15 @@ DEVICE_MAPPING = {
"default": { "default": {
"rationale": ["off", "on"], "rationale": ["off", "on"],
"queries": [{}], "queries": [{}],
"centralized": [ "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"
],
"entities": { "entities": {
Platform.SWITCH: { Platform.SWITCH: {
"power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"control_status": {
"rationale": ["pause", "start"],
},
"ai_switch": { "ai_switch": {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
"rationale": [0, 1] "rationale": [0, 1]
@@ -23,10 +24,6 @@ DEVICE_MAPPING = {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
"rationale": [0, 1] "rationale": [0, 1]
}, },
"appointment": {
"device_class": SwitchDeviceClass.SWITCH,
"rationale": [0, 1]
},
"prevent_wrinkle_switch": { "prevent_wrinkle_switch": {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
"rationale": [0, 1] "rationale": [0, 1]
@@ -63,9 +60,6 @@ DEVICE_MAPPING = {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
"rationale": [0, 1] "rationale": [0, 1]
}, },
"power": {
"device_class": SwitchDeviceClass.SWITCH,
}
}, },
Platform.BINARY_SENSOR: { Platform.BINARY_SENSOR: {
"door_warn": { "door_warn": {
@@ -73,61 +67,68 @@ DEVICE_MAPPING = {
} }
}, },
Platform.SELECT: { 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": { "program": {
"options": { "options": {
"mixed_wash": {"program": "mixed_wash"},
"cotton": {"program": "cotton"}, "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"}, "wool": {"program": "wool"},
"delicate": {"program": "delicate"}, "dehumidify": {"program": "dehumidify"},
"quick": {"program": "quick"}, "cold_air_fresh_air": {"program": "cold_air_fresh_air"},
"eco": {"program": "eco"} "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"}
} }
} }
}, },

View File

@@ -17,6 +17,7 @@ DEVICE_MAPPING = {
Platform.SWITCH: { Platform.SWITCH: {
"bubble": { "bubble": {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,
"rationale": [0, 1]
}, },
"cold_water": { "cold_water": {
"device_class": SwitchDeviceClass.SWITCH, "device_class": SwitchDeviceClass.SWITCH,

View File

@@ -123,6 +123,18 @@
}, },
"entity": { "entity": {
"binary_sensor": { "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": { "air_status": {
"name": "Air Running" "name": "Air Running"
}, },
@@ -1445,6 +1457,9 @@
} }
}, },
"switch": { "switch": {
"control_status": {
"name": "Start Pause"
},
"add_water_flag": { "add_water_flag": {
"name": "Add Water Flag" "name": "Add Water Flag"
}, },
@@ -1652,9 +1667,6 @@
"bucket_clean_switch": { "bucket_clean_switch": {
"name": "Bucket Clean Switch" "name": "Bucket Clean Switch"
}, },
"bucket_water_overheating": {
"name": "Bucket Water Overheating"
},
"buzzer": { "buzzer": {
"name": "Buzzer" "name": "Buzzer"
}, },
@@ -1736,9 +1748,6 @@
"defrost_state": { "defrost_state": {
"name": "Defrost State" "name": "Defrost State"
}, },
"detergent_lack": {
"name": "Detergent Lack"
},
"disinfect_on_off": { "disinfect_on_off": {
"name": "Disinfect On Off" "name": "Disinfect On Off"
}, },
@@ -1751,9 +1760,6 @@
"door_middlestair": { "door_middlestair": {
"name": "Door Middle Stair" "name": "Door Middle Stair"
}, },
"door_opened": {
"name": "Door Opened"
},
"door_upstair": { "door_upstair": {
"name": "Door Up Stair" "name": "Door Up Stair"
}, },
@@ -2009,9 +2015,6 @@
"soften": { "soften": {
"name": "Soften" "name": "Soften"
}, },
"softener_lack": {
"name": "Softener Lack"
},
"speedy": { "speedy": {
"name": "Speedy" "name": "Speedy"
}, },

View File

@@ -198,6 +198,18 @@
"door_status": { "door_status": {
"name": "门状态" "name": "门状态"
}, },
"softener_lack": {
"name": "柔顺剂不足"
},
"detergent_lack": {
"name": "洗涤剂不足"
},
"door_opened": {
"name": "门已打开"
},
"bucket_water_overheating": {
"name": "桶内水温过热"
},
"ele_exception": { "ele_exception": {
"name": "电气异常" "name": "电气异常"
}, },
@@ -1625,6 +1637,9 @@
"ai_switch": { "ai_switch": {
"name": "AI开关" "name": "AI开关"
}, },
"control_status": {
"name": "启停"
},
"airdry_on_off": { "airdry_on_off": {
"name": "风干开关" "name": "风干开关"
}, },
@@ -1652,9 +1667,6 @@
"bucket_clean_switch": { "bucket_clean_switch": {
"name": "桶清洁开关" "name": "桶清洁开关"
}, },
"bucket_water_overheating": {
"name": "桶内水温过热"
},
"buzzer": { "buzzer": {
"name": "蜂鸣器" "name": "蜂鸣器"
}, },
@@ -1736,9 +1748,6 @@
"defrost_state": { "defrost_state": {
"name": "除霜状态" "name": "除霜状态"
}, },
"detergent_lack": {
"name": "洗涤剂不足"
},
"disinfect_on_off": { "disinfect_on_off": {
"name": "消毒开关" "name": "消毒开关"
}, },
@@ -1751,9 +1760,6 @@
"door_middlestair": { "door_middlestair": {
"name": "中层门" "name": "中层门"
}, },
"door_opened": {
"name": "门已打开"
},
"door_upstair": { "door_upstair": {
"name": "上层门" "name": "上层门"
}, },
@@ -2009,9 +2015,6 @@
"soften": { "soften": {
"name": "软化" "name": "软化"
}, },
"softener_lack": {
"name": "柔顺剂不足"
},
"speedy": { "speedy": {
"name": "快速" "name": "快速"
}, },