lights 0.8.12 → 0.8.13
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 +11 -2
- data/lib/lights/bulbstate.rb +9 -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
|
+
MDM3ZmNkN2M5OTJkNjVmZmYzNTBiNzVhNDdiZDJmNWYzNjYxNjA1YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmJjMjVjY2M5M2MyZWFmYTIwMmIyYTE2MjZhNTQxN2JjNTBhNDAxNw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDM1NjliNTIxYjc5MDgzYmU0OTMxMTYwZTllMmIxMjQxNTdmMTBkYjhkYjAy
|
10
|
+
ZDBkZjRjMmVhZGNiODlkMGQzNDNlOTY1NDhlMjEwNWIwZDRjMmFiMjEyZDQ2
|
11
|
+
ZmQ5MjM1ZjFmNmFjNmE5YTQxZmU0NGZlYWRiYjY3OTUxODA1YzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmNhNjFmMmRlNjY5Njc2OTQzZDc2YjQ4NDRhOWQ2MDg1NmRhOWFjMDIwMjY3
|
14
|
+
YWFlZDlkM2IyYWU0ODkxOTBhMmIyOGQxNWZjNGM2ZGFiM2Q3Mjg1OWFkYmRk
|
15
|
+
MzE5Y2U3ZDE4ZjI5MWVlOTc0MWY3NzQ2MjZjMDRjNGQxMGJiMmQ=
|
data/bin/lights
CHANGED
@@ -284,7 +284,8 @@ class LightsCli
|
|
284
284
|
OptionParser.new do |opts|
|
285
285
|
opts.on("-o", "--on", "Turn lights on"){|o| options[:on]=o}
|
286
286
|
opts.on("-f", "--off", "Turn lights off"){|f| options[:off]=f}
|
287
|
-
opts.on("-c", "--
|
287
|
+
opts.on("-c", "--color <red|blue|purple|yellow|green|lgreen>", String, "Set color"){|c| options[:color]=c}
|
288
|
+
opts.on("-t", "--ct color_temp", OptionParser::DecimalInteger, "Set color temperature"){|c| options[:ct]=c}
|
288
289
|
opts.on("-b", "--brightness brightness", OptionParser::DecimalInteger, "Set brightness"){|b| options[:brightness]=b}
|
289
290
|
opts.on("-s", "--saturation saturation", OptionParser::DecimalInteger, "Set saturation"){|s| options[:saturation]=s}
|
290
291
|
opts.on("-h", "--hue hue", OptionParser::DecimalInteger, "Set hue"){|h| options[:hue]=h}
|
@@ -301,7 +302,7 @@ class LightsCli
|
|
301
302
|
&& !options[:ct] && !options[:brightness] \
|
302
303
|
&& !options[:hue] && !options[:saturation] \
|
303
304
|
&& !options[:effect] && !options[:alert] \
|
304
|
-
&& !options[:xy]
|
305
|
+
&& !options[:xy] && !options[:color]
|
305
306
|
puts "Must specify a state to set."
|
306
307
|
bad_args = true
|
307
308
|
end
|
@@ -322,6 +323,14 @@ class LightsCli
|
|
322
323
|
elsif options[:off]
|
323
324
|
s.on = false
|
324
325
|
end
|
326
|
+
if options[:color]
|
327
|
+
begin
|
328
|
+
s.hue = BulbState::Hue.const_get options[:color].upcase
|
329
|
+
rescue NameError
|
330
|
+
puts "Unrecognized color: #{options[:color]}"
|
331
|
+
exit 1
|
332
|
+
end
|
333
|
+
end
|
325
334
|
if options[:ct]
|
326
335
|
s.ct = options[:ct]
|
327
336
|
end
|
data/lib/lights/bulbstate.rb
CHANGED
@@ -29,10 +29,18 @@ class BulbState
|
|
29
29
|
CT = "ct"
|
30
30
|
end
|
31
31
|
|
32
|
+
module Hue
|
33
|
+
YELLOW = 12750
|
34
|
+
LGREEN = 22500
|
35
|
+
GREEN = 25500
|
36
|
+
BLUE = 46920
|
37
|
+
PURPLE = 56100
|
38
|
+
RED = 65535
|
39
|
+
end
|
40
|
+
|
32
41
|
attr_reader :on, :bri, :hue, :sat, :xy, :ct,
|
33
42
|
:alert, :effect, :color_mode,
|
34
43
|
:reachable, :transition_time
|
35
|
-
|
36
44
|
def initialize( data = {} )
|
37
45
|
data = {} if data == nil
|
38
46
|
@on = data["on"]
|
data/lib/lights/version.rb
CHANGED