From 1f555800f371bb871ce03e52bbca14267b2281c3 Mon Sep 17 00:00:00 2001 From: sususweet Date: Sat, 4 Oct 2025 23:34:27 +0800 Subject: [PATCH] feat: update device T0xE1 control strategy. --- .../midea_auto_cloud/device_mapping/T0xE1.py | 63 +++++++++---------- .../midea_auto_cloud/translations/en.json | 6 +- .../translations/zh-Hans.json | 6 +- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xE1.py b/custom_components/midea_auto_cloud/device_mapping/T0xE1.py index bc6d6c9..8bba27e 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xE1.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xE1.py @@ -5,34 +5,28 @@ from homeassistant.components.switch import SwitchDeviceClass DEVICE_MAPPING = { "default": { - "rationale": ["off", "on"], + "rationale": [0, 1], "queries": [{}], "centralized": [], "entities": { Platform.SWITCH: { "airswitch": { "device_class": SwitchDeviceClass.SWITCH, - "rationale": [0, 1] }, "waterswitch": { "device_class": SwitchDeviceClass.SWITCH, - "rationale": [0, 1] }, "uvswitch": { "device_class": SwitchDeviceClass.SWITCH, - "rationale": [0, 1] }, "doorswitch": { "device_class": SwitchDeviceClass.SWITCH, - "rationale": [0, 1] }, "dryswitch": { "device_class": SwitchDeviceClass.SWITCH, - "rationale": [0, 1] }, "dry_step_switch": { "device_class": SwitchDeviceClass.SWITCH, - "rationale": [0, 1] } }, Platform.BINARY_SENSOR: { @@ -40,16 +34,16 @@ DEVICE_MAPPING = { "device_class": BinarySensorDeviceClass.RUNNING, }, "water_lack": { - "device_class": BinarySensorDeviceClass.RUNNING, + "device_class": BinarySensorDeviceClass.PROBLEM, }, "softwater_lack": { - "device_class": BinarySensorDeviceClass.RUNNING, + "device_class": BinarySensorDeviceClass.PROBLEM, }, "wash_stage":{ "device_class": BinarySensorDeviceClass.RUNNING, }, "bright_lack": { - "device_class": BinarySensorDeviceClass.RUNNING, + "device_class": BinarySensorDeviceClass.PROBLEM, }, "diy_flag": { "device_class": BinarySensorDeviceClass.RUNNING, @@ -69,33 +63,36 @@ DEVICE_MAPPING = { "options": { "power_off": {"work_status": "power_off" }, "power_on": {"work_status": "power_on" }, + "cancel": {"work_status": "cancel" }, + "pause": {"operator":"pause"}, + "resume": {"operator":"start"}, } }, "wash_mode": { "options": { - "neutral_gear": {"mode": "neutral_gear"}, - "auto_wash": {"mode": "auto_wash"}, - "strong_wash": {"mode": "strong_wash"}, - "standard_wash": {"mode": "standard_wash"}, - "eco_wash": {"mode": "eco_wash"}, - "glass_wash": {"mode": "glass_wash"}, - "hour_wash": {"mode": "hour_wash"}, - "fast_wash": {"mode": "fast_wash"}, - "soak_wash": {"mode": "soak_wash"}, - "90min_wash": {"mode": "90min_wash"}, - "self_clean": {"mode": "self_clean"}, - "fruit_wash": {"mode": "fruit_wash"}, - "self_define": {"mode": "self_define"}, - "germ": {"mode": "germ"}, - "bowl_wash": {"mode": "bowl_wash"}, - "kill_germ": {"mode": "kill_germ"}, - "seafood_wash": {"mode": "seafood_wash"}, - "hotpot_wash": {"mode": "hotpot_wash"}, - "quietnight_wash": {"mode": "quietnight_wash"}, - "less_wash": {"mode": "less_wash"}, - "oilnet_wash": {"mode": "oilnet_wash"} + "neutral_gear": {"work_status": "work", "mode": "neutral_gear"}, + "auto_wash": {"work_status": "work", "mode": "auto_wash"}, + "strong_wash": {"work_status": "work", "mode": "strong_wash"}, + "standard_wash": {"work_status": "work", "mode": "standard_wash"}, + "eco_wash": {"work_status":"work","mode":"eco_wash","additional":0,"wash_region":3}, + "glass_wash": {"work_status": "work", "mode": "glass_wash"}, + "hour_wash": {"work_status": "work", "mode": "hour_wash"}, + "fast_wash": {"work_status": "work", "mode": "fast_wash"}, + "soak_wash": {"work_status": "work", "mode": "soak_wash"}, + "90min_wash": {"work_status": "work", "mode": "90min_wash"}, + "self_clean": {"work_status": "work", "mode": "self_clean"}, + "fruit_wash": {"work_status": "work", "mode": "fruit_wash"}, + "self_define": {"work_status": "work", "mode": "self_define"}, + "germ": {"work_status": "work", "mode": "germ"}, + "bowl_wash": {"work_status": "work", "mode": "bowl_wash"}, + "kill_germ": {"work_status": "work", "mode": "kill_germ"}, + "seafood_wash": {"work_status": "work", "mode": "seafood_wash"}, + "hotpot_wash": {"work_status": "work", "mode": "hotpot_wash"}, + "quietnight_wash": {"work_status": "work", "mode": "quietnight_wash"}, + "less_wash": {"work_status": "work", "mode": "less_wash"}, + "oilnet_wash": {"work_status": "work", "mode": "oilnet_wash"} } - }, + } }, Platform.SENSOR: { "bright": { @@ -115,7 +112,7 @@ DEVICE_MAPPING = { }, "left_time": { "device_class": SensorDeviceClass.DURATION, - "unit_of_measurement": UnitOfTime.HOURS, + "unit_of_measurement": UnitOfTime.MINUTES, "state_class": SensorStateClass.MEASUREMENT }, "air_set_hour": { diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index 5bfa940..9584501 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -507,6 +507,9 @@ "work_status": { "name": "Work Status" }, + "wash_mode": { + "name": "Wash Mode" + }, "voice": { "name": "Voice" }, @@ -2184,9 +2187,6 @@ "filter_notification": { "name": "Filter Notification" }, - "wash_mode": { - "name": "Wash Mode" - }, "left_power": { "name": "Left Power" }, diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index 3bcb12c..5ba6f11 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -492,6 +492,9 @@ "work_mode": { "name": "工作模式" }, + "wash_mode": { + "name": "洗涤模式" + }, "func_select": { "name": "功能选择" }, @@ -2187,9 +2190,6 @@ "filter_notification": { "name": "滤网提醒" }, - "wash_mode": { - "name": "洗涤模式" - }, "left_power": { "name": "左侧电源" },