Skip to content

Commit

Permalink
Merge branch 'main' into add_dc_feature
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwentao authored Dec 24, 2024
2 parents f17be88 + cb94101 commit 174d1c6
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions midealocal/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,19 @@ def refresh_status(self, check_protocol: bool = False) -> None:
cmds = [MessageQueryAppliance(self.device_type), *cmds]
error_count = 0
_LOGGER.debug(
"[%s] refresh_status with cmds: %s, check_protocol %s",
"[%s] refresh_status with cmds: %s, check_protocol %s, \
device %s, type %s, model %s, subtype %s, device_protocol: %s, \
message_protocol %s, unsupported_protocol: %s",
self._device_id,
cmds,
check_protocol,
self._device_name,
self._device_type,
self._model,
self._subtype,
self._device_protocol_version,
self._message_protocol_version,
self._unsupported_protocol,
)
for cmd in cmds:
if cmd.__class__.__name__ not in self._unsupported_protocol:
Expand Down Expand Up @@ -391,8 +400,12 @@ def pre_process_message(self, msg: bytearray) -> bool:
_LOGGER.debug("[%s] Appliance query Received: %s", self._device_id, message)
self._message_protocol_version = message.protocol_version
_LOGGER.debug(
"[%s] Device protocol version: %s",
"[%s] device model %s, subtype %s, \
device protocol %s, message protocol %s",
self._device_id,
self._model,
self._subtype,
self._device_protocol_version,
self._message_protocol_version,
)
return False
Expand Down Expand Up @@ -422,6 +435,18 @@ def parse_message(self, msg: bytes) -> MessageResult:
if self._appliance_query:
cont = self.pre_process_message(decrypted)
if cont:
_LOGGER.debug(
"[%s] process message %s for device %s, \
model %s, subtype %s, \
device protocol %s, message procol %s",
self._device_id,
decrypted.hex(),
self._device_name,
self._model,
self._subtype,
self._device_protocol_version,
self._message_protocol_version,
)
status = self.process_message(bytes(decrypted))
if len(status) > 0:
self.update_all(status)
Expand All @@ -432,9 +457,15 @@ def parse_message(self, msg: bytes) -> MessageResult:
)
except Exception:
_LOGGER.exception(
"[%s] Error in process message, msg = %s",
"[%s] Error in process message %s, \
model %s, subtype %s, \
device protocol %s, message procol %s",
self._device_id,
decrypted.hex(),
self._model,
self._subtype,
self._device_protocol_version,
self._message_protocol_version,
)
else:
_LOGGER.warning(
Expand Down

0 comments on commit 174d1c6

Please sign in to comment.