From b8104a864382ba93ff1cdf33cef395934522c80a Mon Sep 17 00:00:00 2001 From: sususweet Date: Fri, 28 Nov 2025 00:23:45 +0800 Subject: [PATCH] feat: add support for new wind. --- .../midea_auto_cloud/device_mapping/T0xAC.py | 288 ++++++++++++------ custom_components/midea_auto_cloud/fan.py | 4 + .../midea_auto_cloud/translations/en.json | 5 +- .../translations/zh-Hans.json | 5 +- 4 files changed, 200 insertions(+), 102 deletions(-) diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xAC.py b/custom_components/midea_auto_cloud/device_mapping/T0xAC.py index eb5a343..99b10a6 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xAC.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xAC.py @@ -131,72 +131,10 @@ DEVICE_MAPPING = { } } }, - "17497071": { - "rationale": ["off", "on"], - "queries": [{}, {"query_type": "water_model_run_status"}], - "centralized": [], - "entities": { - Platform.CLIMATE: { - "thermostat": { - "power": "water_model_power", - "hvac_modes": { - "off": {"water_model_power": "off"}, - "heat": {"water_model_power": "on"}, - }, - "preset_modes": { - "auto": {"water_model_temperature_auto": "on", "water_temp_linkage_switch": 0}, - "link": {"water_model_temperature_auto": "off", "water_temp_linkage_switch": 1}, - "manual": {"water_model_temperature_auto": "off", "water_temp_linkage_switch": 0} - }, - "target_temperature": "water_model_temperature_set", - "current_temperature": ["temperature", "small_temperature"], - "pre_mode": "mode", - "aux_heat": "water_model_ptc", - "min_temp": 25, - "max_temp": 60, - "temperature_unit": UnitOfTemperature.CELSIUS, - "precision": PRECISION_HALVES, - } - }, - Platform.SWITCH: { - "water_model_power_save": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "water_model_go_out": { - "device_class": SwitchDeviceClass.SWITCH, - }, - "water_model_ptc": { - "device_class": SwitchDeviceClass.SWITCH, - "translation_key": "aux_heat", - }, - }, - Platform.SENSOR: { - "tw1_in_water_temp": { - "device_class": SensorDeviceClass.TEMPERATURE, - "unit_of_measurement": UnitOfTemperature.CELSIUS, - "state_class": SensorStateClass.MEASUREMENT - }, - "tw1_out_water_temp": { - "device_class": SensorDeviceClass.TEMPERATURE, - "unit_of_measurement": UnitOfTemperature.CELSIUS, - "state_class": SensorStateClass.MEASUREMENT - }, - "temperature": { - "device_class": SensorDeviceClass.TEMPERATURE, - "unit_of_measurement": UnitOfTemperature.CELSIUS, - "state_class": SensorStateClass.MEASUREMENT - }, - "humidity": { - "device_class": SensorDeviceClass.HUMIDITY, - "unit_of_measurement": "%", - "state_class": SensorStateClass.MEASUREMENT - } - } - } - }, "22259015": { "rationale": ["off", "on"], - "queries": [{}, {"query_type": "run_status"}, {"query_type": "module_30"}, {"query_type": "module_31"}, {"query_type": "module_32"}], + "queries": [{}, {"query_type": "run_status"}, {"query_type": "module_30"}, {"query_type": "module_31"}, + {"query_type": "module_32"}], "centralized": [], "calculate": { "get": [ @@ -220,42 +158,6 @@ DEVICE_MAPPING = { "set": [] }, "entities": { - Platform.FAN: { - "fan": { - "power": "new_wind_machine", - "speeds": list({"fresh_air_fan_speed": value + 1} for value in range(0, 100)), - "preset_modes": { - "heat_exchange": { - "fresh_air_mode": 1, - "wind_strength": 0 - }, - "smooth_in": { - "fresh_air_mode": 2, - "wind_strength": 0 - }, - "rough_in": { - "fresh_air_mode": 2, - "wind_strength": 1 - }, - "smooth_out": { - "fresh_air_mode": 3, - "wind_strength": 0 - }, - "rough_out": { - "fresh_air_mode": 3, - "wind_strength": 1 - }, - "auto": { - "fresh_air_mode": 4, - "wind_strength": 0 - }, - "innercycle": { - "fresh_air_mode": 5, - "wind_strength": 0 - }, - } - } - }, Platform.CLIMATE: { "thermostat": { "power": "power", @@ -317,6 +219,18 @@ DEVICE_MAPPING = { "device_class": SwitchDeviceClass.SWITCH, "rationale": [0, 1] }, + "manul_fresh_air": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "auto_comfort_fresh_air": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "auto_fresh_off_co2": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "comfort_fresh_air": { + "device_class": SwitchDeviceClass.SWITCH, + } }, Platform.SENSOR: { "mode": { @@ -345,6 +259,180 @@ DEVICE_MAPPING = { } } }, + ("22019031", "22019035", "22019045"): { + "rationale": ["off", "on"], + "queries": [{}, {"query_type":"fresh_air"}, {"query_type":"indoor_humidity"}, {"query_type":"indoor_temperature"}, {"query_type":"outdoor_temperature"}], + "centralized": [], + "entities": { + Platform.FAN: { + "fan": { + "power": "fresh_air", + "speeds": [ + {"fresh_air": "on", "fresh_air_fan_speed": 40}, + {"fresh_air": "on", "fresh_air_fan_speed": 60}, + {"fresh_air": "on", "fresh_air_fan_speed": 80}, + {"fresh_air": "on", "fresh_air_fan_speed": 100} + ], + } + }, + Platform.CLIMATE: { + "thermostat": { + "power": "power", + "hvac_modes": { + "off": {"power": "off"}, + "heat": {"power": "on", "mode": "heat"}, + "cool": {"power": "on", "mode": "cool"}, + "auto": {"power": "on", "mode": "auto"}, + "dry": {"power": "on", "mode": "dry"}, + "fan_only": {"power": "on", "mode": "fan"} + }, + "preset_modes": { + "none": { + "eco": "off", + "comfort_power_save": "off", + "cool_power_saving": 0, + # "comfort_sleep": "off", + "strong_wind": "off" + }, + "eco": {"eco": "on", "cool_power_saving": 1}, + "comfort": {"comfort_power_save": "on"}, + # "sleep": {"comfort_sleep": "on"}, + "boost": {"strong_wind": "on"} + }, + "swing_modes": { + "off": {"wind_swing_lr": "off", "wind_swing_ud": "off"}, + "both": {"wind_swing_lr": "on", "wind_swing_ud": "on"}, + "horizontal": {"wind_swing_lr": "on", "wind_swing_ud": "off"}, + "vertical": {"wind_swing_lr": "off", "wind_swing_ud": "on"}, + }, + "fan_modes": { + "silent": {"wind_speed": 20}, + "low": {"wind_speed": 40}, + "medium": {"wind_speed": 60}, + "high": {"wind_speed": 80}, + "full": {"wind_speed": 100}, + "auto": {"wind_speed": 102} + }, + "target_temperature": ["temperature", "small_temperature"], + "current_temperature": "indoor_temperature", + "pre_mode": "mode", + "aux_heat": "ptc", + "min_temp": 17, + "max_temp": 30, + "temperature_unit": UnitOfTemperature.CELSIUS, + "precision": PRECISION_HALVES, + } + }, + Platform.SWITCH: { + "fresh_air_remove_odor": { + "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1], + }, + "dry": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "prevent_straight_wind": { + "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1] + }, + "aux_heat": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "follow_body_sense_enable": { + "device_class": SwitchDeviceClass.SWITCH, + "rationale": [0, 1] + }, + }, + Platform.SENSOR: { + "mode": { + "device_class": SensorDeviceClass.ENUM, + }, + "indoor_temperature": { + "device_class": SensorDeviceClass.TEMPERATURE, + "unit_of_measurement": UnitOfTemperature.CELSIUS, + "state_class": SensorStateClass.MEASUREMENT + }, + "outdoor_temperature": { + "device_class": SensorDeviceClass.TEMPERATURE, + "unit_of_measurement": UnitOfTemperature.CELSIUS, + "state_class": SensorStateClass.MEASUREMENT + }, + "fresh_air_temp": { + "device_class": SensorDeviceClass.TEMPERATURE, + "unit_of_measurement": UnitOfTemperature.CELSIUS, + "state_class": SensorStateClass.MEASUREMENT + }, + "indoor_humidity": { + "device_class": SensorDeviceClass.HUMIDITY, + "unit_of_measurement": "%", + "state_class": SensorStateClass.MEASUREMENT + } + } + } + }, + "17497071": { + "rationale": ["off", "on"], + "queries": [{}, {"query_type": "water_model_run_status"}], + "centralized": [], + "entities": { + Platform.CLIMATE: { + "thermostat": { + "power": "water_model_power", + "hvac_modes": { + "off": {"water_model_power": "off"}, + "heat": {"water_model_power": "on"}, + }, + "preset_modes": { + "auto": {"water_model_temperature_auto": "on", "water_temp_linkage_switch": 0}, + "link": {"water_model_temperature_auto": "off", "water_temp_linkage_switch": 1}, + "manual": {"water_model_temperature_auto": "off", "water_temp_linkage_switch": 0} + }, + "target_temperature": "water_model_temperature_set", + "current_temperature": ["temperature", "small_temperature"], + "pre_mode": "mode", + "aux_heat": "water_model_ptc", + "min_temp": 25, + "max_temp": 60, + "temperature_unit": UnitOfTemperature.CELSIUS, + "precision": PRECISION_HALVES, + } + }, + Platform.SWITCH: { + "water_model_power_save": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "water_model_go_out": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "water_model_ptc": { + "device_class": SwitchDeviceClass.SWITCH, + "translation_key": "aux_heat", + }, + }, + Platform.SENSOR: { + "tw1_in_water_temp": { + "device_class": SensorDeviceClass.TEMPERATURE, + "unit_of_measurement": UnitOfTemperature.CELSIUS, + "state_class": SensorStateClass.MEASUREMENT + }, + "tw1_out_water_temp": { + "device_class": SensorDeviceClass.TEMPERATURE, + "unit_of_measurement": UnitOfTemperature.CELSIUS, + "state_class": SensorStateClass.MEASUREMENT + }, + "temperature": { + "device_class": SensorDeviceClass.TEMPERATURE, + "unit_of_measurement": UnitOfTemperature.CELSIUS, + "state_class": SensorStateClass.MEASUREMENT + }, + "humidity": { + "device_class": SensorDeviceClass.HUMIDITY, + "unit_of_measurement": "%", + "state_class": SensorStateClass.MEASUREMENT + } + } + } + }, "106J6363": { "rationale": ["off", "on"], "queries": [{}], diff --git a/custom_components/midea_auto_cloud/fan.py b/custom_components/midea_auto_cloud/fan.py index 76b420d..8cc0b43 100644 --- a/custom_components/midea_auto_cloud/fan.py +++ b/custom_components/midea_auto_cloud/fan.py @@ -91,10 +91,14 @@ class MideaFanEntity(MideaEntity, FanEntity): @property def preset_modes(self): + if self._key_preset_modes is None: + return None return list(self._key_preset_modes.keys()) @property def preset_mode(self): + if self._key_preset_modes is None: + return None return self._dict_get_selected(self._key_preset_modes) @property diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index b96aa6d..624564d 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -658,6 +658,9 @@ } }, "sensor": { + "fresh_air_temp": { + "name": "Fresh Air Temp" + }, "running_status": { "name": "Running Status" }, @@ -1671,7 +1674,7 @@ "summer_mode": { "name": "Summer Mode" }, - "follow_body_sense": { + "follow_body_sense_enable": { "name": "Follow Body Sense" }, "waterions": { diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index 2e95910..279dcd7 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -662,6 +662,9 @@ } }, "sensor": { + "fresh_air_temp": { + "name": "新风温度" + }, "running_status": { "name": "运行状态" }, @@ -1675,7 +1678,7 @@ "summer_mode": { "name": "夏季模式" }, - "follow_body_sense": { + "follow_body_sense_enable": { "name": "随身感" }, "waterions": {