fix: add entities for T0xB6. Ref #45.

This commit is contained in:
sususweet
2025-11-14 21:14:11 +08:00
parent 52c10f7d0d
commit 2a91ce9914
3 changed files with 44 additions and 1 deletions

View File

@@ -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 from homeassistant.components.switch import SwitchDeviceClass
DEVICE_MAPPING = { DEVICE_MAPPING = {
@@ -6,6 +7,14 @@ DEVICE_MAPPING = {
"rationale": ["off", "on"], "rationale": ["off", "on"],
"queries": [{}], "queries": [{}],
"centralized": [], "centralized": [],
"calculate": {
"get": [
{
"lvalue": "[b7_vbattery]",
"rvalue": "[b7_vbatt] / 1000.0"
},
],
},
"entities": { "entities": {
Platform.SWITCH: { Platform.SWITCH: {
"power": { "power": {
@@ -18,6 +27,25 @@ DEVICE_MAPPING = {
"device_class": SwitchDeviceClass.SWITCH, "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: { Platform.SELECT: {
"wind_pressure": { "wind_pressure": {
"options": { "options": {
@@ -28,6 +56,15 @@ DEVICE_MAPPING = {
"extreme": {"wind_pressure": "4"}, "extreme": {"wind_pressure": "4"},
} }
}, },
"gear": {
"options": {
"off": {"gear": 0},
"low": {"gear": 1},
"medium": {"gear": 2},
"high": {"gear": 3},
"extreme": {"gear": 4},
}
},
}, },
} }
} }

View File

@@ -1443,6 +1443,9 @@
"left_status": { "left_status": {
"name": "Left Status" "name": "Left Status"
}, },
"right_status": {
"name": "Right Status"
},
"eq_recipe_action": { "eq_recipe_action": {
"name": "Eq Recipe Action" "name": "Eq Recipe Action"
}, },

View File

@@ -1447,6 +1447,9 @@
"left_status": { "left_status": {
"name": "左侧状态" "name": "左侧状态"
}, },
"right_status": {
"name": "右侧状态"
},
"eq_recipe_action": { "eq_recipe_action": {
"name": "等量食谱动作" "name": "等量食谱动作"
}, },