From 087c5db4971e54858b4506ace3c423593878d186 Mon Sep 17 00:00:00 2001 From: sususweet Date: Wed, 22 Oct 2025 16:01:20 +0800 Subject: [PATCH] feat: add device support for T0xFB. --- README.md | 1 + README_zh_CN.md | 1 + .../midea_auto_cloud/device_mapping/T0xFB.py | 53 +++++++++++++++++++ .../midea_auto_cloud/translations/en.json | 6 +++ .../translations/zh-Hans.json | 6 +++ 5 files changed, 67 insertions(+) create mode 100644 custom_components/midea_auto_cloud/device_mapping/T0xFB.py diff --git a/README.md b/README.md index c877c63..e93c6e1 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Get devices from MSmartHome/Midea Meiju homes through the network and control th - T0xEA Rice Cooker - T0xED Water Softener - T0xFA Electric Fan +- T0xFB Electric Heater - T0xFD Humidifier Welcome to collaborate on adding support for more devices. diff --git a/README_zh_CN.md b/README_zh_CN.md index 37b2405..7163f82 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -41,6 +41,7 @@ - T0xEA 电饭锅 - T0xED 软水机 - T0xFA 电风扇 +- T0xFB 电暖器 - T0xFD 加湿器 欢迎合作开发添加更多设备支持。 diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xFB.py b/custom_components/midea_auto_cloud/device_mapping/T0xFB.py new file mode 100644 index 0000000..de09936 --- /dev/null +++ b/custom_components/midea_auto_cloud/device_mapping/T0xFB.py @@ -0,0 +1,53 @@ +from homeassistant.const import Platform, UnitOfTemperature, UnitOfVolume, UnitOfTime, PERCENTAGE, PRECISION_HALVES, \ + UnitOfEnergy, UnitOfPower +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": [], + "entities": { + Platform.SWITCH: { + "lock": { + "device_class": SwitchDeviceClass.SWITCH, + }, + "screen_close": { + "device_class": SwitchDeviceClass.SWITCH, + } + }, + Platform.CLIMATE: { + "electric_heater": { + "power": "power", + "hvac_modes": { + "off": {"power": "off"}, + "heat": {"power": "on"} + }, + "target_temperature": "temperature", + "current_temperature": "cur_temperature", + "min_temp": 5, + "max_temp": 35, + "temperature_unit": UnitOfTemperature.CELSIUS, + "precision": PRECISION_HALVES, + } + }, + Platform.SELECT: { + "gear": { + "options": { + "low": {"gear": 1}, + "high": {"gear": 3} + } + } + }, + Platform.SENSOR: { + "power_statistics": { + "device_class": SensorDeviceClass.POWER, + "unit_of_measurement": UnitOfPower.WATT, + "state_class": SensorStateClass.MEASUREMENT + } + } + } + } +} diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index dbd9e54..8ce1760 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -359,6 +359,9 @@ }, "water_heater": { "name": "Water Heater" + }, + "electric_heater": { + "name": "Electric Heater" } }, "humidifier": { @@ -1530,6 +1533,9 @@ } }, "switch": { + "screen_close": { + "name": "Screen Close" + }, "anion": { "name": "Anion" }, diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index d375813..a5eddab 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -363,6 +363,9 @@ }, "water_heater": { "name": "热水器" + }, + "electric_heater": { + "name": "取暖器" } }, "humidifier": { @@ -1534,6 +1537,9 @@ } }, "switch": { + "screen_close": { + "name": "屏幕关闭" + }, "anion": { "name": "负离子" },