mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-10-15 10:48:26 +00:00
feat: add status when build lua command
This commit is contained in:
@@ -168,7 +168,7 @@ class MiedaDevice(threading.Thread):
|
|||||||
nested_status = self._convert_to_nested_structure(new_status)
|
nested_status = self._convert_to_nested_structure(new_status)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if set_cmd := self._lua_runtime.build_control(nested_status):
|
if set_cmd := self._lua_runtime.build_control(nested_status, status=self._attributes):
|
||||||
await self._build_send(set_cmd)
|
await self._build_send(set_cmd)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -194,7 +194,7 @@ class MiedaDevice(threading.Thread):
|
|||||||
|
|
||||||
if has_new:
|
if has_new:
|
||||||
try:
|
try:
|
||||||
if set_cmd := self._lua_runtime.build_control(nested_status):
|
if set_cmd := self._lua_runtime.build_control(nested_status, status=self._attributes):
|
||||||
await self._build_send(set_cmd)
|
await self._build_send(set_cmd)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@@ -56,9 +56,10 @@ class MideaCodec(LuaRuntime):
|
|||||||
MideaLogger.error(f"LuaRuntimeError in build_query {json_str}: {repr(e)}")
|
MideaLogger.error(f"LuaRuntimeError in build_query {json_str}: {repr(e)}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def build_control(self, append=None):
|
def build_control(self, append=None, status=None):
|
||||||
query_dict = self._build_base_dict()
|
query_dict = self._build_base_dict()
|
||||||
query_dict["control"] = {} if append is None else append
|
query_dict["control"] = {} if append is None else append
|
||||||
|
query_dict["status"] = {} if status is None else status
|
||||||
# 针对T0xD9复式洗衣机特殊处理
|
# 针对T0xD9复式洗衣机特殊处理
|
||||||
if self._device_type == "T0xD9":
|
if self._device_type == "T0xD9":
|
||||||
control_keys = list(append.keys())
|
control_keys = list(append.keys())
|
||||||
|
Reference in New Issue
Block a user