lights 0.8.5 → 0.8.6
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 +19 -43
- 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
|
+
NzliNjA3YjZmZGExOWQwMmU2MjU2MzJhNDhkZjI4N2Y2MDdhOGEwMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWM4OTcyNDZlMGIxOGRiMmU5M2I0ZmU0YTg5M2Q4MjVhNDcwOWE5ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjNjZGVhYzNiN2Q0OWYzODlhODMyYjhkZDc2MDE4ZTA1ZmUyOWY5M2Q2MDZh
|
10
|
+
Nzk3NGRhZmQyZTYyODEyN2Q1Njk2MjdjYTg4MzIyMDU4OTRlMmE3N2NkMTIy
|
11
|
+
OTI2NTU1ZWRhNGYxOGY2MzQ0NjBlMzJiODhkZjhlYzg2ODA4MGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDUzZTkzMWEwYmNhNGNhNDQ0MGM0MDM0MmYxY2M3MDQ0OGQzMGU0ZjA0ZTVm
|
14
|
+
MTE5NGQ4YTZkODZmN2IyMmQ2ZGU1ZTYxZTA5M2RlNmM3OWM1M2FlYmRiMGYy
|
15
|
+
OTgxZGI2ZjExMWNkYzdlMGNjYjczZTQ1NzFkMDI1MzNlMWIwNDg=
|
data/bin/lights
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'lights'
|
4
4
|
require 'optparse'
|
5
5
|
require 'simpletable'
|
6
|
-
include SimpleTable
|
7
6
|
|
8
7
|
LIGHTS_CONFIG_PATH = "#{ENV["HOME"]}/.lightsconfig"
|
9
8
|
|
@@ -133,67 +132,44 @@ class LightsCli
|
|
133
132
|
|
134
133
|
def list
|
135
134
|
hue = Lights.new @config["bridge_ip"], @config["username"]
|
135
|
+
objects = []
|
136
|
+
titles = []
|
137
|
+
methods = []
|
136
138
|
if !ARGV[0] || ARGV[0] == "lights"
|
137
|
-
|
138
|
-
|
139
|
-
bulbs_response.each do |id,value|
|
140
|
-
bulbs << hue.request_bulb_info( id )
|
141
|
-
end
|
142
|
-
|
139
|
+
response = hue.request_bulb_list
|
140
|
+
response.each{|id,value| objects << hue.request_bulb_info( id )}
|
143
141
|
titles = ["ID","NAME"]
|
144
142
|
methods = [:id,:name]
|
145
|
-
SimpleTable.create(bulbs,titles,methods)
|
146
143
|
elsif ARGV[0] == "sensors"
|
147
|
-
|
148
|
-
|
149
|
-
sensors_response.each do |id,value|
|
150
|
-
sensors << hue.request_sensor_info( id )
|
151
|
-
end
|
152
|
-
|
144
|
+
response = hue.request_sensor_list
|
145
|
+
response.each { |id,value| objects << hue.request_sensor_info( id )}
|
153
146
|
titles = ["ID","NAME"]
|
154
147
|
methods = [:id,:name]
|
155
|
-
SimpleTable.create(sensors,titles,methods)
|
156
148
|
elsif ARGV[0] == "groups"
|
157
|
-
|
158
|
-
|
159
|
-
groups_response.each do |id,value|
|
160
|
-
groups << hue.request_group_info( id )
|
161
|
-
end
|
162
|
-
|
149
|
+
response = hue.request_group_list
|
150
|
+
response.each {|id,value| objects << hue.request_group_info( id )}
|
163
151
|
titles = ["ID","NAME","LIGHTS"]
|
164
152
|
methods = [:id,:name,:lights]
|
165
|
-
SimpleTable.create(groups,titles,methods)
|
166
153
|
elsif ARGV[0] == "scenes"
|
167
|
-
|
168
|
-
|
169
|
-
scenes_response.each do |id,value|
|
170
|
-
scenes << Scene.new(id,value)
|
171
|
-
end
|
172
|
-
|
154
|
+
response = hue.request_scene_list
|
155
|
+
response.each {|id,value| objects << Scene.new(id,value)}
|
173
156
|
titles = ["ID","NAME","LIGHTS"]
|
174
157
|
methods = [:id,:name,:lights]
|
175
|
-
SimpleTable.create(scenes,titles,methods)
|
176
158
|
elsif ARGV[0] == "users"
|
177
|
-
|
178
|
-
|
179
|
-
config_response["whitelist"].each do |id,value|
|
180
|
-
users << User.new(id,value)
|
181
|
-
end
|
182
|
-
|
159
|
+
response = hue.request_config
|
160
|
+
response["whitelist"].each {|id,value| objects << User.new(id,value)}
|
183
161
|
titles = ["ID","NAME","CREATE DATE","LAST USE DATE"]
|
184
162
|
methods = [:id,:name,:create_date,:last_use_date]
|
185
|
-
SimpleTable.create(users,titles,methods)
|
186
163
|
elsif ARGV[0] == "rules"
|
187
|
-
|
188
|
-
|
189
|
-
rules_response.each do |id,value|
|
190
|
-
rules << Rule.new(id,value)
|
191
|
-
end
|
192
|
-
|
164
|
+
response = hue.request_rules
|
165
|
+
response.each {|id,value| objects << Rule.new(id,value)}
|
193
166
|
titles = ["ID","NAME"]
|
194
167
|
methods = [:id,:name]
|
195
|
-
|
168
|
+
else
|
169
|
+
puts "Don't know how to list \"#{ARGV[0]}\""
|
170
|
+
return
|
196
171
|
end
|
172
|
+
SimpleTable.new.from_objects(objects,titles,methods).print_text
|
197
173
|
end
|
198
174
|
|
199
175
|
def register
|
data/lib/lights/version.rb
CHANGED