diff --git a/sense_energy/sense_link.py b/sense_energy/sense_link.py index 87bab60..31667b0 100644 --- a/sense_energy/sense_link.py +++ b/sense_energy/sense_link.py @@ -37,7 +37,11 @@ def connection_lost(self, exc) -> None: def datagram_received(self, data: bytes, addr: Union[Tuple[str, int], Tuple[str, int, int, int]]) -> None: """Handle incoming UDP datagram.""" - decrypted_data = tp_link_decrypt(data) + try: + decrypted_data = tp_link_decrypt(data) + except UnicodeDecodeError: + _LOGGER.debug(f"Failed to decrypt data from {addr}") + return try: json_data = orjson.loads(decrypted_data)