feat: add support for T0xC1. Fix #67.

This commit is contained in:
sususweet
2025-12-20 16:29:54 +08:00
parent 61a8115244
commit 5a3941fd19
3 changed files with 517 additions and 0 deletions

View File

@@ -0,0 +1,289 @@
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, UnitOfPower, UnitOfVolumeFlowRate
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": [],
"calculate": {
"get": [
{
"lvalue": "[rated_power]",
"rvalue": "[rate_high] * 256 + [rate_lower]"
},
{
"lvalue": "[current_power]",
"rvalue": "[cur_rate_high] * 256 + [cur_rate_lower]"
}
],
"set": []
},
"entities": {
Platform.WATER_HEATER: {
"water_heater": {
"power": "power",
"operation_list": {
"off": {"power": "off"},
"heat": {"power": "on"},
},
"target_temperature": "bash_target_temperature",
"current_temperature": "bash_temperature",
"min_temp": 30,
"max_temp": 75,
"temperature_unit": UnitOfTemperature.CELSIUS,
}
},
Platform.CLIMATE: {
"heating": {
"power": "power",
"hvac_modes": {
"off": {"power": "off"},
"heat": {"power": "on", "heating_mode": 1},
},
"target_temperature": "heating_target_temperature",
"current_temperature": "heating_temperature",
"min_temp": 30,
"max_temp": 75,
"temperature_unit": UnitOfTemperature.CELSIUS,
}
},
Platform.SWITCH: {
"power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"buzzer": {
"device_class": SwitchDeviceClass.SWITCH,
},
"pump": {
"device_class": SwitchDeviceClass.SWITCH,
},
"wait_power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"hot_power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"warm_power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"cold_power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"sleep_power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"appoint_power": {
"device_class": SwitchDeviceClass.SWITCH,
},
},
Platform.SELECT: {
"hot_style": {
"options": {
"1": {"hot_style": 1},
"2": {"hot_style": 2},
}
},
"bash_mode": {
"options": {
"0": {"bash_mode": 0},
"1": {"bash_mode": 1},
"2": {"bash_mode": 2},
"3": {"bash_mode": 3},
}
},
"heating_mode": {
"options": {
"0": {"heating_mode": 0},
"1": {"heating_mode": 1},
"2": {"heating_mode": 2},
"3": {"heating_mode": 3},
}
},
"three_way_mode": {
"options": {
"heating": {"three_way_mode": "heating"},
"bath": {"three_way_mode": "bath"},
}
},
"heating_unit_type": {
"options": {
"floor_heating": {"heating_unit_type": "floor_heating"},
"radiator": {"heating_unit_type": "radiator"},
}
},
},
Platform.NUMBER: {
"bash_target_temperature": {
"min": 30,
"max": 75,
"step": 1,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
},
"bash_gap_temperature": {
"min": 0,
"max": 10,
"step": 1,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
},
"heating_target_temperature": {
"min": 30,
"max": 75,
"step": 1,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
},
"heating_gap_temperature": {
"min": 0,
"max": 10,
"step": 1,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
},
"last_time": {
"min": 0,
"max": 255,
"step": 1,
"unit_of_measurement": UnitOfTime.HOURS,
},
"user_mode_target_temperature": {
"min": 30,
"max": 75,
"step": 1,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
},
"activity_mode_target_temperature": {
"min": 30,
"max": 75,
"step": 1,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
},
"sleep_mode_target_temperature": {
"min": 30,
"max": 75,
"step": 1,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
},
"light_gear": {
"min": 0,
"max": 7,
"step": 1,
},
},
Platform.SENSOR: {
"in_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"out_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"bash_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"bash_target_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"heating_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"heating_target_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"heating_gap_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"user_mode_target_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"activity_mode_target_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"sleep_mode_target_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"rated_power": {
"device_class": SensorDeviceClass.POWER,
"unit_of_measurement": UnitOfPower.WATT,
"state_class": SensorStateClass.MEASUREMENT
},
"current_power": {
"device_class": SensorDeviceClass.POWER,
"unit_of_measurement": UnitOfPower.WATT,
"state_class": SensorStateClass.MEASUREMENT
},
"flow_volume": {
"device_class": SensorDeviceClass.ENUM,
"unit_of_measurement": UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
"state_class": SensorStateClass.MEASUREMENT
},
"last_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"bash_mode": {
"device_class": SensorDeviceClass.ENUM
},
"heating_mode": {
"device_class": SensorDeviceClass.ENUM
},
"hot_style": {
"device_class": SensorDeviceClass.ENUM
},
"bash_function": {
"device_class": SensorDeviceClass.ENUM
},
"three_way_mode": {
"device_class": SensorDeviceClass.ENUM
},
"heating_unit_type": {
"device_class": SensorDeviceClass.ENUM
},
"light_gear": {
"device_class": SensorDeviceClass.ENUM
},
},
Platform.BINARY_SENSOR: {
"wait_power": {
"device_class": BinarySensorDeviceClass.RUNNING
},
"hot_power": {
"device_class": BinarySensorDeviceClass.RUNNING
},
"warm_power": {
"device_class": BinarySensorDeviceClass.RUNNING
},
"cold_power": {
"device_class": BinarySensorDeviceClass.RUNNING
},
"sleep_power": {
"device_class": BinarySensorDeviceClass.RUNNING
},
"appoint_power": {
"device_class": BinarySensorDeviceClass.RUNNING
},
}
}
}
}

View File

@@ -394,6 +394,9 @@
},
"electric_heater": {
"name": "Electric Heater"
},
"heating": {
"name": "Heating"
}
},
"humidifier": {
@@ -874,6 +877,21 @@
},
"wind_pressure": {
"name": "Wind Pressure"
},
"hot_style": {
"name": "Heating Style"
},
"bash_mode": {
"name": "Bath Mode"
},
"heating_mode": {
"name": "Heating Mode"
},
"three_way_mode": {
"name": "Three Way Valve Mode"
},
"heating_unit_type": {
"name": "Heating Unit Type"
}
},
"sensor": {
@@ -1501,6 +1519,63 @@
"in_temperature": {
"name": "In Temperature"
},
"out_temperature": {
"name": "Out Temperature"
},
"bash_temperature": {
"name": "Bath Temperature"
},
"bash_target_temperature": {
"name": "Bath Target Temperature"
},
"heating_temperature": {
"name": "Heating Temperature"
},
"heating_target_temperature": {
"name": "Heating Target Temperature"
},
"heating_gap_temperature": {
"name": "Heating Gap Temperature"
},
"user_mode_target_temperature": {
"name": "User Mode Target Temperature"
},
"activity_mode_target_temperature": {
"name": "Activity Mode Target Temperature"
},
"sleep_mode_target_temperature": {
"name": "Sleep Mode Target Temperature"
},
"rated_power": {
"name": "Rated Power"
},
"current_power": {
"name": "Current Power"
},
"flow_volume": {
"name": "Flow Volume"
},
"bash_mode": {
"name": "Bath Mode"
},
"heating_mode": {
"name": "Heating Mode"
},
"hot_style": {
"name": "Heating Style"
},
"bash_function": {
"name": "Bath Function"
},
"three_way_mode": {
"name": "Three Way Valve Mode"
},
"heating_unit_type": {
"name": "Heating Unit Type"
},
"light_gear": {
"name": "Screen Brightness"
},
"mg_remain": {
"name": "Mg Remain"
},
@@ -1838,6 +1913,33 @@
"light_brightness": {
"name": "Light Brightness"
},
"bash_target_temperature": {
"name": "Bath Target Temperature"
},
"bash_gap_temperature": {
"name": "Bath Gap Temperature"
},
"heating_target_temperature": {
"name": "Heating Target Temperature"
},
"heating_gap_temperature": {
"name": "Heating Gap Temperature"
},
"last_time": {
"name": "Continuous Heating Time"
},
"user_mode_target_temperature": {
"name": "User Mode Target Temperature"
},
"activity_mode_target_temperature": {
"name": "Activity Mode Target Temperature"
},
"sleep_mode_target_temperature": {
"name": "Sleep Mode Target Temperature"
},
"light_gear": {
"name": "Screen Brightness"
},
"laundry_height": {
"name": "Laundry Height"
},
@@ -2145,6 +2247,18 @@
"buzzer": {
"name": "Buzzer"
},
"pump": {
"name": "Pump"
},
"wait_power": {
"name": "Standby"
},
"cold_power": {
"name": "Antifreeze"
},
"sleep_power": {
"name": "Sleep"
},
"change_litre_switch": {
"name": "Change Litre Switch"
},

View File

@@ -394,6 +394,9 @@
},
"electric_heater": {
"name": "取暖器"
},
"heating": {
"name": "采暖"
}
},
"humidifier": {
@@ -969,6 +972,21 @@
},
"wind_pressure": {
"name": "风压"
},
"hot_style": {
"name": "供热方式"
},
"bash_mode": {
"name": "卫浴模式"
},
"heating_mode": {
"name": "采暖模式"
},
"three_way_mode": {
"name": "三通阀模式"
},
"heating_unit_type": {
"name": "采暖器件类型"
}
},
"sensor": {
@@ -1596,6 +1614,63 @@
"in_temperature": {
"name": "进水温度"
},
"out_temperature": {
"name": "出水温度"
},
"bash_temperature": {
"name": "卫浴温度"
},
"bash_target_temperature": {
"name": "卫浴目标温度"
},
"heating_temperature": {
"name": "采暖温度"
},
"heating_target_temperature": {
"name": "采暖目标温度"
},
"heating_gap_temperature": {
"name": "采暖回差温度"
},
"user_mode_target_temperature": {
"name": "用户模式目标温度"
},
"activity_mode_target_temperature": {
"name": "活动模式目标温度"
},
"sleep_mode_target_temperature": {
"name": "睡眠模式目标温度"
},
"rated_power": {
"name": "额定功率"
},
"current_power": {
"name": "实时功率"
},
"flow_volume": {
"name": "流量"
},
"bash_mode": {
"name": "卫浴模式"
},
"heating_mode": {
"name": "采暖模式"
},
"hot_style": {
"name": "供热方式"
},
"bash_function": {
"name": "卫浴功能"
},
"three_way_mode": {
"name": "三通阀模式"
},
"heating_unit_type": {
"name": "采暖器件类型"
},
"light_gear": {
"name": "屏幕亮度"
},
"mg_remain": {
"name": "镁离子剩余"
},
@@ -1933,6 +2008,33 @@
"light_brightness": {
"name": "灯光亮度"
},
"bash_target_temperature": {
"name": "卫浴目标温度"
},
"bash_gap_temperature": {
"name": "卫浴回差温度"
},
"heating_target_temperature": {
"name": "采暖目标温度"
},
"heating_gap_temperature": {
"name": "采暖回差温度"
},
"last_time": {
"name": "持续加热时间"
},
"user_mode_target_temperature": {
"name": "用户模式目标温度"
},
"activity_mode_target_temperature": {
"name": "活动模式目标温度"
},
"sleep_mode_target_temperature": {
"name": "睡眠模式目标温度"
},
"light_gear": {
"name": "屏幕亮度"
},
"laundry_height": {
"name": "一键晾衣高度"
},
@@ -2240,6 +2342,18 @@
"buzzer": {
"name": "蜂鸣器"
},
"pump": {
"name": "水泵"
},
"wait_power": {
"name": "待机"
},
"cold_power": {
"name": "防冻"
},
"sleep_power": {
"name": "休眠"
},
"change_litre_switch": {
"name": "换水开关"
},