From 2a91ce9914c0fcec10a9a89b9897fe765f421eca Mon Sep 17 00:00:00 2001 From: sususweet Date: Fri, 14 Nov 2025 21:14:11 +0800 Subject: [PATCH] fix: add entities for T0xB6. Ref #45. --- .../midea_auto_cloud/device_mapping/T0xB6.py | 39 ++++++++++++++++++- .../midea_auto_cloud/translations/en.json | 3 ++ .../translations/zh-Hans.json | 3 ++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xB6.py b/custom_components/midea_auto_cloud/device_mapping/T0xB6.py index 92c4752..cafc49d 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xB6.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xB6.py @@ -1,4 +1,5 @@ -from homeassistant.const import Platform +from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass +from homeassistant.const import Platform, UnitOfPower, UnitOfElectricPotential from homeassistant.components.switch import SwitchDeviceClass DEVICE_MAPPING = { @@ -6,6 +7,14 @@ DEVICE_MAPPING = { "rationale": ["off", "on"], "queries": [{}], "centralized": [], + "calculate": { + "get": [ + { + "lvalue": "[b7_vbattery]", + "rvalue": "[b7_vbatt] / 1000.0" + }, + ], + }, "entities": { Platform.SWITCH: { "power": { @@ -18,6 +27,25 @@ DEVICE_MAPPING = { "device_class": SwitchDeviceClass.SWITCH, } }, + Platform.SENSOR: { + "error_code": { + "device_class": SensorDeviceClass.ENUM + }, + "b7_left_status": { + "device_class": SensorDeviceClass.ENUM, + "translation_key": "left_status", + }, + "b7_right_status": { + "device_class": SensorDeviceClass.ENUM, + "translation_key": "right_status", + }, + "b7_vbattery":{ + "device_class": SensorDeviceClass.VOLTAGE, + "unit_of_measurement": UnitOfElectricPotential.VOLT, + "state_class": SensorStateClass.MEASUREMENT, + "translation_key": "battery_voltage", + } + }, Platform.SELECT: { "wind_pressure": { "options": { @@ -28,6 +56,15 @@ DEVICE_MAPPING = { "extreme": {"wind_pressure": "4"}, } }, + "gear": { + "options": { + "off": {"gear": 0}, + "low": {"gear": 1}, + "medium": {"gear": 2}, + "high": {"gear": 3}, + "extreme": {"gear": 4}, + } + }, }, } } diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index 00192f1..7ae9946 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -1443,6 +1443,9 @@ "left_status": { "name": "Left Status" }, + "right_status": { + "name": "Right Status" + }, "eq_recipe_action": { "name": "Eq Recipe Action" }, diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index e5165fb..c1bc070 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -1447,6 +1447,9 @@ "left_status": { "name": "左侧状态" }, + "right_status": { + "name": "右侧状态" + }, "eq_recipe_action": { "name": "等量食谱动作" },