mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-11-12 16:01:54 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc5ec70819 | ||
|
|
37ace3d764 | ||
|
|
7476d6ad1d | ||
|
|
883369184b | ||
|
|
4fe689217a | ||
|
|
a680cd43b8 | ||
|
|
05ad0c3a15 | ||
|
|
aea43aad0c |
@@ -34,10 +34,12 @@ Get devices from MSmartHome/Midea Meiju homes through the network and control th
|
||||
- T0xB8 Smart Robot Vacuum
|
||||
- T0xCA French Door Refrigerator
|
||||
- T0xCC Central Air Conditioning (Ducted) Wi-Fi Controller
|
||||
- T0xCD Air Energy Water Heater
|
||||
- T0xCE Fresh Air System
|
||||
- T0xCF Central Air Conditioning Heating
|
||||
- T0xD9 Twin Tub Washing Machine
|
||||
- T0xDB Front Load Washing Machine
|
||||
- T0xDA Impeller Washing Machine
|
||||
- T0xDB Cylinder Washing Machine
|
||||
- T0xDC Clothes Dryer
|
||||
- T0xE1 Dishwasher
|
||||
- T0xE2 Electric Water Heater
|
||||
@@ -46,6 +48,7 @@ Get devices from MSmartHome/Midea Meiju homes through the network and control th
|
||||
- T0xED Water Softener
|
||||
- T0xFA Electric Fan
|
||||
- T0xFB Electric Heater
|
||||
- T0xFC Air Purifier
|
||||
- T0xFD Humidifier
|
||||
|
||||
Welcome to collaborate on adding support for more devices.
|
||||
|
||||
@@ -34,9 +34,11 @@
|
||||
- T0xB8 智能扫地机器人
|
||||
- T0xCA 对开门冰箱
|
||||
- T0xCC 中央空调(风管机)Wi-Fi线控器
|
||||
- T0xCD 空气能热水器
|
||||
- T0xCE 新风机
|
||||
- T0xCF 中央空调暖家
|
||||
- T0xD9 复式洗衣机
|
||||
- T0xDA 波轮洗衣机
|
||||
- T0xDB 滚筒洗衣机
|
||||
- T0xDC 干衣机
|
||||
- T0xE1 洗碗机
|
||||
@@ -46,6 +48,7 @@
|
||||
- T0xED 软水机
|
||||
- T0xFA 电风扇
|
||||
- T0xFB 电暖器
|
||||
- T0xFC 空气净化器
|
||||
- T0xFD 加湿器
|
||||
|
||||
欢迎合作开发添加更多设备支持。
|
||||
|
||||
@@ -140,11 +140,6 @@ async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry):
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType):
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
|
||||
# 使用Home Assistant配置目录而不是当前工作目录
|
||||
config_dir = hass.config.path(DOMAIN)
|
||||
os.makedirs(config_dir, exist_ok=True)
|
||||
|
||||
os.makedirs(hass.config.path(STORAGE_PATH), exist_ok=True)
|
||||
lua_path = hass.config.path(STORAGE_PATH)
|
||||
|
||||
@@ -263,6 +258,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
|
||||
protocol=info.get(CONF_PROTOCOL) or 2,
|
||||
model=info.get(CONF_MODEL),
|
||||
subtype=info.get(CONF_MODEL_NUMBER),
|
||||
manufacturer_code=info.get(CONF_MANUFACTURER_CODE),
|
||||
sn=info.get(CONF_SN),
|
||||
sn8=info.get(CONF_SN8),
|
||||
lua_file=file,
|
||||
|
||||
@@ -27,6 +27,7 @@ clouds = {
|
||||
"app_key": "ac21b9f9cbfe4ca5a88562ef25e2b768",
|
||||
"iot_key": bytes.fromhex(format(7882822598523843940, 'x')).decode(),
|
||||
"hmac_key": bytes.fromhex(format(117390035944627627450677220413733956185864939010425, 'x')).decode(),
|
||||
# "api_url": "https://mp-eu-prod.appsmb.com/mas/v5/app/proxy?alias=",
|
||||
"api_url": "https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=",
|
||||
},
|
||||
}
|
||||
@@ -636,6 +637,55 @@ class MSmartHomeCloud(MideaCloud):
|
||||
fp.write(stream)
|
||||
return fnm
|
||||
|
||||
async def get_device_status(
|
||||
self,
|
||||
appliance_code: int,
|
||||
device_type: int,
|
||||
sn: str,
|
||||
model_number: str | None,
|
||||
manufacturer_code: str = "0000",
|
||||
query: dict = {}
|
||||
) -> dict | None:
|
||||
data = {
|
||||
"clientType": "1",
|
||||
"appId": self.APP_ID,
|
||||
"format": "2",
|
||||
"deviceId": self._device_id,
|
||||
"iotAppId": self.APP_ID,
|
||||
"applianceMFCode": manufacturer_code,
|
||||
"applianceType": "0x%02X" % device_type,
|
||||
"modelNumber": model_number,
|
||||
"applianceSn": self._security.aes_encrypt_with_fixed_key(sn.encode("ascii")).hex(),
|
||||
"version": "0",
|
||||
"encryptedType ": "2",
|
||||
"applianceCode": appliance_code,
|
||||
"command": {
|
||||
"query": query
|
||||
}
|
||||
}
|
||||
if response := await self._api_request(
|
||||
endpoint="/v1/device/status/lua/get",
|
||||
data=data
|
||||
):
|
||||
# 预期返回形如 { ... 状态键 ... }
|
||||
return response
|
||||
return None
|
||||
|
||||
async def send_device_control(self, appliance_code: int, control: dict, status: dict | None = None) -> bool:
|
||||
data = {
|
||||
"applianceCode": str(appliance_code),
|
||||
"command": {
|
||||
"control": control
|
||||
}
|
||||
}
|
||||
if status and isinstance(status, dict):
|
||||
data["command"]["status"] = status
|
||||
response = await self._api_request(
|
||||
endpoint="/v1/device/lua/control",
|
||||
data=data
|
||||
)
|
||||
return response is not None
|
||||
|
||||
|
||||
def get_midea_cloud(cloud_name: str, session: ClientSession, account: str, password: str) -> MideaCloud | None:
|
||||
cloud = None
|
||||
|
||||
@@ -3,7 +3,7 @@ import socket
|
||||
import traceback
|
||||
from enum import IntEnum
|
||||
|
||||
from .cloud import MideaCloud
|
||||
from .cloud import MideaCloud, MSmartHomeCloud
|
||||
from .security import LocalSecurity, MSGTYPE_HANDSHAKE_REQUEST, MSGTYPE_ENCRYPTED_REQUEST
|
||||
from .packet_builder import PacketBuilder
|
||||
from .message import MessageQuestCustom
|
||||
@@ -42,6 +42,7 @@ class MiedaDevice(threading.Thread):
|
||||
protocol: int,
|
||||
model: str | None,
|
||||
subtype: int | None,
|
||||
manufacturer_code: str | None,
|
||||
connected: bool,
|
||||
sn: str | None,
|
||||
sn8: str | None,
|
||||
@@ -65,6 +66,7 @@ class MiedaDevice(threading.Thread):
|
||||
self._subtype = subtype
|
||||
self._sn = sn
|
||||
self._sn8 = sn8
|
||||
self._manufacturer_code = manufacturer_code
|
||||
self._attributes = {
|
||||
"device_type": "T0x%02X" % device_type,
|
||||
"sn": sn,
|
||||
@@ -269,47 +271,70 @@ class MiedaDevice(threading.Thread):
|
||||
|
||||
async def refresh_status(self):
|
||||
for query in self._queries:
|
||||
if self._lua_runtime is not None:
|
||||
if query_cmd := self._lua_runtime.build_query(query):
|
||||
await self._build_send(query_cmd)
|
||||
cloud = self._cloud
|
||||
if cloud and hasattr(cloud, "get_device_status"):
|
||||
if isinstance(cloud, MSmartHomeCloud):
|
||||
status = await cloud.get_device_status(
|
||||
appliance_code=self._device_id,
|
||||
device_type=self.device_type,
|
||||
sn=self.sn,
|
||||
model_number=self.subtype,
|
||||
manufacturer_code=self._manufacturer_code,
|
||||
query=query
|
||||
)
|
||||
else:
|
||||
status = await cloud.get_device_status(
|
||||
appliance_code=self._device_id,
|
||||
query=query
|
||||
)
|
||||
|
||||
def _parse_cloud_message(self, decrypted):
|
||||
self._parse_cloud_message(status)
|
||||
# if self._lua_runtime is not None:
|
||||
# if query_cmd := self._lua_runtime.build_query(query):
|
||||
# try:
|
||||
# await self._build_send(query_cmd)
|
||||
# return
|
||||
# except Exception as e:
|
||||
# traceback.print_exc()
|
||||
|
||||
|
||||
def _parse_cloud_message(self, status):
|
||||
# MideaLogger.debug(f"Received: {decrypted}")
|
||||
if status := self._lua_runtime.decode_status(dec_string_to_bytes(decrypted).hex()):
|
||||
MideaLogger.debug(f"Decoded: {status}")
|
||||
new_status = {}
|
||||
for single in status.keys():
|
||||
value = status.get(single)
|
||||
if single not in self._attributes or self._attributes[single] != value:
|
||||
self._attributes[single] = value
|
||||
new_status[single] = value
|
||||
if len(new_status) > 0:
|
||||
for c in self._calculate_get:
|
||||
lvalue = c.get("lvalue")
|
||||
rvalue = c.get("rvalue")
|
||||
if lvalue and rvalue:
|
||||
calculate = False
|
||||
for s, v in new_status.items():
|
||||
if rvalue.find(f"[{s}]") >= 0:
|
||||
calculate = True
|
||||
break
|
||||
if calculate:
|
||||
calculate_str1 = \
|
||||
(f"{lvalue.replace('[', 'self._attributes[')} = "
|
||||
f"{rvalue.replace('[', 'self._attributes[')}") \
|
||||
.replace("[", "[\"").replace("]", "\"]")
|
||||
calculate_str2 = \
|
||||
(f"{lvalue.replace('[', 'new_status[')} = "
|
||||
f"{rvalue.replace('[', 'self._attributes[')}") \
|
||||
.replace("[", "[\"").replace("]", "\"]")
|
||||
try:
|
||||
exec(calculate_str1)
|
||||
exec(calculate_str2)
|
||||
except Exception:
|
||||
MideaLogger.warning(
|
||||
f"Calculation Error: {lvalue} = {rvalue}", self._device_id
|
||||
)
|
||||
self._update_all(new_status)
|
||||
new_status = {}
|
||||
for single in status.keys():
|
||||
value = status.get(single)
|
||||
if single not in self._attributes or self._attributes[single] != value:
|
||||
self._attributes[single] = value
|
||||
new_status[single] = value
|
||||
if len(new_status) > 0:
|
||||
for c in self._calculate_get:
|
||||
lvalue = c.get("lvalue")
|
||||
rvalue = c.get("rvalue")
|
||||
if lvalue and rvalue:
|
||||
calculate = False
|
||||
for s, v in new_status.items():
|
||||
if rvalue.find(f"[{s}]") >= 0:
|
||||
calculate = True
|
||||
break
|
||||
if calculate:
|
||||
calculate_str1 = \
|
||||
(f"{lvalue.replace('[', 'self._attributes[').replace("]", "\"]")} = "
|
||||
f"{rvalue.replace('[', 'float(self._attributes[').replace(']', "\"])")}") \
|
||||
.replace("[", "[\"")
|
||||
calculate_str2 = \
|
||||
(f"{lvalue.replace('[', 'new_status[').replace("]", "\"]")} = "
|
||||
f"{rvalue.replace('[', 'float(self._attributes[').replace(']', "\"])")}") \
|
||||
.replace("[", "[\"")
|
||||
try:
|
||||
exec(calculate_str1)
|
||||
exec(calculate_str2)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
MideaLogger.warning(
|
||||
f"Calculation Error: {lvalue} = {rvalue}, calculate_str1: {calculate_str1}, calculate_str2: {calculate_str2}",
|
||||
self._device_id
|
||||
)
|
||||
self._update_all(new_status)
|
||||
return ParseMessageResult.SUCCESS
|
||||
|
||||
def _parse_message(self, msg):
|
||||
@@ -371,11 +396,13 @@ class MiedaDevice(threading.Thread):
|
||||
|
||||
async def _send_message(self, data):
|
||||
if reply := await self._cloud.send_cloud(self._device_id, data):
|
||||
result = self._parse_cloud_message(reply)
|
||||
if result == ParseMessageResult.ERROR:
|
||||
MideaLogger.debug(f"Message 'ERROR' received")
|
||||
elif result == ParseMessageResult.SUCCESS:
|
||||
timeout_counter = 0
|
||||
if reply_dec := self._lua_runtime.decode_status(dec_string_to_bytes(reply).hex()):
|
||||
MideaLogger.debug(f"Decoded: {reply_dec}")
|
||||
result = self._parse_cloud_message(reply_dec)
|
||||
if result == ParseMessageResult.ERROR:
|
||||
MideaLogger.debug(f"Message 'ERROR' received")
|
||||
elif result == ParseMessageResult.SUCCESS:
|
||||
timeout_counter = 0
|
||||
|
||||
# if self._protocol == 3:
|
||||
# self._send_message_v3(data, msg_type=MSGTYPE_ENCRYPTED_REQUEST)
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""Data coordinator for Midea Auto Cloud integration."""
|
||||
|
||||
import logging
|
||||
import traceback
|
||||
from datetime import datetime, timedelta
|
||||
from typing import NamedTuple
|
||||
|
||||
from attr import attributes
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
@@ -184,14 +186,35 @@ class MideaDataUpdateCoordinator(DataUpdateCoordinator[MideaDeviceData]):
|
||||
|
||||
async def async_set_attribute(self, attribute: str, value) -> None:
|
||||
"""Set a device attribute."""
|
||||
# 云端控制:构造 control 与 status(携带当前状态作为上下文)
|
||||
await self.device.set_attribute(attribute, value)
|
||||
self.device.attributes[attribute] = value
|
||||
self.mute_state_update_for_a_while()
|
||||
self.async_update_listeners()
|
||||
attributes = {}
|
||||
attributes[attribute] = value
|
||||
await self.async_set_attributes(attributes)
|
||||
|
||||
async def async_set_attributes(self, attributes: dict) -> None:
|
||||
"""Set multiple device attributes."""
|
||||
# 云端控制:构造 control 与 status(携带当前状态作为上下文)
|
||||
for c in self.device._calculate_set:
|
||||
lvalue = c.get("lvalue")
|
||||
rvalue = c.get("rvalue")
|
||||
if lvalue and rvalue:
|
||||
calculate = False
|
||||
for s, v in attributes.items():
|
||||
if rvalue.find(f"[{s}]") >= 0:
|
||||
calculate = True
|
||||
break
|
||||
if calculate:
|
||||
calculate_str1 = \
|
||||
(f"{lvalue.replace('[', 'attributes[').replace("]", "\"]")} = "
|
||||
f"{rvalue.replace('[', 'float(attributes[').replace(']', "\"])")}") \
|
||||
.replace("[", "[\"")
|
||||
try:
|
||||
exec(calculate_str1)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
MideaLogger.warning(
|
||||
f"Calculation Error: {lvalue} = {rvalue}, calculate_str1: {calculate_str1}",
|
||||
self._device_id
|
||||
)
|
||||
await self.device.set_attributes(attributes)
|
||||
self.device.attributes.update(attributes)
|
||||
self.mute_state_update_for_a_while()
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from homeassistant.const import Platform, UnitOfTemperature, PRECISION_HALVES
|
||||
from homeassistant.const import Platform, UnitOfTemperature, PRECISION_HALVES, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, \
|
||||
CONCENTRATION_PARTS_PER_MILLION
|
||||
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
|
||||
from homeassistant.components.switch import SwitchDeviceClass
|
||||
|
||||
@@ -107,19 +108,19 @@ DEVICE_MAPPING = {
|
||||
},
|
||||
"co2_value": {
|
||||
"device_class": SensorDeviceClass.CO2,
|
||||
"unit_of_measurement": "ppm",
|
||||
"unit_of_measurement": CONCENTRATION_PARTS_PER_MILLION,
|
||||
"state_class": SensorStateClass.MEASUREMENT,
|
||||
"attribute": "co2.value"
|
||||
},
|
||||
"hcho_value": {
|
||||
"device_class": SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||
"unit_of_measurement": "μg/m³",
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT,
|
||||
"attribute": "hcho.value"
|
||||
},
|
||||
"pm25_value": {
|
||||
"device_class": SensorDeviceClass.PM25,
|
||||
"unit_of_measurement": "μg/m³",
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT,
|
||||
"attribute": "pm2_5.value"
|
||||
},
|
||||
|
||||
69
custom_components/midea_auto_cloud/device_mapping/T0xCD.py
Normal file
69
custom_components/midea_auto_cloud/device_mapping/T0xCD.py
Normal file
@@ -0,0 +1,69 @@
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE, PRECISION_HALVES, PRECISION_WHOLE
|
||||
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": [{}],
|
||||
"calculate": {
|
||||
"get": [
|
||||
{
|
||||
"lvalue": "[temperature]",
|
||||
"rvalue": "([set_temperature] - 106) / 74 * 37 + 38"
|
||||
},
|
||||
{
|
||||
"lvalue": "[cur_temperature]",
|
||||
"rvalue": "([water_box_temperature] - 106) / 74 * 37 + 38"
|
||||
}
|
||||
],
|
||||
"set": [
|
||||
{
|
||||
"lvalue": "[set_temperature]",
|
||||
"rvalue": "([temperature] - 38) / 37 * 74 + 106"
|
||||
},
|
||||
]
|
||||
},
|
||||
"centralized": [],
|
||||
"entities": {
|
||||
Platform.CLIMATE: {
|
||||
"water_heater": {
|
||||
"power": "power",
|
||||
"hvac_modes": {
|
||||
"off": {"power": "off"},
|
||||
"heat": {"power": "on"},
|
||||
},
|
||||
"preset_modes": {
|
||||
"标准": {"mode": "standard"},
|
||||
"节能": {"mode": "energy"},
|
||||
"速热": {"mode": "compatibilizing"},
|
||||
},
|
||||
"target_temperature": "temperature",
|
||||
"current_temperature": "cur_temperature",
|
||||
"min_temp": 38,
|
||||
"max_temp": 75,
|
||||
"temperature_unit": UnitOfTemperature.CELSIUS,
|
||||
"precision": PRECISION_WHOLE,
|
||||
}
|
||||
},
|
||||
Platform.SWITCH: {
|
||||
"power": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"mute": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
},
|
||||
Platform.SENSOR: {
|
||||
"cur_temperature": {
|
||||
"device_class": SensorDeviceClass.TEMPERATURE,
|
||||
"unit_of_measurement": UnitOfTemperature.CELSIUS,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, \
|
||||
CONCENTRATION_PARTS_PER_MILLION
|
||||
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
|
||||
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
|
||||
from homeassistant.components.switch import SwitchDeviceClass
|
||||
@@ -168,12 +169,12 @@ DEVICE_MAPPING = {
|
||||
},
|
||||
"pm25_value": {
|
||||
"device_class": SensorDeviceClass.PM25,
|
||||
"unit_of_measurement": "µg/m³",
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"co2_value": {
|
||||
"device_class": SensorDeviceClass.CO2,
|
||||
"unit_of_measurement": "ppm",
|
||||
"unit_of_measurement": CONCENTRATION_PARTS_PER_MILLION,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"machine_type": {
|
||||
|
||||
150
custom_components/midea_auto_cloud/device_mapping/T0xDA.py
Normal file
150
custom_components/midea_auto_cloud/device_mapping/T0xDA.py
Normal file
@@ -0,0 +1,150 @@
|
||||
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": [{}],
|
||||
"calculate": {
|
||||
"get": [
|
||||
{
|
||||
"lvalue": "[remain_time]",
|
||||
"rvalue": "[remain_time]"
|
||||
}
|
||||
],
|
||||
"set": {
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
Platform.NUMBER: {
|
||||
"temperature": {
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"step": 1
|
||||
},
|
||||
"detergent": {
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"step": 1
|
||||
},
|
||||
"softener": {
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"step": 1
|
||||
},
|
||||
"dehydration_speed": {
|
||||
"min": 0,
|
||||
"max": 1600,
|
||||
"step": 100
|
||||
},
|
||||
"soak_time": {
|
||||
"min": 0,
|
||||
"max": 40,
|
||||
"step": 10
|
||||
},
|
||||
"wash_time": {
|
||||
"min": 0,
|
||||
"max": 20,
|
||||
"step": 1
|
||||
},
|
||||
"rinse_count": {
|
||||
"min": 0,
|
||||
"max": 3,
|
||||
"step": 1
|
||||
},
|
||||
"dehydration_time": {
|
||||
"min": 0,
|
||||
"max": 9,
|
||||
"step": 1
|
||||
},
|
||||
"wash_level": {
|
||||
"min": 0,
|
||||
"max": 8,
|
||||
"step": 1
|
||||
},
|
||||
"rinse_level": {
|
||||
"min": 0,
|
||||
"max": 8,
|
||||
"step": 1
|
||||
},
|
||||
"wash_strength": {
|
||||
"min": 1,
|
||||
"max": 4,
|
||||
"step": 1
|
||||
},
|
||||
},
|
||||
Platform.BINARY_SENSOR: {
|
||||
"softener_lack": {
|
||||
"device_class": BinarySensorDeviceClass.PROBLEM,
|
||||
},
|
||||
"detergent_lack": {
|
||||
"device_class": BinarySensorDeviceClass.PROBLEM,
|
||||
},
|
||||
"door_opened": {
|
||||
"device_class": BinarySensorDeviceClass.PROBLEM,
|
||||
},
|
||||
"bucket_water_overheating": {
|
||||
"device_class": BinarySensorDeviceClass.PROBLEM,
|
||||
},
|
||||
},
|
||||
Platform.SWITCH: {
|
||||
"power": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"control_status": {
|
||||
"rationale": ["pause", "start"],
|
||||
},
|
||||
"lock": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
},
|
||||
Platform.SELECT: {
|
||||
"mode": {
|
||||
"options": {
|
||||
"normal": {"mode": "normal"},
|
||||
"dry": {"mode": "dry"},
|
||||
"continus": {"mode": "continus"},
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"options": {
|
||||
"标准": {"program": "standard"},
|
||||
"速洗": {"program": "fast"},
|
||||
"家纺": {"program": "blanket"},
|
||||
"羊毛": {"program": "wool"},
|
||||
"浸洗": {"program": "embathe"},
|
||||
"记忆": {"program": "memory"},
|
||||
"童装": {"program": "child"},
|
||||
"强洗": {"program": "strong_wash"},
|
||||
"桶自洁": {"program": "bucket_self_clean"},
|
||||
}
|
||||
},
|
||||
},
|
||||
Platform.SENSOR: {
|
||||
"running_status": {
|
||||
"device_class": SensorDeviceClass.ENUM
|
||||
},
|
||||
"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.BATTERY,
|
||||
"unit_of_measurement": "%",
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"error_code": {
|
||||
"device_class": SensorDeviceClass.ENUM
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,48 @@ DEVICE_MAPPING = {
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
Platform.NUMBER: {
|
||||
"temperature": {
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"step": 1
|
||||
},
|
||||
"detergent": {
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"step": 1
|
||||
},
|
||||
"softener": {
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"step": 1
|
||||
},
|
||||
"dehydration_time": {
|
||||
"min": 0,
|
||||
"max": 9,
|
||||
"step": 1
|
||||
},
|
||||
"dehydration_speed": {
|
||||
"min": 0,
|
||||
"max": 1600,
|
||||
"step": 100
|
||||
},
|
||||
"dirty_degree": {
|
||||
"min": 0,
|
||||
"max": 4,
|
||||
"step": 1
|
||||
},
|
||||
"soak_count": {
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"step": 1
|
||||
},
|
||||
"wash_time": {
|
||||
"min": 0,
|
||||
"max": 20,
|
||||
"step": 1
|
||||
},
|
||||
},
|
||||
Platform.BINARY_SENSOR: {
|
||||
"softener_lack": {
|
||||
"device_class": BinarySensorDeviceClass.PROBLEM,
|
||||
@@ -66,19 +108,6 @@ DEVICE_MAPPING = {
|
||||
},
|
||||
},
|
||||
Platform.SELECT: {
|
||||
"dehydration_speed": {
|
||||
"options": {
|
||||
"0": {"dehydration_speed": "0"},
|
||||
"400": {"dehydration_speed": "400"},
|
||||
"600": {"dehydration_speed": "600"},
|
||||
"800": {"dehydration_speed": "800"},
|
||||
"1000": {"dehydration_speed": "1000"},
|
||||
"1200": {"dehydration_speed": "1200"},
|
||||
"1400": {"dehydration_speed": "1400"},
|
||||
"1600": {"dehydration_speed": "1600"},
|
||||
"1300": {"dehydration_speed": "1300"}
|
||||
}
|
||||
},
|
||||
"mode": {
|
||||
"options": {
|
||||
"normal": {"mode": "normal"},
|
||||
@@ -190,68 +219,11 @@ DEVICE_MAPPING = {
|
||||
"hanfu_wash": {"program": "hanfu_wash"}
|
||||
}
|
||||
},
|
||||
"temperature": {
|
||||
"options": {
|
||||
"0": {"temperature": "0"},
|
||||
"20": {"temperature": "20"},
|
||||
"30": {"temperature": "30"},
|
||||
"40": {"temperature": "40"},
|
||||
"50": {"temperature": "50"},
|
||||
"60": {"temperature": "60"},
|
||||
"70": {"temperature": "70"},
|
||||
"90": {"temperature": "90"},
|
||||
"95": {"temperature": "95"}
|
||||
}
|
||||
},
|
||||
"detergent": {
|
||||
"options": {
|
||||
"0": {"detergent": "0"},
|
||||
"1": {"detergent": "1"},
|
||||
"2": {"detergent": "2"},
|
||||
"3": {"detergent": "3"},
|
||||
"4": {"detergent": "4"},
|
||||
"5": {"detergent": "5"}
|
||||
}
|
||||
},
|
||||
"softener": {
|
||||
"options": {
|
||||
"0": {"softener": "0"},
|
||||
"1": {"softener": "1"},
|
||||
"2": {"softener": "2"},
|
||||
"3": {"softener": "3"},
|
||||
"4": {"softener": "4"},
|
||||
"5": {"softener": "5"}
|
||||
}
|
||||
},
|
||||
"dirty_degree": {
|
||||
"options": {
|
||||
"0": {"dirty_degree": "0"},
|
||||
"1": {"dirty_degree": "1"},
|
||||
"2": {"dirty_degree": "2"},
|
||||
"3": {"dirty_degree": "3"},
|
||||
"4": {"dirty_degree": "4"}
|
||||
}
|
||||
},
|
||||
"soak_count": {
|
||||
"options": {
|
||||
"0": {"soak_count": "0"},
|
||||
"1": {"soak_count": "1"},
|
||||
"2": {"soak_count": "2"},
|
||||
"3": {"soak_count": "3"},
|
||||
"4": {"soak_count": "4"},
|
||||
"5": {"soak_count": "5"}
|
||||
}
|
||||
}
|
||||
},
|
||||
Platform.SENSOR: {
|
||||
"running_status": {
|
||||
"device_class": SensorDeviceClass.ENUM
|
||||
},
|
||||
"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,
|
||||
@@ -273,11 +245,6 @@ DEVICE_MAPPING = {
|
||||
"unit_of_measurement": "%",
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"dehydration_time_value": {
|
||||
"device_class": SensorDeviceClass.DURATION,
|
||||
"unit_of_measurement": UnitOfTime.MINUTES,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"customize_machine_cycle": {
|
||||
"device_class": SensorDeviceClass.ENUM
|
||||
},
|
||||
@@ -315,11 +282,6 @@ DEVICE_MAPPING = {
|
||||
"active_oxygen": {
|
||||
"device_class": SensorDeviceClass.ENUM
|
||||
},
|
||||
"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,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE, PRECISION_HALVES
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE, PRECISION_HALVES, \
|
||||
CONCENTRATION_PARTS_PER_MILLION
|
||||
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
|
||||
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
|
||||
from homeassistant.components.switch import SwitchDeviceClass
|
||||
@@ -10,12 +11,23 @@ DEVICE_MAPPING = {
|
||||
"queries": [{}],
|
||||
"centralized": [],
|
||||
"entities": {
|
||||
Platform.WATER_HEATER: {
|
||||
Platform.NUMBER: {
|
||||
"water_quality": {
|
||||
"min": 0,
|
||||
"max": 3,
|
||||
"step": 1
|
||||
},
|
||||
"cur_temperature": {
|
||||
"device_class": SensorDeviceClass.TEMPERATURE,
|
||||
"state_class": SensorStateClass.MEASUREMENT,
|
||||
}
|
||||
},
|
||||
Platform.CLIMATE: {
|
||||
"water_heater": {
|
||||
"power": "power",
|
||||
"operation_list": {
|
||||
"hvac_modes": {
|
||||
"off": {"power": "off"},
|
||||
"on": {"power": "on"},
|
||||
"heat": {"power": "on"},
|
||||
},
|
||||
"target_temperature": "temperature",
|
||||
"current_temperature": "cur_temperature",
|
||||
@@ -26,6 +38,9 @@ DEVICE_MAPPING = {
|
||||
}
|
||||
},
|
||||
Platform.SWITCH: {
|
||||
"power": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"ti_protect": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
@@ -49,14 +64,6 @@ DEVICE_MAPPING = {
|
||||
},
|
||||
},
|
||||
Platform.SELECT: {
|
||||
"water_quality": {
|
||||
"options": {
|
||||
"0": {"water_quality": 0},
|
||||
"1": {"water_quality": 1},
|
||||
"2": {"water_quality": 2},
|
||||
"3": {"water_quality": 3}
|
||||
}
|
||||
},
|
||||
"func_select": {
|
||||
"options": {
|
||||
"low": {"func_select": "low"},
|
||||
@@ -149,7 +156,7 @@ DEVICE_MAPPING = {
|
||||
},
|
||||
"tds_value": {
|
||||
"device_class": SensorDeviceClass.WATER,
|
||||
"unit_of_measurement": "ppm",
|
||||
"unit_of_measurement": CONCENTRATION_PARTS_PER_MILLION,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"heat_water_level": {
|
||||
|
||||
@@ -10,6 +10,9 @@ DEVICE_MAPPING = {
|
||||
"centralized": [],
|
||||
"entities": {
|
||||
Platform.SWITCH: {
|
||||
"power": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"bubble": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
"rationale": [0, 1]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfTime, PERCENTAGE, DEGREE, \
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass
|
||||
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
|
||||
from homeassistant.components.switch import SwitchDeviceClass
|
||||
@@ -23,17 +24,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,29 +93,9 @@ 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³",
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"ud_swing_angle": {
|
||||
@@ -153,5 +124,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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
103
custom_components/midea_auto_cloud/device_mapping/T0xFC.py
Normal file
103
custom_components/midea_auto_cloud/device_mapping/T0xFC.py
Normal file
@@ -0,0 +1,103 @@
|
||||
from homeassistant.const import Platform, UnitOfTemperature, UnitOfVolume, UnitOfTime, PERCENTAGE, PRECISION_HALVES, \
|
||||
UnitOfEnergy, UnitOfPower, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
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": [],
|
||||
"entities": {
|
||||
Platform.SWITCH: {
|
||||
"power": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"anion": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"buzzer": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"lock": {
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
},
|
||||
"waterions":{
|
||||
"device_class": SwitchDeviceClass.SWITCH,
|
||||
}
|
||||
},
|
||||
Platform.SELECT: {
|
||||
"mode": {
|
||||
"options": {
|
||||
"constant_humidity": {"mode": "constant_humidity"},
|
||||
"manual": {"mode": "manual"},
|
||||
"sleep": {"mode": "sleep"},
|
||||
"fast": {"mode": "fast"},
|
||||
"auto": {"mode": "auto"},
|
||||
}
|
||||
},
|
||||
"bias_gear":{
|
||||
"options": {
|
||||
"瑜伽静修场景": {"mode": "auto", "sub_mode": "denoise", "bias_gear": -20},
|
||||
"室内对话场景": {"mode": "auto", "sub_mode": "denoise", "bias_gear": -10}
|
||||
}
|
||||
},
|
||||
"bright": {
|
||||
"options": {
|
||||
"全亮": {"bright": 0},
|
||||
"半亮": {"bright": 6},
|
||||
"熄灭": {"bright": 7}
|
||||
}
|
||||
},
|
||||
"gear": {
|
||||
"options": {
|
||||
"low": {"wind_speed": 1},
|
||||
"medium": {"wind_speed": 2},
|
||||
"high": {"wind_speed": 3}
|
||||
}
|
||||
},
|
||||
"humidity": {
|
||||
"options": {
|
||||
"40%": {"humidity": 40},
|
||||
"50%": {"humidity": 50},
|
||||
"60%": {"humidity": 60},
|
||||
"70%": {"humidity": 70}
|
||||
}
|
||||
},
|
||||
},
|
||||
Platform.SENSOR: {
|
||||
"temperature_feedback": {
|
||||
"device_class": SensorDeviceClass.TEMPERATURE,
|
||||
"unit_of_measurement": UnitOfTemperature.CELSIUS,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"humidify_feedback": {
|
||||
"device_class": SensorDeviceClass.HUMIDITY,
|
||||
"unit_of_measurement": "%",
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"hcho":{
|
||||
"device_class": SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"pm1":{
|
||||
"device_class": SensorDeviceClass.PM1,
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"pm25":{
|
||||
"device_class": SensorDeviceClass.PM25,
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
},
|
||||
"pm10":{
|
||||
"device_class": SensorDeviceClass.PM10,
|
||||
"unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
"state_class": SensorStateClass.MEASUREMENT
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,18 @@ class MideaFanEntity(MideaEntity, FanEntity):
|
||||
)
|
||||
self._key_power = self._config.get("power")
|
||||
self._key_preset_modes = self._config.get("preset_modes")
|
||||
self._key_speeds = self._config.get("speeds")
|
||||
speeds_config = self._config.get("speeds")
|
||||
# 处理范围形式的 speeds 配置: {"key": "gear", "value": [1, 9]}
|
||||
if isinstance(speeds_config, dict) and "key" in speeds_config and "value" in speeds_config:
|
||||
key_name = speeds_config["key"]
|
||||
value_range = speeds_config["value"]
|
||||
if isinstance(value_range, list) and len(value_range) == 2:
|
||||
start, end = value_range[0], value_range[1]
|
||||
self._key_speeds = [{key_name: str(i)} for i in range(start, end + 1)]
|
||||
else:
|
||||
self._key_speeds = speeds_config
|
||||
else:
|
||||
self._key_speeds = speeds_config
|
||||
self._key_oscillate = self._config.get("oscillate")
|
||||
self._key_directions = self._config.get("directions")
|
||||
self._attr_speed_count = len(self._key_speeds) if self._key_speeds else 0
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
"iot_class": "cloud_push",
|
||||
"issue_tracker": "https://github.com/sususweet/midea-meiju-codec/issues",
|
||||
"requirements": ["lupa>=2.0"],
|
||||
"version": "v0.1.16"
|
||||
"version": "v0.1.20"
|
||||
}
|
||||
@@ -349,6 +349,15 @@
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"bright": {
|
||||
"name": "Brightness"
|
||||
},
|
||||
"bias_gear": {
|
||||
"name": "Bias Gear"
|
||||
},
|
||||
"humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"b6_power": {
|
||||
"name": "Smoke Machine Power"
|
||||
},
|
||||
@@ -388,12 +397,6 @@
|
||||
"control_type": {
|
||||
"name": "Control Type"
|
||||
},
|
||||
"dehydration_speed": {
|
||||
"name": "Dehydration Speed"
|
||||
},
|
||||
"db_dehydration_speed": {
|
||||
"name": "DB Dehydration Speed"
|
||||
},
|
||||
"db_detergent": {
|
||||
"name": "DB Detergent"
|
||||
},
|
||||
@@ -424,9 +427,6 @@
|
||||
"detergent_density": {
|
||||
"name": "Detergent Density"
|
||||
},
|
||||
"dirty_degree": {
|
||||
"name": "Dirty Degree"
|
||||
},
|
||||
"disinfectant": {
|
||||
"name": "Disinfectant"
|
||||
},
|
||||
@@ -511,9 +511,6 @@
|
||||
"season": {
|
||||
"name": "Season"
|
||||
},
|
||||
"soak_count": {
|
||||
"name": "Soak Count"
|
||||
},
|
||||
"softener_density": {
|
||||
"name": "Softener Density"
|
||||
},
|
||||
@@ -565,9 +562,6 @@
|
||||
"type_select": {
|
||||
"name": "Type Select"
|
||||
},
|
||||
"water_quality": {
|
||||
"name": "Water Quality"
|
||||
},
|
||||
"work_status": {
|
||||
"name": "Work Status"
|
||||
},
|
||||
@@ -592,15 +586,6 @@
|
||||
"gear": {
|
||||
"name": "Gear"
|
||||
},
|
||||
"detergent": {
|
||||
"name": "Detergent"
|
||||
},
|
||||
"softener": {
|
||||
"name": "Softener"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
},
|
||||
"ptc": {
|
||||
"name": "PTC"
|
||||
},
|
||||
@@ -1531,8 +1516,53 @@
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"water_quality": {
|
||||
"name": "Water Quality"
|
||||
},
|
||||
"b6_lightness": {
|
||||
"name": "Smoke Machine Lightness"
|
||||
},
|
||||
"dehydration_speed": {
|
||||
"name": "Dehydration Speed"
|
||||
},
|
||||
"db_dehydration_speed": {
|
||||
"name": "DB Dehydration Speed"
|
||||
},
|
||||
"detergent": {
|
||||
"name": "Detergent"
|
||||
},
|
||||
"softener": {
|
||||
"name": "Softener"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
},
|
||||
"soak_count": {
|
||||
"name": "Soak Count"
|
||||
},
|
||||
"dirty_degree": {
|
||||
"name": "Dirty Degree"
|
||||
},
|
||||
"soak_time": {
|
||||
"name": "Soak Time"
|
||||
},
|
||||
"wash_time": {
|
||||
"name": "Wash Time"
|
||||
},
|
||||
"rinse_count": {
|
||||
"name": "Rinse Count"
|
||||
},
|
||||
"dehydration_time": {
|
||||
"name": "Dehydration Time"
|
||||
},
|
||||
"wash_level": {
|
||||
"name": "Wash Level"
|
||||
},
|
||||
"rinse_level": {
|
||||
"name": "Rinse Level"
|
||||
},
|
||||
"wash_strength": {
|
||||
"name": "Water Strength"
|
||||
}
|
||||
},
|
||||
"fan": {
|
||||
@@ -1541,6 +1571,12 @@
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"waterions": {
|
||||
"name": "Disinfection"
|
||||
},
|
||||
"mute": {
|
||||
"name": "Mute"
|
||||
},
|
||||
"b6_light": {
|
||||
"name": "Smoke Machine Light"
|
||||
},
|
||||
|
||||
@@ -353,6 +353,15 @@
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"bright": {
|
||||
"name": "亮度"
|
||||
},
|
||||
"bias_gear": {
|
||||
"name": "降噪设置"
|
||||
},
|
||||
"humidity": {
|
||||
"name": "设定湿度"
|
||||
},
|
||||
"b6_power": {
|
||||
"name": "烟机开关"
|
||||
},
|
||||
@@ -392,12 +401,6 @@
|
||||
"control_type": {
|
||||
"name": "控制类型"
|
||||
},
|
||||
"dehydration_speed": {
|
||||
"name": "脱水转速"
|
||||
},
|
||||
"db_dehydration_speed": {
|
||||
"name": "脱水转速"
|
||||
},
|
||||
"db_detergent": {
|
||||
"name": "洗涤剂"
|
||||
},
|
||||
@@ -428,9 +431,6 @@
|
||||
"detergent_density": {
|
||||
"name": "洗涤剂浓度"
|
||||
},
|
||||
"dirty_degree": {
|
||||
"name": "脏污程度"
|
||||
},
|
||||
"disinfectant": {
|
||||
"name": "消毒剂"
|
||||
},
|
||||
@@ -515,9 +515,6 @@
|
||||
"season": {
|
||||
"name": "季节"
|
||||
},
|
||||
"soak_count": {
|
||||
"name": "浸泡次数"
|
||||
},
|
||||
"softener_density": {
|
||||
"name": "柔顺剂浓度"
|
||||
},
|
||||
@@ -572,9 +569,6 @@
|
||||
"type_select": {
|
||||
"name": "类型选择"
|
||||
},
|
||||
"water_quality": {
|
||||
"name": "水质"
|
||||
},
|
||||
"work_status": {
|
||||
"name": "工作状态"
|
||||
},
|
||||
@@ -596,15 +590,6 @@
|
||||
"gear": {
|
||||
"name": "档位"
|
||||
},
|
||||
"detergent": {
|
||||
"name": "洗涤剂"
|
||||
},
|
||||
"softener": {
|
||||
"name": "柔顺剂"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "温度"
|
||||
},
|
||||
"ptc": {
|
||||
"name": "电辅热"
|
||||
},
|
||||
@@ -1535,8 +1520,53 @@
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"water_quality": {
|
||||
"name": "水质"
|
||||
},
|
||||
"b6_lightness": {
|
||||
"name": "烟机照明"
|
||||
},
|
||||
"dehydration_speed": {
|
||||
"name": "脱水转速"
|
||||
},
|
||||
"db_dehydration_speed": {
|
||||
"name": "脱水转速"
|
||||
},
|
||||
"detergent": {
|
||||
"name": "洗涤剂"
|
||||
},
|
||||
"softener": {
|
||||
"name": "柔顺剂"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "温度"
|
||||
},
|
||||
"soak_count": {
|
||||
"name": "浸泡次数"
|
||||
},
|
||||
"dirty_degree": {
|
||||
"name": "脏污程度"
|
||||
},
|
||||
"soak_time": {
|
||||
"name": "浸泡时间"
|
||||
},
|
||||
"wash_time": {
|
||||
"name": "洗涤时间"
|
||||
},
|
||||
"rinse_count": {
|
||||
"name": "漂洗次数"
|
||||
},
|
||||
"dehydration_time": {
|
||||
"name": "脱水时间"
|
||||
},
|
||||
"wash_level": {
|
||||
"name": "洗涤水位"
|
||||
},
|
||||
"rinse_level": {
|
||||
"name": "漂洗水位"
|
||||
},
|
||||
"wash_strength": {
|
||||
"name": "水流强度"
|
||||
}
|
||||
},
|
||||
"fan": {
|
||||
@@ -1545,6 +1575,12 @@
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"waterions": {
|
||||
"name": "消杀"
|
||||
},
|
||||
"mute": {
|
||||
"name": "静音"
|
||||
},
|
||||
"b6_light": {
|
||||
"name": "烟机灯"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user