feat: support more devices.

This commit is contained in:
sususweet
2025-09-24 23:31:31 +08:00
parent 2af99c11da
commit f99019bdca
15 changed files with 2169 additions and 8 deletions

View File

@@ -0,0 +1,199 @@
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime
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": [
"upstair_work_status", "downstair_work_status", "middlestair_work_status",
"upstair_mode", "downstair_mode", "middlestair_mode",
"upstair_temp", "downstair_temp", "middlestair_temp"
],
"entities": {
Platform.BINARY_SENSOR: {
"door_middlestair": {
"device_class": BinarySensorDeviceClass.DOOR,
},
"door_upstair": {
"device_class": BinarySensorDeviceClass.DOOR,
},
"door_downstair": {
"device_class": BinarySensorDeviceClass.DOOR,
},
"downstair_ispreheat": {
"device_class": BinarySensorDeviceClass.RUNNING,
},
"upstair_ispreheat": {
"device_class": BinarySensorDeviceClass.RUNNING,
},
"downstair_iscooling": {
"device_class": BinarySensorDeviceClass.RUNNING,
},
"upstair_iscooling": {
"device_class": BinarySensorDeviceClass.RUNNING,
},
"middlestair_ispreheat": {
"device_class": BinarySensorDeviceClass.RUNNING,
},
"middlestair_iscooling": {
"device_class": BinarySensorDeviceClass.RUNNING,
},
"lock": {
"device_class": BinarySensorDeviceClass.LOCK,
},
"is_error": {
"device_class": BinarySensorDeviceClass.PROBLEM,
},
"uv_disinfect": {
"device_class": BinarySensorDeviceClass.RUNNING,
}
},
Platform.SELECT: {
"upstair_work_status": {
"options": {
"power_off": {"upstair_work_status": "power_off"},
"power_on": {"upstair_work_status": "power_on"},
"working": {"upstair_work_status": "working"},
"pause": {"upstair_work_status": "pause"},
"finish": {"upstair_work_status": "finish"},
"error": {"upstair_work_status": "error"}
}
},
"downstair_work_status": {
"options": {
"power_off": {"downstair_work_status": "power_off"},
"power_on": {"downstair_work_status": "power_on"},
"working": {"downstair_work_status": "working"},
"pause": {"downstair_work_status": "pause"},
"finish": {"downstair_work_status": "finish"},
"error": {"downstair_work_status": "error"}
}
},
"middlestair_work_status": {
"options": {
"power_off": {"middlestair_work_status": "power_off"},
"power_on": {"middlestair_work_status": "power_on"},
"working": {"middlestair_work_status": "working"},
"pause": {"middlestair_work_status": "pause"},
"finish": {"middlestair_work_status": "finish"},
"error": {"middlestair_work_status": "error"}
}
},
"upstair_mode": {
"options": {
"off": {"upstair_mode": "0"},
"bake": {"upstair_mode": "1"},
"roast": {"upstair_mode": "2"},
"grill": {"upstair_mode": "3"},
"convection": {"upstair_mode": "4"},
"defrost": {"upstair_mode": "5"}
}
},
"downstair_mode": {
"options": {
"off": {"downstair_mode": "0"},
"bake": {"downstair_mode": "1"},
"roast": {"downstair_mode": "2"},
"grill": {"downstair_mode": "3"},
"convection": {"downstair_mode": "4"},
"defrost": {"downstair_mode": "5"}
}
},
"middlestair_mode": {
"options": {
"off": {"middlestair_mode": "0"},
"bake": {"middlestair_mode": "1"},
"roast": {"middlestair_mode": "2"},
"grill": {"middlestair_mode": "3"},
"convection": {"middlestair_mode": "4"},
"defrost": {"middlestair_mode": "5"}
}
}
},
Platform.SENSOR: {
"upstair_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"downstair_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"middlestair_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"upstair_hour": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"upstair_min": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"upstair_sec": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.SECONDS,
"state_class": SensorStateClass.MEASUREMENT
},
"middlestair_hour": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"middlestair_min": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"middlestair_sec": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.SECONDS,
"state_class": SensorStateClass.MEASUREMENT
},
"downstair_hour": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"downstair_min": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"downstair_sec": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.SECONDS,
"state_class": SensorStateClass.MEASUREMENT
},
"order_hour": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"order_min": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"order_sec": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.SECONDS,
"state_class": SensorStateClass.MEASUREMENT
},
"version": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}

View File

@@ -0,0 +1,187 @@
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime
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": [
"power", "mode_state", "fan_set", "room_temp_value", "humidity_set"
],
"entities": {
Platform.SWITCH: {
"lock_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"esp_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"passby_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"preheat_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"remain_able": {
"device_class": SwitchDeviceClass.SWITCH,
},
"hcho_check_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"co2_check_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"function_set_link": {
"device_class": SwitchDeviceClass.SWITCH,
},
"function_set_sleep": {
"device_class": SwitchDeviceClass.SWITCH,
},
"function_set_energy_save": {
"device_class": SwitchDeviceClass.SWITCH,
},
"function_set_prheat": {
"device_class": SwitchDeviceClass.SWITCH,
},
"function_set_ultimate": {
"device_class": SwitchDeviceClass.SWITCH,
},
"clean_net_clean_flg": {
"device_class": SwitchDeviceClass.SWITCH,
},
"change_net_change_flg": {
"device_class": SwitchDeviceClass.SWITCH,
},
"condensation_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"humidity_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"preheat_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"esp_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"pm25_check_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"timer_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"freeze_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"humidity_check_enable": {
"device_class": SwitchDeviceClass.SWITCH,
}
},
Platform.SELECT: {
"mode_state": {
"options": {
"passby": {"mode_state": "passby"},
"auto": {"mode_state": "auto"},
"manual": {"mode_state": "manual"},
"sleep": {"mode_state": "sleep"},
"energy_save": {"mode_state": "energy_save"},
"ultimate": {"mode_state": "ultimate"}
}
},
"fan_set": {
"options": {
"off": {"fan_set": "0"},
"low": {"fan_set": "1"},
"medium": {"fan_set": "2"},
"high": {"fan_set": "3"},
"auto": {"fan_set": "4"}
}
}
},
Platform.SENSOR: {
"room_temp_value": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"clean_net_used_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"change_net_used_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"tvoc_value": {
"device_class": SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
"unit_of_measurement": "mg/m³",
"state_class": SensorStateClass.MEASUREMENT
},
"change_set_real_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"clean_set_real_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"error_code": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"humidity_set": {
"device_class": SensorDeviceClass.HUMIDITY,
"unit_of_measurement": "%",
"state_class": SensorStateClass.MEASUREMENT
},
"room_aqi_value": {
"device_class": SensorDeviceClass.AQI,
"state_class": SensorStateClass.MEASUREMENT
},
"change_net_set_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"clean_net_set_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.HOURS,
"state_class": SensorStateClass.MEASUREMENT
},
"humidity_value": {
"device_class": SensorDeviceClass.HUMIDITY,
"unit_of_measurement": "%",
"state_class": SensorStateClass.MEASUREMENT
},
"hcho_value": {
"device_class": SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
"unit_of_measurement": "mg/m³",
"state_class": SensorStateClass.MEASUREMENT
},
"pm25_value": {
"device_class": SensorDeviceClass.PM25,
"unit_of_measurement": "µg/m³",
"state_class": SensorStateClass.MEASUREMENT
},
"co2_value": {
"device_class": SensorDeviceClass.CO2,
"unit_of_measurement": "ppm",
"state_class": SensorStateClass.MEASUREMENT
},
"machine_type": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}

View File

@@ -0,0 +1,168 @@
from homeassistant.const import Platform, UnitOfTemperature, PRECISION_HALVES
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": [
"power_state", "run_mode", "temp_set", "heat_enable", "cool_enable"
],
"entities": {
Platform.CLIMATE: {
"thermostat": {
"power": "power_state",
"hvac_modes": {
"off": {"power_state": "off"},
"heat": {"power_state": "on", "run_mode": "heat", "heat_enable": "on"},
"cool": {"power_state": "on", "run_mode": "cool", "cool_enable": "on"},
"auto": {"power_state": "on", "run_mode": "auto", "heat_enable": "on", "cool_enable": "on"}
},
"target_temperature": "temp_set",
"current_temperature": "cur_temp",
"min_temp": 5,
"max_temp": 70,
"temperature_unit": UnitOfTemperature.CELSIUS,
"precision": PRECISION_HALVES,
}
},
Platform.SWITCH: {
"freeze_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"power_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"heat_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"cool_enable": {
"device_class": SwitchDeviceClass.SWITCH,
},
"silence_set_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"time_set_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"silence_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"holiday_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"holiday_set_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"holiday_on_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"room_temp_ctrl": {
"device_class": SwitchDeviceClass.SWITCH,
},
"room_temp_set": {
"device_class": SwitchDeviceClass.SWITCH,
},
"comp_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"day_time_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"week_time_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"warn_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"defrost_state": {
"device_class": SwitchDeviceClass.SWITCH,
},
"pre_heat": {
"device_class": SwitchDeviceClass.SWITCH,
}
},
Platform.SELECT: {
"run_mode": {
"options": {
"heat": {"run_mode": "heat"},
"cool": {"run_mode": "cool"},
"auto": {"run_mode": "auto"},
"fan": {"run_mode": "fan"},
"dry": {"run_mode": "dry"}
}
},
"temp_type": {
"options": {
"water_temperature": {"temp_type": "water_temperature"},
"room_temperature": {"temp_type": "room_temperature"},
"outdoor_temperature": {"temp_type": "outdoor_temperature"}
}
}
},
Platform.SENSOR: {
"cur_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"error_code": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"heat_max_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"heat_min_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"cool_max_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"cool_min_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"auto_max_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"auto_min_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"preheat_on_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"preheat_max_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"preheat_min_set_temp": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"temp_set": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}

View File

@@ -0,0 +1,186 @@
from homeassistant.const import Platform, UnitOfElectricPotential, UnitOfTemperature, UnitOfTime
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.components.switch import SwitchDeviceClass
DEVICE_MAPPING = {
"default": {
"rationale": [0, 1],
"calculate": {
"get": [
{
"lvalue": "[remaining_time]",
"rvalue": "[db_remain_time]"
}
],
"set": {
}
},
"entities": {
Platform.SWITCH: {
"db_power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_clean_notification": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_softener_needed": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_detergent_needed": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_nightly_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_baby_lock": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_light": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_steam_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_fast_clean_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"db_wash_dry_link": {
"device_class": SwitchDeviceClass.SWITCH,
}
},
Platform.SELECT: {
"db_running_status": {
"options": {
"stop": {"db_running_status": "stop"},
"start": {"db_running_status": "start"},
"pause": {"db_running_status": "pause"},
"finish": {"db_running_status": "finish"},
"error": {"db_running_status": "error"}
}
},
"db_program": {
"options": {
"fast_wash_30": {"db_program": "fast_wash_30"},
"normal_wash": {"db_program": "normal_wash"},
"heavy_wash": {"db_program": "heavy_wash"},
"delicate_wash": {"db_program": "delicate_wash"},
"quick_wash": {"db_program": "quick_wash"},
"eco_wash": {"db_program": "eco_wash"}
}
},
"db_water_level": {
"options": {
"low": {"db_water_level": "1"},
"medium": {"db_water_level": "2"},
"high": {"db_water_level": "3"},
"extra_high": {"db_water_level": "4"}
}
},
"db_temperature": {
"options": {
"cold": {"db_temperature": "1"},
"warm": {"db_temperature": "2"},
"hot": {"db_temperature": "3"},
"extra_hot": {"db_temperature": "4"}
}
},
"dehydration_speed": {
"options": {
"low": {"dehydration_speed": "1"},
"medium": {"dehydration_speed": "2"},
"high": {"dehydration_speed": "3"},
"extra_high": {"dehydration_speed": "4"}
}
},
"db_detergent": {
"options": {
"none": {"db_detergent": "1"},
"little": {"db_detergent": "2"},
"normal": {"db_detergent": "3"},
"more": {"db_detergent": "4"}
}
},
"db_softener": {
"options": {
"none": {"db_softener": "1"},
"little": {"db_softener": "2"},
"normal": {"db_softener": "3"},
"more": {"db_softener": "4"}
}
},
"db_position": {
"options": {
"position_1": {"db_position": "1"},
"position_2": {"db_position": "2"},
"position_3": {"db_position": "3"}
}
},
"db_location": {
"options": {
"location_1": {"db_location": "1"},
"location_2": {"db_location": "2"},
"location_3": {"db_location": "3"}
}
}
},
Platform.SENSOR: {
"db_remain_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"db_progress": {
"device_class": SensorDeviceClass.BATTERY,
"unit_of_measurement": "%",
"state_class": SensorStateClass.MEASUREMENT
},
"db_error_code": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"db_set_dewater_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"db_set_wash_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"db_device_software_version": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"db_rinse_count": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"db_wash_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"db_appointment_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"db_appointment": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"db_dehydration_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"db_cycle_memory": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}

View File

@@ -0,0 +1,399 @@
from homeassistant.const import Platform, UnitOfElectricPotential, UnitOfTemperature, UnitOfTime
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.components.switch import SwitchDeviceClass
DEVICE_MAPPING = {
"default": {
"rationale": [0, 1],
"calculate": {
"get": [
{
"lvalue": "[remaining_time]",
"rvalue": "[remain_time]"
}
],
"set": {
}
},
"entities": {
Platform.SWITCH: {
"power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"softener_lack": {
"device_class": SwitchDeviceClass.SWITCH,
},
"detergent_lack": {
"device_class": SwitchDeviceClass.SWITCH,
},
"door_opened": {
"device_class": SwitchDeviceClass.SWITCH,
},
"bucket_water_overheating": {
"device_class": SwitchDeviceClass.SWITCH,
},
"memory": {
"device_class": SwitchDeviceClass.SWITCH,
},
"appointment": {
"device_class": SwitchDeviceClass.SWITCH,
},
"spray_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"old_speedy": {
"device_class": SwitchDeviceClass.SWITCH,
},
"nightly": {
"device_class": SwitchDeviceClass.SWITCH,
},
"down_light": {
"device_class": SwitchDeviceClass.SWITCH,
},
"easy_ironing": {
"device_class": SwitchDeviceClass.SWITCH,
},
"super_clean_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"intelligent_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"strong_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"silent": {
"device_class": SwitchDeviceClass.SWITCH,
},
"speedy": {
"device_class": SwitchDeviceClass.SWITCH,
},
"lock": {
"device_class": SwitchDeviceClass.SWITCH,
},
"flocks_switcher": {
"device_class": SwitchDeviceClass.SWITCH,
},
"fresh_anion_switch": {
"device_class": SwitchDeviceClass.SWITCH,
},
"dry_weighing_already": {
"device_class": SwitchDeviceClass.SWITCH,
},
"keep_fresh_status": {
"device_class": SwitchDeviceClass.SWITCH,
},
"drying_tunnel_overheating": {
"device_class": SwitchDeviceClass.SWITCH,
},
"fast_clean_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"steam_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"beforehand_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"ai_flag": {
"device_class": SwitchDeviceClass.SWITCH,
},
"water_plus": {
"device_class": SwitchDeviceClass.SWITCH,
},
"soak": {
"device_class": SwitchDeviceClass.SWITCH,
},
"ultraviolet_lamp": {
"device_class": SwitchDeviceClass.SWITCH,
},
"eye_wash": {
"device_class": SwitchDeviceClass.SWITCH,
},
"microbubble": {
"device_class": SwitchDeviceClass.SWITCH,
},
"wind_dispel": {
"device_class": SwitchDeviceClass.SWITCH,
},
"cycle_memory": {
"device_class": SwitchDeviceClass.SWITCH,
}
},
Platform.SELECT: {
"running_status": {
"options": {
"standby": {"running_status": "standby"},
"running": {"running_status": "running"},
"pause": {"running_status": "pause"},
"finish": {"running_status": "finish"},
"error": {"running_status": "error"}
}
},
"db_dehydration_speed": {
"options": {
"low": {"db_dehydration_speed": "1"},
"medium": {"db_dehydration_speed": "2"},
"high": {"db_dehydration_speed": "3"},
"extra_high": {"db_dehydration_speed": "4"}
}
},
"mode": {
"options": {
"normal": {"mode": "normal"},
"eco": {"mode": "eco"},
"quick": {"mode": "quick"},
"heavy": {"mode": "heavy"},
"delicate": {"mode": "delicate"}
}
},
"water_level": {
"options": {
"low": {"water_level": "low"},
"medium": {"water_level": "medium"},
"high": {"water_level": "high"},
"extra_high": {"water_level": "extra_high"}
}
},
"program": {
"options": {
"ssp": {"program": "ssp"},
"cotton": {"program": "cotton"},
"synthetic": {"program": "synthetic"},
"wool": {"program": "wool"},
"delicate": {"program": "delicate"},
"quick": {"program": "quick"}
}
},
"temperature": {
"options": {
"cold": {"temperature": "cold"},
"warm": {"temperature": "warm"},
"hot": {"temperature": "hot"},
"extra_hot": {"temperature": "extra_hot"}
}
},
"detergent_density": {
"options": {
"low": {"detergent_density": "low"},
"medium": {"detergent_density": "medium"},
"high": {"detergent_density": "high"},
"extra_high": {"detergent_density": "extra_high"}
}
},
"softener_density": {
"options": {
"low": {"softener_density": "low"},
"medium": {"softener_density": "medium"},
"high": {"softener_density": "high"},
"extra_high": {"softener_density": "extra_high"}
}
},
"detergent": {
"options": {
"none": {"detergent": "none"},
"little": {"detergent": "little"},
"normal": {"detergent": "normal"},
"more": {"detergent": "more"}
}
},
"softener": {
"options": {
"none": {"softener": "none"},
"little": {"softener": "little"},
"normal": {"softener": "normal"},
"more": {"softener": "more"}
}
},
"season": {
"options": {
"spring": {"season": "spring"},
"summer": {"season": "summer"},
"autumn": {"season": "autumn"},
"winter": {"season": "winter"}
}
},
"disinfectant": {
"options": {
"none": {"disinfectant": "none"},
"light": {"disinfectant": "light"},
"medium": {"disinfectant": "medium"},
"strong": {"disinfectant": "strong"}
}
},
"dirty_degree": {
"options": {
"light": {"dirty_degree": "light"},
"medium": {"dirty_degree": "medium"},
"heavy": {"dirty_degree": "heavy"},
"extra_heavy": {"dirty_degree": "extra_heavy"}
}
},
"stains": {
"options": {
"none": {"stains": "none"},
"light": {"stains": "light"},
"medium": {"stains": "medium"},
"heavy": {"stains": "heavy"}
}
},
"add_rinse": {
"options": {
"none": {"add_rinse": "none"},
"one": {"add_rinse": "one"},
"two": {"add_rinse": "two"},
"three": {"add_rinse": "three"}
}
},
"soak_count": {
"options": {
"none": {"soak_count": "none"},
"one": {"soak_count": "one"},
"two": {"soak_count": "two"},
"three": {"soak_count": "three"}
}
}
},
Platform.SENSOR: {
"wash_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"appointment_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"remain_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"dryer": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"remote_control_flag": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"progress": {
"device_class": SensorDeviceClass.BATTERY,
"unit_of_measurement": "%",
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_low": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_high": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai1": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai2": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai3": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai4": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai_time1": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"dehydration_time_value": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai_time3": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai_time4": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"customize_machine_cycle": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"detergent_global": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"softener_global": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"detergent_density_global": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"softener_density_global": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"fresh_air_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"flocks_remind_period": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"device_software_version": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"expert_step": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"error_code": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"flocks_wash_count": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"active_oxygen": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"dehydration_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"cloud_cycle_jiepai_time2": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"wash_time_value": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}

View File

@@ -0,0 +1,153 @@
from homeassistant.const import Platform, UnitOfTime
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": [
"power", "ai_switch", "light", "appointment", "prevent_wrinkle_switch",
"steam_switch", "damp_dry_signal", "eco_dry_switch", "bucket_clean_switch",
"water_box", "baby_lock", "remind_sound", "steam", "prevent_wrinkle",
"material", "sterilize", "dryness_level", "dry_temp", "intensity", "program"
],
"entities": {
Platform.SWITCH: {
"ai_switch": {
"device_class": SwitchDeviceClass.SWITCH,
},
"light": {
"device_class": SwitchDeviceClass.SWITCH,
},
"appointment": {
"device_class": SwitchDeviceClass.SWITCH,
},
"prevent_wrinkle_switch": {
"device_class": SwitchDeviceClass.SWITCH,
},
"steam_switch": {
"device_class": SwitchDeviceClass.SWITCH,
},
"damp_dry_signal": {
"device_class": SwitchDeviceClass.SWITCH,
},
"eco_dry_switch": {
"device_class": SwitchDeviceClass.SWITCH,
},
"bucket_clean_switch": {
"device_class": SwitchDeviceClass.SWITCH,
},
"water_box": {
"device_class": SwitchDeviceClass.SWITCH,
},
"baby_lock": {
"device_class": SwitchDeviceClass.SWITCH,
},
"remind_sound": {
"device_class": SwitchDeviceClass.SWITCH,
},
"steam": {
"device_class": SwitchDeviceClass.SWITCH,
},
"power": {
"device_class": SwitchDeviceClass.SWITCH,
}
},
Platform.BINARY_SENSOR: {
"door_warn": {
"device_class": BinarySensorDeviceClass.PROBLEM,
}
},
Platform.SELECT: {
"prevent_wrinkle": {
"options": {
"off": {"prevent_wrinkle": "0"},
"low": {"prevent_wrinkle": "1"},
"medium": {"prevent_wrinkle": "2"},
"high": {"prevent_wrinkle": "3"}
}
},
"material": {
"options": {
"cotton": {"material": "0"},
"synthetic": {"material": "1"},
"wool": {"material": "2"},
"delicate": {"material": "3"},
"mixed": {"material": "4"}
}
},
"sterilize": {
"options": {
"off": {"sterilize": "0"},
"on": {"sterilize": "1"}
}
},
"dryness_level": {
"options": {
"extra_dry": {"dryness_level": "0"},
"dry": {"dryness_level": "1"},
"normal": {"dryness_level": "2"},
"damp": {"dryness_level": "3"}
}
},
"dry_temp": {
"options": {
"low": {"dry_temp": "0"},
"medium": {"dry_temp": "1"},
"high": {"dry_temp": "2"},
"extra_high": {"dry_temp": "3"}
}
},
"intensity": {
"options": {
"low": {"intensity": "0"},
"medium": {"intensity": "1"},
"high": {"intensity": "2"}
}
},
"program": {
"options": {
"mixed_wash": {"program": "mixed_wash"},
"cotton": {"program": "cotton"},
"synthetic": {"program": "synthetic"},
"wool": {"program": "wool"},
"delicate": {"program": "delicate"},
"quick": {"program": "quick"},
"eco": {"program": "eco"}
}
}
},
Platform.SENSOR: {
"appointment_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"remain_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"progress": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"version": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"error_code": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"dry_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}

View File

@@ -0,0 +1,158 @@
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.components.switch import SwitchDeviceClass
from homeassistant.components.humidifier import HumidifierDeviceClass
DEVICE_MAPPING = {
"default": {
"rationale": ["off", "on"],
"queries": [{}],
"centralized": [
"power", "disinfect_on_off", "netions_on_off", "airdry_on_off",
"wind_gear", "wind_speed", "light_color", "bright_led",
"humidity_mode", "tank_status", "humidity", "cur_humidity"
],
"entities": {
Platform.SWITCH: {
"disinfect_on_off": {
"device_class": SwitchDeviceClass.SWITCH,
},
"netions_on_off": {
"device_class": SwitchDeviceClass.SWITCH,
},
"airdry_on_off": {
"device_class": SwitchDeviceClass.SWITCH,
},
"power": {
"device_class": SwitchDeviceClass.SWITCH,
},
"buzzer": {
"device_class": SwitchDeviceClass.SWITCH,
},
"power_on_timer": {
"device_class": SwitchDeviceClass.SWITCH,
},
"power_off_timer": {
"device_class": SwitchDeviceClass.SWITCH,
},
"display_on_off": {
"device_class": SwitchDeviceClass.SWITCH,
}
},
Platform.BINARY_SENSOR: {
"add_water_flag": {
"device_class": BinarySensorDeviceClass.PROBLEM,
}
},
Platform.HUMIDIFIER: {
"humidifier": {
"device_class": HumidifierDeviceClass.HUMIDIFIER,
"power": "power",
"target_humidity": "humidity",
"current_humidity": "cur_humidity",
"min_humidity": 30,
"max_humidity": 80,
"mode": "humidity_mode",
"modes": {
"manual": {"humidity_mode": "manual"},
"auto": {"humidity_mode": "auto"},
"sleep": {"humidity_mode": "sleep"},
"baby": {"humidity_mode": "baby"}
}
}
},
Platform.SELECT: {
"wind_gear": {
"options": {
"low": {"wind_gear": "low"},
"medium": {"wind_gear": "medium"},
"high": {"wind_gear": "high"},
"auto": {"wind_gear": "auto"},
"invalid": {"wind_gear": "invalid"}
}
},
"wind_speed": {
"options": {
"low": {"wind_speed": "low"},
"medium": {"wind_speed": "medium"},
"high": {"wind_speed": "high"},
"auto": {"wind_speed": "auto"}
}
},
"light_color": {
"options": {
"warm": {"light_color": "warm"},
"cool": {"light_color": "cool"},
"white": {"light_color": "white"},
"blue": {"light_color": "blue"},
"green": {"light_color": "green"},
"red": {"light_color": "red"},
"off": {"light_color": "off"}
}
},
"bright_led": {
"options": {
"light": {"bright_led": "light"},
"dim": {"bright_led": "dim"},
"off": {"bright_led": "off"}
}
},
"tank_status": {
"options": {
"normal": {"tank_status": "0"},
"low": {"tank_status": "1"},
"empty": {"tank_status": "2"},
"error": {"tank_status": "3"}
}
}
},
Platform.SENSOR: {
"running_percent": {
"device_class": SensorDeviceClass.POWER_FACTOR,
"unit_of_measurement": PERCENTAGE,
"state_class": SensorStateClass.MEASUREMENT
},
"error_code": {
"device_class": SensorDeviceClass.ENUM,
"state_class": SensorStateClass.MEASUREMENT
},
"cur_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"sensor_battery": {
"device_class": SensorDeviceClass.BATTERY,
"unit_of_measurement": PERCENTAGE,
"state_class": SensorStateClass.MEASUREMENT
},
"sensor_humidify": {
"device_class": SensorDeviceClass.HUMIDITY,
"unit_of_measurement": PERCENTAGE,
"state_class": SensorStateClass.MEASUREMENT
},
"sensor_temperature": {
"device_class": SensorDeviceClass.TEMPERATURE,
"unit_of_measurement": UnitOfTemperature.CELSIUS,
"state_class": SensorStateClass.MEASUREMENT
},
"air_dry_left_time": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"time_on": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
},
"time_off": {
"device_class": SensorDeviceClass.DURATION,
"unit_of_measurement": UnitOfTime.MINUTES,
"state_class": SensorStateClass.MEASUREMENT
}
}
}
}
}