def extend_app(app): isy_addr = app.config.get('isy', 'isy_addr') isy_user = app.config.get('isy', 'isy_user') isy_pass = app.config.get('isy', 'isy_pass') app.log.debug('Connecting to ISY controller @%s' % isy_addr, __name__) try: isy = Isy(addr=isy_addr, userl=isy_user, userp=isy_pass) except Exception as e: app.log.error('Unable to connect to ISY controller @%s' % isy_addr, __name__) app.log.error(e) return # extend the event engine app object with an ``isy`` member app.extend('isy', isy) # Make sure we pre populate all internal isy structures isy.load_nodes()
isy_pass = app.config.get('isy', 'isy_pass') app.log.debug('Connecting to ISY controller @%s' % isy_addr, __name__) try: isy = Isy(addr=isy_addr, userl=isy_user, userp=isy_pass) except Exception as e: app.log.error('Unable to connect to ISY controller @%s' % isy_addr, __name__) app.log.error(e) app.close() exit(1) # Make sure we pre populate all internal isy structures try: isy.load_nodes() except Exception as e: app.log.error('Unable to load ISY nodes.', __name__) app.log.error(e) app.close() # Wait a few seconds to recover in case process restarts under supervisord time.sleep(5) exit(2) # Realtime event feeder def eventFeed(*arg): # Flatten dict and turn embedded structure into dot notation data = flatten_dict(arg[0])