Skip to content

Commit

Permalink
Don't log error message when decoding valid discovery packets (#1832)
Browse files Browse the repository at this point in the history
Fix `Unable to decrypt, returning raw bytes` warning message when
decoding Discovery messages.
  • Loading branch information
gunjambi authored Oct 7, 2023
1 parent 79d2685 commit fb69fbc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions miio/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ def _encode(self, obj, context, path):

def _decode(self, obj, context, path) -> Union[Dict, bytes]:
"""Decrypts the payload using the token stored in the context."""
# Missing payload is expected for discovery messages.
if not obj:
return obj
try:
decrypted = Utils.decrypt(obj, context["_"]["token"])
decrypted = decrypted.rstrip(b"\x00")
Expand Down

0 comments on commit fb69fbc

Please sign in to comment.