feat: add control protocol v2 for T0xB6.

This commit is contained in:
sususweet
2025-12-20 12:44:16 +08:00
parent 96a9d49fcf
commit 8aa0fc93fc
3 changed files with 64 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
from homeassistant.components.playstation_network.media_player import PLATFORM_MAP
from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
from homeassistant.const import Platform, UnitOfPower, UnitOfElectricPotential from homeassistant.const import Platform, UnitOfPower, UnitOfElectricPotential
from homeassistant.components.switch import SwitchDeviceClass from homeassistant.components.switch import SwitchDeviceClass
@@ -6,7 +7,7 @@ DEVICE_MAPPING = {
"default": { "default": {
"rationale": ["off", "on"], "rationale": ["off", "on"],
"queries": [{}], "queries": [{}],
"centralized": [], "centralized": ["lightness"],
"calculate": { "calculate": {
"get": [ "get": [
{ {
@@ -28,9 +29,6 @@ DEVICE_MAPPING = {
} }
}, },
Platform.SENSOR: { Platform.SENSOR: {
"error_code": {
"device_class": SensorDeviceClass.ENUM
},
"b7_left_status": { "b7_left_status": {
"device_class": SensorDeviceClass.ENUM, "device_class": SensorDeviceClass.ENUM,
"translation_key": "left_status", "translation_key": "left_status",
@@ -46,6 +44,28 @@ DEVICE_MAPPING = {
"translation_key": "battery_voltage", "translation_key": "battery_voltage",
} }
}, },
Platform.BUTTON: {
"light_off": {
"command": {"electronic_control_version": 2, "type": "b6", "b6_action": "setting",
"setting": "light", "light": "off"},
},
"light_on": {
"command": {"electronic_control_version": 2, "type": "b6", "b6_action": "setting",
"setting": "light", "light": "on"},
},
"left_stove_off": {
"command": {"electronic_control_version": 2, "type": "b7", "b7_work_burner_control": 1,
"b7_function_control": 1},
},
"right_stove_off": {
"command": {"electronic_control_version": 2, "type": "b7", "b7_work_burner_control": 2,
"b7_function_control": 1},
},
"middle_stove_off": {
"command": {"electronic_control_version": 2, "type": "b7", "b7_work_burner_control": 3,
"b7_function_control": 1},
}
},
Platform.SELECT: { Platform.SELECT: {
"wind_pressure": { "wind_pressure": {
"options": { "options": {

View File

@@ -122,6 +122,23 @@
} }
}, },
"entity": { "entity": {
"button": {
"light_off": {
"name": "Light off"
},
"light_on": {
"name": "Light on"
},
"left_stove_off": {
"name": "Left stove off"
},
"right_stove_off": {
"name": "Right stove off"
},
"middle_stove_off": {
"name": "Middle stove off"
}
},
"binary_sensor": { "binary_sensor": {
"heating_work": { "heating_work": {
"name": "Heating Work Status" "name": "Heating Work Status"
@@ -2775,6 +2792,9 @@
"endpoint_8_onoff": { "endpoint_8_onoff": {
"name": "Button 8" "name": "Button 8"
}, },
"wisdom_wind": {
"name": "Wisdom Wind"
},
"work_switch": { "work_switch": {
"name": "Work Switch" "name": "Work Switch"
}, },

View File

@@ -122,6 +122,23 @@
} }
}, },
"entity": { "entity": {
"button": {
"light_off": {
"name": "关闭灯光"
},
"light_on": {
"name": "打开灯光"
},
"left_stove_off": {
"name": "左灶关火"
},
"right_stove_off": {
"name": "右灶关火"
},
"middle_stove_off": {
"name": "中灶关火"
}
},
"binary_sensor": { "binary_sensor": {
"heating_work": { "heating_work": {
"name": "采暖功能状态" "name": "采暖功能状态"
@@ -2870,6 +2887,9 @@
"endpoint_8_onoff": { "endpoint_8_onoff": {
"name": "按键八" "name": "按键八"
}, },
"wisdom_wind": {
"name": "智能风"
},
"work_switch": { "work_switch": {
"name": "工作开关" "name": "工作开关"
}, },