Handle keyerror when options calling reset tg

This commit is contained in:
Simon 2021-04-21 19:13:28 +01:00
parent d08943490c
commit e258baf591

View File

@ -228,13 +228,17 @@ def make_static_tg(tg,ts,_tmout,system):
def reset_static_tg(tg,ts,_tmout,system): def reset_static_tg(tg,ts,_tmout,system):
#_tmout = CONFIG['SYSTEMS'][system]['DEFAULT_UA_TIMER'] #_tmout = CONFIG['SYSTEMS'][system]['DEFAULT_UA_TIMER']
bridgetemp = [] bridgetemp = []
for bridgesystem in BRIDGES[str(tg)]: try:
if bridgesystem['SYSTEM'] == system and bridgesystem['TS'] == ts: for bridgesystem in BRIDGES[str(tg)]:
bridgetemp.append({'SYSTEM': system, 'TS': ts, 'TGID': bytes_3(tg),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [],'ON': [bytes_3(tg),],'RESET': [], 'TIMER': time() + (_tmout * 60)}) if bridgesystem['SYSTEM'] == system and bridgesystem['TS'] == ts:
else: bridgetemp.append({'SYSTEM': system, 'TS': ts, 'TGID': bytes_3(tg),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [],'ON': [bytes_3(tg),],'RESET': [], 'TIMER': time() + (_tmout * 60)})
bridgetemp.append(bridgesystem) else:
bridgetemp.append(bridgesystem)
BRIDGES[str(tg)] = bridgetemp
BRIDGES[str(tg)] = bridgetemp
except KeyError:
logger.warning('(ERROR) KeyError in reset_static_tg() - bridge gone away?')
return
def reset_default_reflector(reflector,_tmout,system): def reset_default_reflector(reflector,_tmout,system):
bridge = '#'+str(reflector) bridge = '#'+str(reflector)