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:
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