catch "none type" for non present Tuners

This commit is contained in:
DJ2LS 2024-04-28 20:22:13 +02:00
parent 61e06af2cf
commit 443a6dd05a

View file

@ -228,15 +228,17 @@ class radio:
if self.connected: if self.connected:
try: try:
result = self.send_command('u TUNER') result = self.send_command('u TUNER')
if result is not None:
if int(result) == 1: if int(result) == 1:
state = True state = True
else: else:
state = False 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 return True
except Exception as err: 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 self.connected = False
return False return False