forked from HomeAssistant/midea-meiju-codec
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)
|
||||
|
||||
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)
|
||||
return
|
||||
except Exception as e:
|
||||
@@ -194,7 +194,7 @@ class MiedaDevice(threading.Thread):
|
||||
|
||||
if has_new:
|
||||
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)
|
||||
return
|
||||
except Exception as e:
|
||||
|
@@ -56,9 +56,10 @@ class MideaCodec(LuaRuntime):
|
||||
MideaLogger.error(f"LuaRuntimeError in build_query {json_str}: {repr(e)}")
|
||||
return None
|
||||
|
||||
def build_control(self, append=None):
|
||||
def build_control(self, append=None, status=None):
|
||||
query_dict = self._build_base_dict()
|
||||
query_dict["control"] = {} if append is None else append
|
||||
query_dict["status"] = {} if status is None else status
|
||||
# 针对T0xD9复式洗衣机特殊处理
|
||||
if self._device_type == "T0xD9":
|
||||
control_keys = list(append.keys())
|
||||
|
Reference in New Issue
Block a user