From 443a6dd05a91f8dfdaeb2d340a93471753aa7a62 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Sun, 28 Apr 2024 20:22:13 +0200 Subject: [PATCH] catch "none type" for non present Tuners --- freedata_server/rigctld.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/freedata_server/rigctld.py b/freedata_server/rigctld.py index f94e224e..ee8189fc 100644 --- a/freedata_server/rigctld.py +++ b/freedata_server/rigctld.py @@ -228,15 +228,17 @@ class radio: if self.connected: try: result = self.send_command('u TUNER') - if int(result) == 1: - state = True + if result is not None: + if int(result) == 1: + state = True + else: + state = False else: state = False - - self.parameters['tuner'] = state # Update TUNER state in parameters + self.parameters['tuner'] = state # Update TUNER state in parameters return True except Exception as err: - self.log.warning(f"[RIGCTLD] Error setting TUNER state: {err}") + self.log.warning(f"[RIGCTLD] Error getting TUNER state: {err}") self.connected = False return False