This commit is contained in:
unknown
2023-09-17 19:40:54 +08:00
parent df4d25f5d0
commit 7263e09692
16 changed files with 1595 additions and 509 deletions

View File

@@ -1,15 +1,17 @@
from homeassistant.const import *
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
# from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.components.switch import SwitchDeviceClass
DEVICE_MAPPING = {
"default": {
"manufacturer": "美的",
"rationale": ["off", "on"],
"queries": [{}, {"query_type": "prevent_straight_wind"}],
"centralized": ["power", "temperature", "small_temperature", "mode", "eco", "comfort_power_save",
"comfort_sleep", "strong_wind", "wind_swing_lr", "wind_swing_lr", "wind_speed",
"ptc", "dry"],
"centralized": [
"power", "temperature", "small_temperature", "mode", "eco",
"comfort_power_save", "comfort_sleep", "strong_wind",
"wind_swing_lr", "wind_swing_lr", "wind_speed","ptc", "dry"
],
"entities": {
Platform.CLIMATE: {
"thermostat": {
@@ -60,42 +62,37 @@ DEVICE_MAPPING = {
},
Platform.SWITCH: {
"dry": {
"name": "干燥",
"device_class": SwitchDeviceClass.SWITCH,
},
"prevent_straight_wind": {
"name": "防直吹",
"device_class": SwitchDeviceClass.SWITCH,
"rationale": [1, 2]
},
"aux_heat": {
"name": "电辅热",
"device_class": SwitchDeviceClass.SWITCH,
}
},
Platform.SENSOR: {
"indoor_temperature": {
"name": "室内温度",
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": TEMP_CELSIUS,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"outdoor_temperature": {
"name": "室外机温度",
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": TEMP_CELSIUS,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
}
}
},
"22012227": {
"manufacturer": "美的",
"rationale": ["off", "on"],
"queries": [{}, {"query_type": "prevent_straight_wind"}],
"centralized": ["power", "temperature", "small_temperature", "mode", "eco", "comfort_power_save",
"comfort_sleep", "strong_wind", "wind_swing_lr", "wind_swing_lr", "wind_speed",
"comfort_sleep", "strong_wind", "wind_swing_lr", "wind_swing_ud", "wind_speed",
"ptc", "dry"],
"entities": {
Platform.CLIMATE: {
"thermostat": {
@@ -140,7 +137,7 @@ DEVICE_MAPPING = {
"aux_heat": "ptc",
"min_temp": 17,
"max_temp": 30,
"temperature_unit": TEMP_CELSIUS,
"temperature_unit": UnitOfTemperature.CELSIUS,
"precision": PRECISION_HALVES,
}
},
@@ -160,82 +157,12 @@ DEVICE_MAPPING = {
}
},
Platform.SENSOR: {
"indoor_temperature": {
"name": "室内温度",
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": TEMP_CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"outdoor_temperature": {
"name": "室外机温度",
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": TEMP_CELSIUS,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
},
Platform.BINARY_SENSOR: {
"power": {}
},
Platform.SELECT: {
"preset_modes": {
"options": {
"none": {
"eco": "off",
"comfort_power_save": "off",
"comfort_sleep": "off",
"strong_wind": "off"
},
"eco": {"eco": "on"},
"comfort": {"comfort_power_save": "on"},
"sleep": {"comfort_sleep": "on"},
"boost": {"strong_wind": "on"}
}
},
"hvac_modes": {
"options": {
"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"}
}
}
},
Platform.WATER_HEATER:{
"water_heater": {
"name": "热水器",
"power": "power",
"operation_list": {
"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"}
},
"target_temperature": ["temperature", "small_temperature"],
"current_temperature": "indoor_temperature",
"min_temp": 17,
"max_temp": 30,
"temperature_unit": TEMP_CELSIUS,
"precision": PRECISION_HALVES,
}
},
Platform.FAN: {
"fan": {
"power": "power",
"preset_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"}
},
"oscillate": "wind_swing_lr",
"speeds": list({"wind_speed": value + 1} for value in range(0, 100)),
}
}
}
}