fix: device humidity and temperature for T0xAC.

This commit is contained in:
sususweet
2025-11-23 01:12:44 +08:00
parent ff39911d1e
commit e5bbcfca94

View File

@@ -1,4 +1,5 @@
from homeassistant.const import Platform, UnitOfTemperature, PRECISION_HALVES, PRECISION_WHOLE from homeassistant.const import Platform, UnitOfTemperature, PRECISION_HALVES, PRECISION_WHOLE, \
CONCENTRATION_PARTS_PER_MILLION, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
# from homeassistant.components.binary_sensor import BinarySensorDeviceClass # from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.components.switch import SwitchDeviceClass from homeassistant.components.switch import SwitchDeviceClass
@@ -6,7 +7,7 @@ from homeassistant.components.switch import SwitchDeviceClass
DEVICE_MAPPING = { DEVICE_MAPPING = {
"default": { "default": {
"rationale": ["off", "on"], "rationale": ["off", "on"],
"queries": [{}, {"query_type":"run_status"}], "queries": [{}, {"query_type":"run_status"}, {"query_type":"indoor_humidity"}, {"query_type":"indoor_temperature"}],
"centralized": [], "centralized": [],
"entities": { "entities": {
Platform.FAN: { Platform.FAN: {
@@ -129,6 +130,156 @@ DEVICE_MAPPING = {
} }
} }
}, },
"22259015": {
"rationale": ["off", "on"],
"queries": [{}, {"query_type": "run_status"}, {"query_type": "module_30"}, {"query_type": "module_31"}, {"query_type": "module_32"}],
"centralized": [],
"calculate": {
"get": [
{
"lvalue": "[indoor_humidity]",
"rvalue": "[humidity_value]"
},
{
"lvalue": "[indoor_temperature]",
"rvalue": "[t1_temp]"
},
{
"lvalue": "[co2_value]",
"rvalue": "[co2_concentration]"
},
{
"lvalue": "[pm25_value]",
"rvalue": "[dust_co2]"
}
],
"set": []
},
"entities": {
Platform.FAN: {
"fan": {
"power": "new_wind_machine",
"speeds": list({"fresh_air_fan_speed": value + 1} for value in range(0, 100)),
"preset_modes": {
"heat_exchange": {
"fresh_air_mode": 1,
"wind_strength": 0
},
"smooth_in": {
"fresh_air_mode": 2,
"wind_strength": 0
},
"rough_in": {
"fresh_air_mode": 2,
"wind_strength": 1
},
"smooth_out": {
"fresh_air_mode": 3,
"wind_strength": 0
},
"rough_out": {
"fresh_air_mode": 3,
"wind_strength": 1
},
"auto": {
"fresh_air_mode": 4,
"wind_strength": 0
},
"innercycle": {
"fresh_air_mode": 5,
"wind_strength": 0
},
}
}
},
Platform.CLIMATE: {
"thermostat": {
"power": "power",
"hvac_modes": {
"off": {"power": "off"},
"heat": {"power": "on", "mode": "heat"},
"cool": {"power": "on", "mode": "cool"},
"auto": {"power": "on", "mode": "auto"},
"dry": {"power": "on", "mode": "dry"},
"fan_only": {"power": "on", "mode": "fan"}
},
"preset_modes": {
"none": {
"eco": "off",
"comfort_power_save": "off",
"cool_power_saving": 0,
"strong_wind": "off"
},
"eco": {"eco": "on", "cool_power_saving": 1},
"comfort": {"comfort_power_save": "on"},
"boost": {"strong_wind": "on"}
},
"swing_modes": {
"off": {"wind_swing_lr": "off", "wind_swing_ud": "off"},
"both": {"wind_swing_lr": "on", "wind_swing_ud": "on"},
"horizontal": {"wind_swing_lr": "on", "wind_swing_ud": "off"},
"vertical": {"wind_swing_lr": "off", "wind_swing_ud": "on"},
},
"fan_modes": {
"silent": {"wind_speed": 20},
"low": {"wind_speed": 40},
"medium": {"wind_speed": 60},
"high": {"wind_speed": 80},
"full": {"wind_speed": 100},
"auto": {"wind_speed": 102}
},
"target_temperature": ["temperature", "small_temperature"],
"current_temperature": "indoor_temperature",
"pre_mode": "mode",
"aux_heat": "ptc",
"min_temp": 17,
"max_temp": 30,
"temperature_unit": UnitOfTemperature.CELSIUS,
"precision": PRECISION_HALVES,
}
},
Platform.SWITCH: {
"dry": {
"device_class": SwitchDeviceClass.SWITCH,
},
"prevent_straight_wind": {
"device_class": SwitchDeviceClass.SWITCH,
"rationale": [0, 1]
},
"aux_heat": {
"device_class": SwitchDeviceClass.SWITCH,
},
"follow_body_sense": {
"device_class": SwitchDeviceClass.SWITCH,
},
},
Platform.SENSOR: {
"mode": {
"device_class": SensorDeviceClass.ENUM,
},
"indoor_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"indoor_humidity": {
"device_class": SensorDeviceClass.HUMIDITY,
"unit_of_measurement": "%",
"state_class": SensorStateClass.MEASUREMENT
},
"co2_value": {
"device_class": SensorDeviceClass.CO2,
"unit_of_measurement": CONCENTRATION_PARTS_PER_MILLION,
"state_class": SensorStateClass.MEASUREMENT,
},
"pm25_value": {
"device_class": SensorDeviceClass.PM25,
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
"state_class": SensorStateClass.MEASUREMENT,
},
}
}
},
"106J6363": { "106J6363": {
"rationale": ["off", "on"], "rationale": ["off", "on"],
"queries": [{}], "queries": [{}],