feat: update device mapping for T0xFA

This commit is contained in:
sususweet
2025-11-04 16:03:17 +08:00
parent 05ad0c3a15
commit a680cd43b8
4 changed files with 98 additions and 55 deletions

View File

@@ -45,14 +45,7 @@ DEVICE_MAPPING = {
Platform.FAN: {
"fan": {
"power": "fan_power",
"speeds": [
{"fan_speed": "1"},
{"fan_speed": "2"},
{"fan_speed": "3"},
{"fan_speed": "4"},
{"fan_speed": "5"},
{"fan_speed": "6"},
],
"speeds": list({"fan_speed": value + 1} for value in range(0, 6)),
"preset_modes": {
"breathing_wind": {"fan_scene": "breathing_wind"},
"const_temperature": {"fan_scene": "const_temperature"},

View File

@@ -12,13 +12,7 @@ DEVICE_MAPPING = {
Platform.FAN: {
"fan": {
"power": "new_wind_machine",
"speeds": [
{"fresh_air_fan_speed": 20},
{"fresh_air_fan_speed": 40},
{"fresh_air_fan_speed": 60},
{"fresh_air_fan_speed": 80},
{"fresh_air_fan_speed": 100},
],
"speeds": list({"fresh_air_fan_speed": value + 1} for value in range(0, 100)),
"preset_modes": {
"heat_exchange": {
"fresh_air_mode": 1,
@@ -166,13 +160,7 @@ DEVICE_MAPPING = {
Platform.FAN: {
"fan": {
"power": "fresh_air",
"speeds": [
{"fresh_air": 3, "fresh_air_fan_speed": 20},
{"fresh_air": 3, "fresh_air_fan_speed": 40},
{"fresh_air": 3, "fresh_air_fan_speed": 60},
{"fresh_air": 3, "fresh_air_fan_speed": 80},
{"fresh_air": 3, "fresh_air_fan_speed": 100},
],
"speeds": list({"fresh_air": 3, "fresh_air_fan_speed": value + 1} for value in range(0, 100)),
"preset_modes": {
"heat_exchange": {
"fresh_air_mode": 1,

View File

@@ -1,4 +1,4 @@
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE, DEGREE
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.components.switch import SwitchDeviceClass
@@ -23,17 +23,7 @@ DEVICE_MAPPING = {
Platform.FAN: {
"fan": {
"power": "power",
"speeds": [
{"gear": "1"},
{"gear": "2"},
{"gear": "3"},
{"gear": "4"},
{"gear": "5"},
{"gear": "6"},
{"gear": "7"},
{"gear": "8"},
{"gear": "9"},
],
"speeds": list({"gear": value + 1} for value in range(0, 9)),
"oscillate": "swing",
"preset_modes": {
"normal": {"mode": "normal"},
@@ -102,26 +92,6 @@ DEVICE_MAPPING = {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"timer_off_hour": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"timer_off_minute": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"timer_on_hour": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"timer_on_minute": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"pm25": {
"device_class": SensorDeviceClass.PM25,
"unit_of_measurement": "µg/m³",
@@ -153,5 +123,86 @@ DEVICE_MAPPING = {
}
}
}
},
"xxxxxx": {
"rationale": ["off", "on"],
"queries": [{}],
"centralized": [
"power", "gear"
],
"entities": {
Platform.SWITCH: {
"display_on_off": {
"device_class": SwitchDeviceClass.SWITCH,
"rationale": ["on", "off"]
},
"anion": {
"device_class": SwitchDeviceClass.SWITCH,
},
"temp_wind_switch": {
"device_class": SwitchDeviceClass.SWITCH,
},
},
Platform.FAN: {
"fan": {
"power": "power",
"speeds": list({"gear": value + 1} for value in range(0, 100)),
"preset_modes": {
"self_selection": {"mode": "self_selection"},
"sleeping_wind": {"mode": "sleeping_wind"},
"purified_wind": {"mode": "purified_wind"}
}
}
},
Platform.SELECT: {
"voice": {
"options": {
"open_buzzer": {"voice": "open_buzzer"},
"close_buzzer": {"voice": "close_buzzer"},
"mute": {"voice": "mute"}
}
},
"lr_shake_switch": {
"options": {
"off": {"lr_shake_switch": "off"},
"default": {"lr_shake_switch": "default"},
"normal": {"lr_shake_switch": "normal"},
}
},
"ud_shake_switch": {
"options": {
"off": {"ud_shake_switch": "off"},
"default": {"ud_shake_switch": "default"},
"normal": {"ud_shake_switch": "normal"},
}
},
},
Platform.SENSOR: {
"real_gear": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"dust_life_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"filter_life_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"current_angle": {
"device_class": SensorDeviceClass.WIND_DIRECTION,
"unit_of_measurement": DEGREE,
"state_class": SensorStateClass.MEASUREMENT
},
"target_angle": {
"device_class": SensorDeviceClass.WIND_DIRECTION,
"unit_of_measurement": DEGREE,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}