lights 0.8.8 → 0.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/bin/lights +21 -63
- data/lib/lights.rb +1 -1
- data/lib/lights/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDJjZTE1NTcwYjA3YWU5MmExMzUxNjQyODA5OTNhZDRiMjFjZjY2ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWI5NTA5NDA0ZGI2NTZkYjg3YWNiMjBkODJmZmM4MGM1MDlhMGIwMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGYzMWQwYTMyYjU2ODZlMWY4OTcxYzdjYjI1OTY2NDAxYjNjYmQyMDIwNjIz
|
10
|
+
Nzc0Y2M0ZThiMjk5MGI0NGI1ZGNjZjUyOWY0MTlmZmQ4MGY3YWI5ODg1ZTRm
|
11
|
+
M2E5MzhmMmQ3N2I0ZjI2OWFjZTYxMmE4NWNjMzc1YWMzNzcxMjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjMzZTFhNjkxZTMxYjk0ODhlZGU3NWY4MzdmYTE2NWEwMjg4OGVjZWFkZmNk
|
14
|
+
ODg2YjI2NmExYjk2NDI4YzliNjhkODVjYzdjYmJkYTVkMGNkMDQ0ODZlN2Y1
|
15
|
+
Mjc4ZGViOWY2NDUwOWM4NDgxMjIwNzYyZjc3N2E0MmVhMGJjODY=
|
data/bin/lights
CHANGED
@@ -22,18 +22,10 @@ class LightsCli
|
|
22
22
|
def config
|
23
23
|
options = {}
|
24
24
|
OptionParser.new do |opts|
|
25
|
-
opts.on("-u", "--user <username>", String, "Username")
|
26
|
-
|
27
|
-
|
28
|
-
opts.on("-
|
29
|
-
options[:ip] = ip
|
30
|
-
end
|
31
|
-
opts.on("-f", "--force", "Force write to config file") do |f|
|
32
|
-
options[:force] = f
|
33
|
-
end
|
34
|
-
opts.on("-l", "--list", "List saved configuration settings") do |l|
|
35
|
-
options[:list] = l
|
36
|
-
end
|
25
|
+
opts.on("-u", "--user <username>", String, "Username"){|url| options[:user]=url}
|
26
|
+
opts.on("-i", "--ip <bridge ip>", String, "Bridge ip address"){|ip| options[:ip]=ip}
|
27
|
+
opts.on("-f", "--force", "Force write to config file"){|f| options[:force]=f}
|
28
|
+
opts.on("-l", "--list", "List saved configuration settings") {|l| options[:list]=l}
|
37
29
|
end.parse!
|
38
30
|
|
39
31
|
if !options[:user] && !options[:ip] && !options[:list]
|
@@ -76,12 +68,8 @@ class LightsCli
|
|
76
68
|
case type
|
77
69
|
when "group"
|
78
70
|
OptionParser.new do |opts|
|
79
|
-
opts.on("-l", "--lights 1,2,...N", Array, "Which lights to put in group")
|
80
|
-
|
81
|
-
end
|
82
|
-
opts.on("-n", "--name <name>", String, "Set group name") do |n|
|
83
|
-
options[:name] = n
|
84
|
-
end
|
71
|
+
opts.on("-l", "--lights 1,2,...N", Array, "Which lights to put in group"){|l| options[:lights]=l}
|
72
|
+
opts.on("-n", "--name <name>", String, "Set group name"){|n| options[:name]=n}
|
85
73
|
end.parse!
|
86
74
|
|
87
75
|
if !options[:lights]
|
@@ -143,9 +131,7 @@ class LightsCli
|
|
143
131
|
|
144
132
|
options = {}
|
145
133
|
OptionParser.new do |opts|
|
146
|
-
opts.on("-j", "--json", "Print JSON response")
|
147
|
-
options[:json] = j
|
148
|
-
end
|
134
|
+
opts.on("-j", "--json", "Print JSON response"){|j| options[:json] = j}
|
149
135
|
end.parse!
|
150
136
|
|
151
137
|
type = ARGV.shift
|
@@ -214,9 +200,7 @@ class LightsCli
|
|
214
200
|
def discover
|
215
201
|
options = {}
|
216
202
|
OptionParser.new do |opts|
|
217
|
-
opts.on("-s", "--save", "Save discovered bridge to configuration file")
|
218
|
-
options[:save] = s
|
219
|
-
end
|
203
|
+
opts.on("-s", "--save", "Save discovered bridge to configuration file"){|s| options[:save]=s}
|
220
204
|
end.parse!
|
221
205
|
|
222
206
|
lights = Lights.new @config["bridge_ip"], @config["username"]
|
@@ -254,42 +238,18 @@ class LightsCli
|
|
254
238
|
def set
|
255
239
|
options = {}
|
256
240
|
OptionParser.new do |opts|
|
257
|
-
opts.on("-o", "--on", "Turn lights on")
|
258
|
-
|
259
|
-
|
260
|
-
opts.on("-
|
261
|
-
|
262
|
-
|
263
|
-
opts.on("-
|
264
|
-
|
265
|
-
|
266
|
-
opts.on("-
|
267
|
-
|
268
|
-
|
269
|
-
opts.on("-s", "--saturation saturation", OptionParser::DecimalInteger, "Set saturation") do |s|
|
270
|
-
options[:saturation] = s
|
271
|
-
end
|
272
|
-
opts.on("-h", "--hue hue", OptionParser::DecimalInteger, "Set hue") do |h|
|
273
|
-
options[:hue] = h
|
274
|
-
end
|
275
|
-
opts.on("-e", "--effect none|colorloop", String, "Set effect") do |e|
|
276
|
-
options[:effect] = e
|
277
|
-
end
|
278
|
-
opts.on("-a", "--alert none|select|lselect", String, "Set alert") do |a|
|
279
|
-
options[:alert] = a
|
280
|
-
end
|
281
|
-
opts.on("-z", "--xy x,y", Array, "Set xy") do |z|
|
282
|
-
options[:xy] = z
|
283
|
-
end
|
284
|
-
opts.on("-l", "--lights 1,2,...N", Array, "Which lights to control") do |l|
|
285
|
-
options[:lights] = l
|
286
|
-
end
|
287
|
-
opts.on("-g", "--groups 1,2,...N", Array, "Which groups to control") do |g|
|
288
|
-
options[:groups] = g
|
289
|
-
end
|
290
|
-
opts.on("-d", "--duration seconds", OptionParser::DecimalInteger, "Transition duration in seconds") do |d|
|
291
|
-
options[:duration] = d
|
292
|
-
end
|
241
|
+
opts.on("-o", "--on", "Turn lights on"){|o| options[:on]=o}
|
242
|
+
opts.on("-f", "--off", "Turn lights off"){|f| options[:off]=f}
|
243
|
+
opts.on("-c", "--ct color_temp", OptionParser::DecimalInteger, "Set color temperature"){|c| options[:ct]=c}
|
244
|
+
opts.on("-b", "--brightness brightness", OptionParser::DecimalInteger, "Set brightness"){|b| options[:brightness]=b}
|
245
|
+
opts.on("-s", "--saturation saturation", OptionParser::DecimalInteger, "Set saturation"){|s| options[:saturation]=s}
|
246
|
+
opts.on("-h", "--hue hue", OptionParser::DecimalInteger, "Set hue"){|h| options[:hue]=h}
|
247
|
+
opts.on("-e", "--effect none|colorloop", String, "Set effect"){|e| options[:effect]=e}
|
248
|
+
opts.on("-a", "--alert none|select|lselect", String, "Set alert"){|a| options[:alert]=a}
|
249
|
+
opts.on("-z", "--xy x,y", Array, "Set xy"){|z| options[:xy]=z}
|
250
|
+
opts.on("-l", "--lights 1,2,...N", Array, "Which lights to control"){|l| options[:lights]=l}
|
251
|
+
opts.on("-g", "--groups 1,2,...N", Array, "Which groups to control"){|g| options[:groups]=g}
|
252
|
+
opts.on("-d", "--duration seconds", OptionParser::DecimalInteger, "Transition duration in seconds"){|d| options[:duration]=d}
|
293
253
|
end.parse!
|
294
254
|
|
295
255
|
bad_args = false
|
@@ -372,9 +332,7 @@ private
|
|
372
332
|
def on_off(is_on)
|
373
333
|
options = {}
|
374
334
|
OptionParser.new do |opts|
|
375
|
-
opts.on("-l", "--lights 1,2,...N", Array, "Which lights to control")
|
376
|
-
options[:lights] = l
|
377
|
-
end
|
335
|
+
opts.on("-l", "--lights 1,2,...N", Array, "Which lights to control"){|l| options[:lights]=l}
|
378
336
|
end.parse!
|
379
337
|
|
380
338
|
if !options[:lights]
|
data/lib/lights.rb
CHANGED
data/lib/lights/version.rb
CHANGED