From 0341b9d105670248e8890c328bee3acc3409a6f2 Mon Sep 17 00:00:00 2001 From: sususweet Date: Tue, 6 Jan 2026 12:01:40 +0800 Subject: [PATCH] feat: update device mapping for T0xC2. Fix #80 --- .../midea_auto_cloud/device_mapping/T0xC2.py | 139 ++++++++++++++++++ .../midea_auto_cloud/translations/en.json | 113 ++++++++++++++ .../translations/zh-Hans.json | 113 ++++++++++++++ 3 files changed, 365 insertions(+) create mode 100644 custom_components/midea_auto_cloud/device_mapping/T0xC2.py diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xC2.py b/custom_components/midea_auto_cloud/device_mapping/T0xC2.py new file mode 100644 index 0000000..efd578a --- /dev/null +++ b/custom_components/midea_auto_cloud/device_mapping/T0xC2.py @@ -0,0 +1,139 @@ +from homeassistant.const import Platform +from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass +from homeassistant.components.binary_sensor import BinarySensorDeviceClass +from homeassistant.components.switch import SwitchDeviceClass + +DEVICE_MAPPING = { + "default": { + "rationale": ["off", "on"], + "queries": [{}], + "centralized": [], + "calculate": { + "get": [], + "set": [] + }, + "entities": { + Platform.SWITCH: { + "power": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "auto_rinse": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "dry": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "auto_deodorization": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "light_sensor": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "auto_eco": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "sedentary_remind": { + "device_class": SwitchDeviceClass.SWITCH, + } + }, + Platform.SELECT: { + "clean_mode": { + "options": { + "无": {"clean_mode": "invalid"}, + "臀洗": {"clean_mode": "normal"}, + "妇洗": {"clean_mode": "woman"}, + "喷杆清洁保养": {"clean_mode": "maintain"}, + } + }, + "dry_gear": { # 风温档位调节 + "options": { + "空档": {"dry_gear": 0}, + "低档": {"dry_gear": 1}, + "中档": {"dry_gear": 2}, + "高档": {"dry_gear": 3}, + } + }, + "water_gear": { # 水温档位调节 + "options": { + "空档": {"water_gear": 0}, + "低档": {"water_gear": 1}, + "中低档": {"water_gear": 2}, + "中档": {"water_gear": 3}, + "中高档": {"water_gear": 4}, + "高档": {"water_gear": 5}, + } + }, + "seat_gear": { # 坐圈温度调节 + "options": { + "空档": {"seat_gear": 0}, + "低档": {"seat_gear": 1}, + "中低档": {"seat_gear": 2}, + "中档": {"seat_gear": 3}, + "中高档": {"seat_gear": 4}, + "高档": {"seat_gear": 5}, + } + }, + "rinse_volume": { # 冲水模式 + "options": { + "大冲": {"rinse_volume": "full"}, + "小冲": {"rinse_volume": "half"}, + "无": {"rinse_volume": "invalid"} + } + }, + "injector_position_normal": { # 臀洗喷嘴位置 + "options": { + "空档": {"injector_position_normal": 0}, + "后档": {"injector_position_normal": 1}, + "中后档": {"injector_position_normal": 2}, + "中档": {"injector_position_normal": 3}, + "中前档": {"injector_position_normal": 4}, + "前档": {"injector_position_normal": 5}, + } + }, + "injector_position_woman": { # 妇洗喷嘴位置 + "options": { + "空档": {"injector_position_woman": 0}, + "后档": {"injector_position_woman": 1}, + "中后档": {"injector_position_woman": 2}, + "中档": {"injector_position_woman": 3}, + "中前档": {"injector_position_woman": 4}, + "前档": {"injector_position_woman": 5}, + } + }, + "water_pressure_normal": { # 臀洗冲洗强度 + "options": { + "空档": {"water_pressure_normal": 0}, + "低档": {"water_pressure_normal": 1}, + "中低档": {"water_pressure_normal": 2}, + "中档": {"water_pressure_normal": 3}, + "中高档": {"water_pressure_normal": 4}, + "高档": {"water_pressure_normal": 5}, + } + }, + "water_pressure_woman": { # 妇洗冲洗强度 + "options": { + "空档": {"water_pressure_woman": 0}, + "低档": {"water_pressure_woman": 1}, + "中低档": {"water_pressure_woman": 2}, + "中档": {"water_pressure_woman": 3}, + "中高档": {"water_pressure_woman": 4}, + "高档": {"water_pressure_woman": 5}, + } + }, + }, + Platform.SENSOR: { + "filter_use_per": { + "device_class": SensorDeviceClass.BATTERY, + "unit_of_measurement": "%", + "state_class": SensorStateClass.MEASUREMENT + }, + }, + Platform.BINARY_SENSOR: { + "on_seat": { + "device_class": BinarySensorDeviceClass.RUNNING + }, + } + } + } +} + diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index 3ee8c0f..35aea23 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -319,6 +319,9 @@ }, "standby_status": { "name": "Standby Status" + }, + "on_seat": { + "name": "On Seat" } }, "climate": { @@ -926,6 +929,98 @@ }, "heating_unit_type": { "name": "Heating Unit Type" + }, + "clean_mode": { + "name": "Clean Mode", + "state": { + "invalid": "None", + "normal": "Bidet Wash", + "woman": "Feminine Wash", + "maintain": "Nozzle Cleaning" + } + }, + "dry_gear": { + "name": "Dry Gear", + "state": { + "0": "Off", + "1": "Low", + "2": "Medium", + "3": "High" + } + }, + "water_gear": { + "name": "Water Gear", + "state": { + "0": "Off", + "1": "Low", + "2": "Medium Low", + "3": "Medium", + "4": "Medium High", + "5": "High" + } + }, + "seat_gear": { + "name": "Seat Gear", + "state": { + "0": "Off", + "1": "Low", + "2": "Medium Low", + "3": "Medium", + "4": "Medium High", + "5": "High" + } + }, + "rinse_volume": { + "name": "Rinse Volume", + "state": { + "full": "Full Flush", + "half": "Half Flush", + "invalid": "None" + } + }, + "injector_position_normal": { + "name": "Bidet Nozzle Position", + "state": { + "0": "Off", + "1": "Rear", + "2": "Mid Rear", + "3": "Middle", + "4": "Mid Front", + "5": "Front" + } + }, + "injector_position_woman": { + "name": "Feminine Nozzle Position", + "state": { + "0": "Off", + "1": "Rear", + "2": "Mid Rear", + "3": "Middle", + "4": "Mid Front", + "5": "Front" + } + }, + "water_pressure_normal": { + "name": "Bidet Water Pressure", + "state": { + "0": "Off", + "1": "Low", + "2": "Medium Low", + "3": "Medium", + "4": "Medium High", + "5": "High" + } + }, + "water_pressure_woman": { + "name": "Feminine Water Pressure", + "state": { + "0": "Off", + "1": "Low", + "2": "Medium Low", + "3": "Medium", + "4": "Medium High", + "5": "High" + } } }, "sensor": { @@ -1939,6 +2034,9 @@ }, "total_elec_value": { "name": "Total Electricity" + }, + "filter_use_per": { + "name": "Filter Use Percentage" } }, "light": { @@ -3015,6 +3113,21 @@ }, "air_exhaust": { "name": "Air Exhaust" + }, + "auto_rinse": { + "name": "Auto Rinse" + }, + "auto_deodorization": { + "name": "Auto Deodorization" + }, + "light_sensor": { + "name": "Light Sensor" + }, + "auto_eco": { + "name": "Auto Eco" + }, + "sedentary_remind": { + "name": "Sedentary Remind" } } } diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index c5ad9e9..9429511 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -319,6 +319,9 @@ }, "standby_status": { "name": "待机状态" + }, + "on_seat": { + "name": "坐圈状态" } }, "climate": { @@ -1059,6 +1062,98 @@ }, "heating_unit_type": { "name": "采暖器件类型" + }, + "clean_mode": { + "name": "清洁模式", + "state": { + "invalid": "无", + "normal": "臀洗", + "woman": "妇洗", + "maintain": "喷杆清洁保养" + } + }, + "dry_gear": { + "name": "风温档位", + "state": { + "0": "空档", + "1": "低档", + "2": "中档", + "3": "高档" + } + }, + "water_gear": { + "name": "水温档位", + "state": { + "0": "空档", + "1": "低档", + "2": "中低档", + "3": "中档", + "4": "中高档", + "5": "高档" + } + }, + "seat_gear": { + "name": "坐圈温度", + "state": { + "0": "空档", + "1": "低档", + "2": "中低档", + "3": "中档", + "4": "中高档", + "5": "高档" + } + }, + "rinse_volume": { + "name": "冲水模式", + "state": { + "full": "大冲", + "half": "小冲", + "invalid": "无" + } + }, + "injector_position_normal": { + "name": "臀洗喷嘴位置", + "state": { + "0": "空档", + "1": "后档", + "2": "中后档", + "3": "中档", + "4": "中前档", + "5": "前档" + } + }, + "injector_position_woman": { + "name": "妇洗喷嘴位置", + "state": { + "0": "空档", + "1": "后档", + "2": "中后档", + "3": "中档", + "4": "中前档", + "5": "前档" + } + }, + "water_pressure_normal": { + "name": "臀洗冲洗强度", + "state": { + "0": "空档", + "1": "低档", + "2": "中低档", + "3": "中档", + "4": "中高档", + "5": "高档" + } + }, + "water_pressure_woman": { + "name": "妇洗冲洗强度", + "state": { + "0": "空档", + "1": "低档", + "2": "中低档", + "3": "中档", + "4": "中高档", + "5": "高档" + } } }, "sensor": { @@ -2072,6 +2167,9 @@ }, "total_elec_value": { "name": "总耗电量" + }, + "filter_use_per": { + "name": "滤芯使用百分比" } }, "light": { @@ -3172,6 +3270,21 @@ }, "air_exhaust": { "name": "快速除味" + }, + "auto_rinse": { + "name": "自动冲洗" + }, + "auto_deodorization": { + "name": "自动除臭" + }, + "light_sensor": { + "name": "光感" + }, + "auto_eco": { + "name": "自动节能" + }, + "sedentary_remind": { + "name": "久坐提醒" } } }