mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-12-27 14:57:11 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5369e6c13d | ||
|
|
2a91ce9914 | ||
|
|
52c10f7d0d | ||
|
|
c090edfb3d | ||
|
|
e3a1812f9a |
@@ -283,20 +283,20 @@ class MiedaDevice(threading.Thread):
|
|||||||
query=query
|
query=query
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
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()
|
||||||
|
|
||||||
status = await cloud.get_device_status(
|
status = await cloud.get_device_status(
|
||||||
appliance_code=self._device_id,
|
appliance_code=self._device_id,
|
||||||
query=query
|
query=query
|
||||||
)
|
)
|
||||||
|
|
||||||
self._parse_cloud_message(status)
|
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):
|
def _parse_cloud_message(self, status):
|
||||||
# MideaLogger.debug(f"Received: {decrypted}")
|
# MideaLogger.debug(f"Received: {decrypted}")
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from homeassistant.const import Platform
|
from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
|
||||||
|
from homeassistant.const import Platform, UnitOfPower, UnitOfElectricPotential
|
||||||
from homeassistant.components.switch import SwitchDeviceClass
|
from homeassistant.components.switch import SwitchDeviceClass
|
||||||
|
|
||||||
DEVICE_MAPPING = {
|
DEVICE_MAPPING = {
|
||||||
@@ -6,6 +7,14 @@ DEVICE_MAPPING = {
|
|||||||
"rationale": ["off", "on"],
|
"rationale": ["off", "on"],
|
||||||
"queries": [{}],
|
"queries": [{}],
|
||||||
"centralized": [],
|
"centralized": [],
|
||||||
|
"calculate": {
|
||||||
|
"get": [
|
||||||
|
{
|
||||||
|
"lvalue": "[b7_vbattery]",
|
||||||
|
"rvalue": "[b7_vbatt] / 1000.0"
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
"entities": {
|
"entities": {
|
||||||
Platform.SWITCH: {
|
Platform.SWITCH: {
|
||||||
"power": {
|
"power": {
|
||||||
@@ -18,6 +27,25 @@ DEVICE_MAPPING = {
|
|||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Platform.SENSOR: {
|
||||||
|
"error_code": {
|
||||||
|
"device_class": SensorDeviceClass.ENUM
|
||||||
|
},
|
||||||
|
"b7_left_status": {
|
||||||
|
"device_class": SensorDeviceClass.ENUM,
|
||||||
|
"translation_key": "left_status",
|
||||||
|
},
|
||||||
|
"b7_right_status": {
|
||||||
|
"device_class": SensorDeviceClass.ENUM,
|
||||||
|
"translation_key": "right_status",
|
||||||
|
},
|
||||||
|
"b7_vbattery":{
|
||||||
|
"device_class": SensorDeviceClass.VOLTAGE,
|
||||||
|
"unit_of_measurement": UnitOfElectricPotential.VOLT,
|
||||||
|
"state_class": SensorStateClass.MEASUREMENT,
|
||||||
|
"translation_key": "battery_voltage",
|
||||||
|
}
|
||||||
|
},
|
||||||
Platform.SELECT: {
|
Platform.SELECT: {
|
||||||
"wind_pressure": {
|
"wind_pressure": {
|
||||||
"options": {
|
"options": {
|
||||||
@@ -28,6 +56,15 @@ DEVICE_MAPPING = {
|
|||||||
"extreme": {"wind_pressure": "4"},
|
"extreme": {"wind_pressure": "4"},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"gear": {
|
||||||
|
"options": {
|
||||||
|
"off": {"gear": 0},
|
||||||
|
"low": {"gear": 1},
|
||||||
|
"medium": {"gear": 2},
|
||||||
|
"high": {"gear": 3},
|
||||||
|
"extreme": {"gear": 4},
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ DEVICE_MAPPING = {
|
|||||||
},
|
},
|
||||||
"bubble": {
|
"bubble": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
"rationale": [0, 1]
|
},
|
||||||
|
"cold_water": {
|
||||||
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
},
|
},
|
||||||
"cold_water_master": {
|
"cold_water_master": {
|
||||||
"device_class": SwitchDeviceClass.SWITCH,
|
"device_class": SwitchDeviceClass.SWITCH,
|
||||||
|
|||||||
@@ -7,5 +7,5 @@
|
|||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"issue_tracker": "https://github.com/sususweet/midea-meiju-codec/issues",
|
"issue_tracker": "https://github.com/sususweet/midea-meiju-codec/issues",
|
||||||
"requirements": ["lupa>=2.0"],
|
"requirements": ["lupa>=2.0"],
|
||||||
"version": "v0.1.20"
|
"version": "v0.1.23"
|
||||||
}
|
}
|
||||||
@@ -1443,6 +1443,9 @@
|
|||||||
"left_status": {
|
"left_status": {
|
||||||
"name": "Left Status"
|
"name": "Left Status"
|
||||||
},
|
},
|
||||||
|
"right_status": {
|
||||||
|
"name": "Right Status"
|
||||||
|
},
|
||||||
"eq_recipe_action": {
|
"eq_recipe_action": {
|
||||||
"name": "Eq Recipe Action"
|
"name": "Eq Recipe Action"
|
||||||
},
|
},
|
||||||
@@ -1827,7 +1830,7 @@
|
|||||||
"name": "CO2 Check Enable"
|
"name": "CO2 Check Enable"
|
||||||
},
|
},
|
||||||
"cold_water": {
|
"cold_water": {
|
||||||
"name": "Cold Water"
|
"name": "Cold Water Single Loop"
|
||||||
},
|
},
|
||||||
"cold_water_ai": {
|
"cold_water_ai": {
|
||||||
"name": "Cold Water AI"
|
"name": "Cold Water AI"
|
||||||
|
|||||||
@@ -1447,6 +1447,9 @@
|
|||||||
"left_status": {
|
"left_status": {
|
||||||
"name": "左侧状态"
|
"name": "左侧状态"
|
||||||
},
|
},
|
||||||
|
"right_status": {
|
||||||
|
"name": "右侧状态"
|
||||||
|
},
|
||||||
"eq_recipe_action": {
|
"eq_recipe_action": {
|
||||||
"name": "等量食谱动作"
|
"name": "等量食谱动作"
|
||||||
},
|
},
|
||||||
@@ -1831,7 +1834,7 @@
|
|||||||
"name": "CO2检测启用"
|
"name": "CO2检测启用"
|
||||||
},
|
},
|
||||||
"cold_water": {
|
"cold_water": {
|
||||||
"name": "零冷水"
|
"name": "零冷水单次循环"
|
||||||
},
|
},
|
||||||
"cold_water_ai": {
|
"cold_water_ai": {
|
||||||
"name": "AI零冷水"
|
"name": "AI零冷水"
|
||||||
|
|||||||
Reference in New Issue
Block a user