@@ -123,53 +123,41 @@ def toggle_light(self, selector, all_lights=False, duration=0):
123123 """
124124 if all_lights :
125125 selector = 'all'
126- path = LIFX_URL + selector + '/toggle'
127126 data = {'duration' :duration }
128- return self ._post (path , data )
127+ return self ._post (LIFX_URL + selector + '/toggle' , data )
129128
130129 def move_effect (self , selector , move_direction , period , power_on ):
131130 """Performs a linear move effect on a light, or lights.
132131 :param str move_direction: Move direction, forward or backward.
133132 :param double period: Time in second per effect cycle.
134133 :param bool power_on: Turn on a light before performing the move.
135134 """
136- path = LIFX_URL + selector + '/effects/move'
137135 data = {'direction' :move_direction ,
138136 'period' :period ,
139137 'power_on' :power_on }
140- return self ._post (path , data )
138+ return self ._post (LIFX_URL + selector + '/effects/move' , data )
141139
142140 def effects_off (self , selector , power_off = False ):
143141 """Turns off any running effects on the selected device.
144142 :param dict selector: Selector to control which lights are requested.
145143 :param bool power_off: If true, the devices will also be turned off.
146144 """
147- path = LIFX_URL + selector + '/effects/off'
148145 data = {'power_off' , power_off }
149- return self ._post (path , data )
146+ return self ._post (LIFX_URL + selector + '/effects/off' , data )
150147
151148 def set_brightness (self , selector , brightness ):
152149 """Sets the state of the lights within the selector.
153150 :param dict selector: Selector to control which lights are requested.
154151 :param double brightness: Brightness level of the light, from 0.0 to 1.0.
155152 """
156- path = LIFX_URL + selector + '/state'
157153 data = {'brightness' :brightness }
158- return self ._put (path , data )
154+ return self ._put (LIFX_URL + selector + '/state' , data )
159155
160- def set_color (self , selector , power , color , brightness = 1.0 ):
156+ def set_color (self , selector , ** kwargs ):
161157 """Sets the state of the light's color within the selector.
162- :param dict selector: Selector to control which lights are requested.
163- :param str power: Sets the power state of the light (on/off).
164- :param str color: Color to set the light to (https://api.developer.lifx.com/v1/docs/colors).
165- :param double brightness: Brightness level of the light from 0.0 to 1.0.
158+ Valid arguments: https://api.developer.lifx.com/docs/set-state
166159 """
167- path = LIFX_URL + selector + '/state'
168- data = {'power' :power ,
169- 'color' :color ,
170- 'brightness' :brightness
171- }
172- return self ._put (path , data )
160+ return self ._put (LIFX_URL + selector + '/state' , kwargs )
173161
174162 def list_lights (self ):
175163 """Enumerates all the lights associated with the LIFX Cloud Account
0 commit comments