Only update UA timer when it's acptually changed !

This commit is contained in:
Simon 2021-02-14 13:18:26 +00:00
parent 72fe31509b
commit acab830ef9

View File

@ -567,25 +567,26 @@ def options_config():
continue continue
_tmout = int(_options['DEFAULT_UA_TIMER']) _tmout = int(_options['DEFAULT_UA_TIMER'])
logger.debug('(OPTIONS) %s Updating DEFAULT_UA_TIMER for existing bridges.',_system) if int(options['DEFAULT_UA_TIMER'] != CONFIG['SYSTEMS'][_system]['DEFAULT_UA_TIMER']:
remove_bridge_system(_system) logger.debug('(OPTIONS) %s Updating DEFAULT_UA_TIMER for existing bridges.',_system)
for _bridge in BRIDGES: remove_bridge_system(_system)
ts1 = False for _bridge in BRIDGES:
ts2 = False ts1 = False
for i,e in enumerate(BRIDGES[_bridge]): ts2 = False
if e['SYSTEM'] == _system and e['TS'] == 1: for i,e in enumerate(BRIDGES[_bridge]):
ts1 = True if e['SYSTEM'] == _system and e['TS'] == 1:
if e['SYSTEM'] == _system and e['TS'] == 2: ts1 = True
ts2 = True if e['SYSTEM'] == _system and e['TS'] == 2:
if _bridge[0:1] != '#': ts2 = True
if ts1 == False: if _bridge[0:1] != '#':
BRIDGES[_bridge].append({'SYSTEM': _system, 'TS': 1, 'TGID': bytes_3(int(_bridge)),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [],'ON': [bytes_3(int(_bridge)),],'RESET': [], 'TIMER': time()}) if ts1 == False:
if ts2 == False: BRIDGES[_bridge].append({'SYSTEM': _system, 'TS': 1, 'TGID': bytes_3(int(_bridge)),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [],'ON': [bytes_3(int(_bridge)),],'RESET': [], 'TIMER': time()})
BRIDGES[_bridge].append({'SYSTEM': _system, 'TS': 2, 'TGID': bytes_3(int(_bridge)),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [],'ON': [bytes_3(int(_bridge)),],'RESET': [], 'TIMER': time()}) if ts2 == False:
else: BRIDGES[_bridge].append({'SYSTEM': _system, 'TS': 2, 'TGID': bytes_3(int(_bridge)),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [],'ON': [bytes_3(int(_bridge)),],'RESET': [], 'TIMER': time()})
if ts2 == False: else:
BRIDGES[_bridge].append({'SYSTEM': _system, 'TS': 2, 'TGID': bytes_3(9),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [bytes_3(4000)],'ON': [],'RESET': [], 'TIMER': time()}) if ts2 == False:
BRIDGES[_bridge].append({'SYSTEM': _system, 'TS': 2, 'TGID': bytes_3(9),'ACTIVE': False,'TIMEOUT': _tmout * 60,'TO_TYPE': 'ON','OFF': [bytes_3(4000)],'ON': [],'RESET': [], 'TIMER': time()})
if int(_options['DEFAULT_REFLECTOR']) != CONFIG['SYSTEMS'][_system]['DEFAULT_REFLECTOR']: if int(_options['DEFAULT_REFLECTOR']) != CONFIG['SYSTEMS'][_system]['DEFAULT_REFLECTOR']:
if int(_options['DEFAULT_REFLECTOR']) > 0: if int(_options['DEFAULT_REFLECTOR']) > 0: