#NEWLINE# def connect( self ) : #NEWLINE# #INDENT# ' Connect to Phillips Hue Hub ' #NEWLINE# hub = self . get_node ( 'hub' ) #NEWLINE# ip_addr = '{}.{}.{}.{}' . format ( hub . get_driver ( 'GV1' ) [ 0 ] , hub . get_driver ( 'GV2' ) [ 0 ] , hub . get_driver ( 'GV3' ) [ 0 ] , hub . get_driver ( 'GV4' ) [ 0 ] ) #NEWLINE# try : #NEWLINE# #INDENT# self . hub = phue . Bridge ( ip_addr , config_file_path = os . path . join ( os . getcwd ( ) , 'bridges' ) ) #NEWLINE# #UNINDENT# except phue . PhueRegistrationException : #NEWLINE# #INDENT# self . poly . send_error ( 'IP Address OK. Node Server not registered.' ) #NEWLINE# return False #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# self . poly . send_error ( 'Cannot find hub at {}' . format ( ip_addr ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# api = self . _get_api ( ) #NEWLINE# if api : #NEWLINE# #INDENT# hub . set_driver ( 'GV5' , 1 ) #NEWLINE# hub . report_driver ( ) #NEWLINE# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . hub = None #NEWLINE# return False