From 12c032112bd909ed9bfd7e8b69c2722011b525ef Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Fri, 9 Jul 2021 13:52:59 +0200 Subject: [PATCH] handle errors caused by values that don't fit into json --- owrx/connection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/owrx/connection.py b/owrx/connection.py index d36379a..a991eb8 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -376,7 +376,10 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): self.send(bytes([0x04]) + data) def write_s_meter_level(self, level): - self.send({"type": "smeter", "value": level}) + try: + self.send({"type": "smeter", "value": level}) + except ValueError: + logger.warning("unable to send smeter value: %s", str(level)) def write_cpu_usage(self, usage): self.mp_send({"type": "cpuusage", "value": usage})