#NEWLINE# def poll( self ) : #NEWLINE# #INDENT# " Poll Hue for new lights/existing lights' statuses " #NEWLINE# if ( self . hub is None ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# api = self . _get_api ( ) #NEWLINE# if ( not api ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# lights = api [ 'lights' ] #NEWLINE# manifest = self . config . get ( 'manifest' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for ( lamp_id , data ) in lights . items ( ) : #NEWLINE# #INDENT# address = id_2_addr ( data [ 'uniqueid' ] ) #NEWLINE# name = data [ 'name' ] #NEWLINE# lnode = self . get_node ( address ) #NEWLINE# if ( not lnode ) : #NEWLINE# #INDENT# lnode = HueColorLight ( self , address , name , lamp_id , self . get_node ( 'hub' ) , manifest ) #NEWLINE# #UNINDENT# ( color_x , color_y ) = [ round ( val , 4 ) for val in data [ 'state' ] . get ( 'xy' , [ 0.0 , 0.0 ] ) ] #NEWLINE# brightness = round ( ( ( data [ 'state' ] [ 'bri' ] / 255.0 ) * 100.0 ) , 4 ) #NEWLINE# brightness = ( brightness if data [ 'state' ] [ 'on' ] else 0 ) #NEWLINE# lnode . set_driver ( 'GV1' , color_x ) #NEWLINE# lnode . set_driver ( 'GV2' , color_y ) #NEWLINE# lnode . set_driver ( 'ST' , brightness ) #NEWLINE# #UNINDENT# return True