mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2026-02-18 09:38:05 +00:00
* Note: `power` is the washing machine's power switch,
`db_running_status` only displays the running status of the current drum,
`db_control_status` is the switch to start or pause the current drum.
117 lines
4.9 KiB
Python
117 lines
4.9 KiB
Python
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": ["off", "on"],
|
|
"queries": [{"query_type": "db"}],
|
|
"calculate": {
|
|
"get": [
|
|
{
|
|
"lvalue": "[remaining_time]",
|
|
"rvalue": "[db_remain_time]"
|
|
}
|
|
],
|
|
"set": {
|
|
}
|
|
},
|
|
"entities": {
|
|
Platform.BINARY_SENSOR: {
|
|
"db_power": {
|
|
"device_class": BinarySensorDeviceClass.RUNNING,
|
|
},
|
|
},
|
|
Platform.SWITCH: {
|
|
"db_power": {
|
|
"device_class": SwitchDeviceClass.SWITCH,
|
|
},
|
|
"db_control_status": {
|
|
"device_class": SwitchDeviceClass.SWITCH,
|
|
"rationale": ["pause", "start"],
|
|
"translation_key": "control_status",
|
|
}
|
|
},
|
|
Platform.SELECT: {
|
|
"db_location_selection": {
|
|
"options": {
|
|
"left": {"db_location_selection": "left"},
|
|
"right": {"db_location_selection": "right"}
|
|
}
|
|
},
|
|
"db_program": {
|
|
"options": {
|
|
"baby_clothes": {"db_program": "baby_clothes"},
|
|
"baby_clothes_dry": {"db_program": "151"},
|
|
"clean_stains": {"db_program": "clean_stains"},
|
|
"cold_wash": {"db_program": "cold_wash"},
|
|
"cook_wash": {"db_program": "cook_wash"},
|
|
"fast_wash": {"db_program": "137"},
|
|
"hot_wind_dry": {"db_program": "153"},
|
|
"rinsing_dehydration": {"db_program": "rinsing_dehydration"},
|
|
"self_wash_5": {"db_program": "self_wash_5"},
|
|
"single_dehytration": {"db_program": "single_dehytration"},
|
|
"single_drying": {"db_program": "single_drying"},
|
|
"small_wash_dry": {"db_program": "138"},
|
|
"socks": {"db_program": "148"},
|
|
"standard": {"db_program": "standard"},
|
|
"underpants": {"db_program": "156"},
|
|
"underwear": {"db_program": "underwear"},
|
|
"water_ssp": {"db_program": "water_ssp"}
|
|
}
|
|
}
|
|
},
|
|
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
|
|
},
|
|
"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_rinse_count": {
|
|
"device_class": SensorDeviceClass.ENUM
|
|
},
|
|
"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
|
|
},
|
|
"db_dehydration_time": {
|
|
"device_class": SensorDeviceClass.DURATION,
|
|
"unit_of_measurement": UnitOfTime.MINUTES,
|
|
"state_class": SensorStateClass.MEASUREMENT
|
|
},
|
|
"db_cycle_memory": {
|
|
"device_class": SensorDeviceClass.ENUM
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|