feat: update device mapping for T0xE7. Fix #89

This commit is contained in:
sususweet
2026-01-08 16:46:47 +08:00
parent 39932a2d2d
commit e85e83a681
3 changed files with 69 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
from homeassistant.const import Platform, UnitOfTemperature, PRECISION_HALVES
from homeassistant.const import Platform, UnitOfTemperature, PRECISION_HALVES, UnitOfTime
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
DEVICE_MAPPING = {
@@ -6,6 +6,19 @@ DEVICE_MAPPING = {
"rationale": ["off", "on"],
"queries": [{}],
"centralized": [],
"calculate": {
"get": [
{
"lvalue": "[time_running]",
"rvalue": "[time_running_hr] * 60 + [time_running_min]"
},
{
"lvalue": "[time_surplus]",
"rvalue": "[time_surplus_hr] * 60 + [time_surplus_min]"
},
],
"set": []
},
"entities": {
Platform.NUMBER: {
"temperature": {
@@ -13,18 +26,31 @@ DEVICE_MAPPING = {
"max": 100,
"step": 1,
},
"fire_level": {
"min": 120,
"max": 2200,
"definite_time_hr": {
"min": 0,
"max": 3,
"step": 1,
},
"set_work_time": {
"definite_time_min": {
"min": 1,
"max": 180,
"max": 59,
"step": 1,
},
},
Platform.SELECT: {
"fire_level": {
"options": {
"120W": {"fire_level": "1"},
"300W": {"fire_level": "2"},
"500W": {"fire_level": "3"},
"800W": {"fire_level": "4"},
"1200W": {"fire_level": "5"},
"1400W": {"fire_level": "6"},
"1600W": {"fire_level": "7"},
"1800W": {"fire_level": "8"},
"2200W": {"fire_level": "9"},
}
},
"work_status": {
"options": {
"standby": {"work_status": "0"},
@@ -38,11 +64,15 @@ DEVICE_MAPPING = {
},
},
Platform.SENSOR: {
"work_mode": {
"device_class": SensorDeviceClass.ENUM,
"time_surplus": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"work_stage": {
"device_class": SensorDeviceClass.ENUM,
"time_running": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
}
}

View File

@@ -420,6 +420,9 @@
}
},
"select": {
"fire_level": {
"name": "Fire Level"
},
"work_switch": {
"name": "Work Switch"
},
@@ -1055,6 +1058,12 @@
}
},
"sensor": {
"time_surplus": {
"name": "Surplus Time"
},
"time_running": {
"name": "Running Time"
},
"cur_fire_level": {
"name": "Current Fire Level"
},
@@ -2088,8 +2097,11 @@
}
},
"number": {
"fire_level": {
"name": "Fire Level"
"definite_time_hr": {
"name": "Definite Time(hr)"
},
"definite_time_min": {
"name": "Definite Time(min)"
},
"set_work_time_sec": {
"name": "Set Work Time(sec)"

View File

@@ -420,6 +420,9 @@
}
},
"select": {
"fire_level": {
"name": "火焰等级"
},
"work_switch": {
"name": "工作开关"
},
@@ -1012,7 +1015,7 @@
"auto_clean_pause": "清扫暂停",
"auto_clean_continue": "继续清扫",
"stop": "停止",
"work": "清扫"
"work": "工作"
}
},
"fan_level": {
@@ -1232,6 +1235,12 @@
}
},
"sensor": {
"time_surplus": {
"name": "剩余时间"
},
"time_running": {
"name": "运行时间"
},
"cur_fire_level": {
"name": "当前火力等级"
},
@@ -2323,8 +2332,11 @@
}
},
"number": {
"fire_level": {
"name": "火焰等级"
"definite_time_hr": {
"name": "设定时间(小时)"
},
"definite_time_min": {
"name": "设定时间(分钟)"
},
"set_work_time_sec": {
"name": "设置工作时间(秒)"