@@ -123,53 +123,41 @@ def toggle_light(self, selector, all_lights=False, duration=0):
123
123
"""
124
124
if all_lights :
125
125
selector = 'all'
126
- path = LIFX_URL + selector + '/toggle'
127
126
data = {'duration' :duration }
128
- return self ._post (path , data )
127
+ return self ._post (LIFX_URL + selector + '/toggle' , data )
129
128
130
129
def move_effect (self , selector , move_direction , period , power_on ):
131
130
"""Performs a linear move effect on a light, or lights.
132
131
:param str move_direction: Move direction, forward or backward.
133
132
:param double period: Time in second per effect cycle.
134
133
:param bool power_on: Turn on a light before performing the move.
135
134
"""
136
- path = LIFX_URL + selector + '/effects/move'
137
135
data = {'direction' :move_direction ,
138
136
'period' :period ,
139
137
'power_on' :power_on }
140
- return self ._post (path , data )
138
+ return self ._post (LIFX_URL + selector + '/effects/move' , data )
141
139
142
140
def effects_off (self , selector , power_off = False ):
143
141
"""Turns off any running effects on the selected device.
144
142
:param dict selector: Selector to control which lights are requested.
145
143
:param bool power_off: If true, the devices will also be turned off.
146
144
"""
147
- path = LIFX_URL + selector + '/effects/off'
148
145
data = {'power_off' , power_off }
149
- return self ._post (path , data )
146
+ return self ._post (LIFX_URL + selector + '/effects/off' , data )
150
147
151
148
def set_brightness (self , selector , brightness ):
152
149
"""Sets the state of the lights within the selector.
153
150
:param dict selector: Selector to control which lights are requested.
154
151
:param double brightness: Brightness level of the light, from 0.0 to 1.0.
155
152
"""
156
- path = LIFX_URL + selector + '/state'
157
153
data = {'brightness' :brightness }
158
- return self ._put (path , data )
154
+ return self ._put (LIFX_URL + selector + '/state' , data )
159
155
160
- def set_color (self , selector , power , color , brightness = 1.0 ):
156
+ def set_color (self , selector , ** kwargs ):
161
157
"""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
166
159
"""
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 )
173
161
174
162
def list_lights (self ):
175
163
"""Enumerates all the lights associated with the LIFX Cloud Account
0 commit comments