#NEWLINE# def set_power_all_lights( self , power_level , duration = 0 , rapid = False ) : #NEWLINE# #INDENT# on = [ True , 1 , 'on' , 65535 ] #NEWLINE# off = [ False , 0 , 'off' ] #NEWLINE# try : #NEWLINE# #INDENT# if ( ( power_level in on ) and ( not rapid ) ) : #NEWLINE# #INDENT# self . broadcast_with_ack ( LightSetPower , { #NEWLINE# #INDENT# 'power_level' : 65535 , #NEWLINE# 'duration' : duration , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( power_level in on ) and rapid ) : #NEWLINE# #INDENT# self . broadcast_fire_and_forget ( LightSetPower , { #NEWLINE# #INDENT# 'power_level' : 65535 , #NEWLINE# 'duration' : duration , #NEWLINE# #UNINDENT# } , num_repeats = 5 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( power_level in off ) and ( not rapid ) ) : #NEWLINE# #INDENT# self . broadcast_with_ack ( LightSetPower , { #NEWLINE# #INDENT# 'power_level' : 0 , #NEWLINE# 'duration' : duration , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( power_level in off ) and rapid ) : #NEWLINE# #INDENT# self . broadcast_fire_and_forget ( LightSetPower , { #NEWLINE# #INDENT# 'power_level' : 0 , #NEWLINE# 'duration' : duration , #NEWLINE# #UNINDENT# } , num_repeats = 5 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( '{} is not a valid power level.' . format ( power_level ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except WorkflowException as e : #NEWLINE# #INDENT# print ( e )