ledenet_api 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -9
- data/bin/ledenet-ufo +4 -2
- data/lib/ledenet/device_discovery.rb +9 -2
- data/lib/ledenet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e5e8d4f413e19ff927524214a21ebca92d355cc
|
4
|
+
data.tar.gz: b6dc2f96936668a01e67d60aff2e563df065d89e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b9a5f1d845bacb6a282f0d8042783a999a260bdb50b91136b29dd45f593b35c8d9262e1754b06285fce171142fd8add6830be9f2eb91afda10d70ba7f4c741
|
7
|
+
data.tar.gz: 3f93c82424f55dc7fe237c30150d25e5223d6f5c61564be352ab8a6ab344b658016fce8022dd5888eb2926056fe965e9edff7cfc410c7d308efeb1112d60b546
|
data/README.md
CHANGED
@@ -61,15 +61,15 @@ $ ledenet-ufo --list
|
|
61
61
|
#### Get current status
|
62
62
|
|
63
63
|
```
|
64
|
-
$ ledenet-ufo
|
65
|
-
{"red":"255","green":"255","blue":"255","warm_white":"255","
|
64
|
+
$ ledenet-ufo --status
|
65
|
+
{"is_on":true,"red":"255","green":"255","blue":"255","warm_white":"255","running_function?":false,"speed":61,"speed_packet_value":"12","function_name":"NO_FUNCTION","function_id":"97"}
|
66
66
|
```
|
67
67
|
|
68
68
|
#### Turn on, adjust colors
|
69
69
|
|
70
70
|
```
|
71
71
|
$ ledenet-ufo --on -r 200 -g 0 -b 255 --warm-white 0 --status
|
72
|
-
{"red":"200","green":"0","blue":"255","warm_white":"
|
72
|
+
{"is_on":true,"red":"200","green":"0","blue":"255","warm_white":"0","running_function?":false,"speed":99,"speed_packet_value":"0","function_name":"NO_FUNCTION","function_id":"97"}
|
73
73
|
```
|
74
74
|
|
75
75
|
#### Turn off
|
@@ -81,7 +81,8 @@ $ ledenet-ufo --off
|
|
81
81
|
#### Set function
|
82
82
|
|
83
83
|
```
|
84
|
-
$ ledenet-ufo --function seven_color_cross_fade --
|
84
|
+
$ ledenet-ufo --speed 60 --function seven_color_cross_fade --status
|
85
|
+
{"is_on":true,"red":"255","green":"0","blue":"0","warm_white":"255","running_function?":true,"speed":61,"speed_packet_value":"12","function_name":"SEVEN_COLOR_CROSS_FADE","function_id":"37"}
|
85
86
|
```
|
86
87
|
|
87
88
|
### Ruby API
|
@@ -180,12 +181,13 @@ LEDENET::Functions.all_functions
|
|
180
181
|
```
|
181
182
|
|
182
183
|
```ruby
|
183
|
-
|
184
|
-
|
184
|
+
api.update_function(:seven_color_cross_fade)
|
185
|
+
api.update_function_speed(100) #very fast
|
185
186
|
|
186
|
-
api.
|
187
|
-
|
188
|
-
|
187
|
+
api.update_function_data(
|
188
|
+
function_id: LEDENET::Functions::BLUE_GREEN_CROSS_FADE,
|
189
|
+
speed: 50
|
190
|
+
)
|
189
191
|
```
|
190
192
|
|
191
193
|
To quit the function and return to a constant color, simply update a color value:
|
data/bin/ledenet-ufo
CHANGED
@@ -106,7 +106,7 @@ begin
|
|
106
106
|
row_format = "%16s %18s %20s\n"
|
107
107
|
printf row_format, "IP ADDRESS", "HW ADDRESS", "Model #"
|
108
108
|
|
109
|
-
|
109
|
+
devices.each do |device|
|
110
110
|
formatted_hwaddr = (0...12).step(2)
|
111
111
|
.map { |x| device.hw_addr[x, 2] }
|
112
112
|
.join(':')
|
@@ -119,7 +119,9 @@ begin
|
|
119
119
|
if options[:ip]
|
120
120
|
ip = options[:ip]
|
121
121
|
elsif options[:hw_addr]
|
122
|
-
r = LEDENET.discover_devices
|
122
|
+
r = LEDENET.discover_devices(expected_hw_addrs: [options[:hw_addr]])
|
123
|
+
r.select! { |x| x.hw_addr == options[:hw_addr] }
|
124
|
+
|
123
125
|
if r.empty?
|
124
126
|
raise "Couldn't find device with mac addr: #{options[:hw_addr]}"
|
125
127
|
end
|
@@ -19,6 +19,7 @@ module LEDENET
|
|
19
19
|
expected_devices: 1,
|
20
20
|
timeout: 5,
|
21
21
|
expected_models: [],
|
22
|
+
expected_hw_addrs: [],
|
22
23
|
udp_port: 48899
|
23
24
|
}
|
24
25
|
|
@@ -39,12 +40,17 @@ module LEDENET
|
|
39
40
|
|
40
41
|
discovered_devices = []
|
41
42
|
discovered_models = Set.new
|
43
|
+
discovered_hw_addrs = Set.new
|
42
44
|
expected_models = Set.new(options[:expected_models])
|
45
|
+
expected_hw_addrs = Set.new(
|
46
|
+
options[:expected_hw_addrs].map { |x| x.gsub(':', '').upcase }
|
47
|
+
)
|
43
48
|
|
44
49
|
begin
|
45
50
|
Timeout::timeout(options[:timeout]) do
|
46
|
-
while discovered_devices.count < options[:expected_devices]
|
47
|
-
!expected_models.subset?(discovered_models)
|
51
|
+
while discovered_devices.count < options[:expected_devices] ||
|
52
|
+
!expected_models.subset?(discovered_models) ||
|
53
|
+
!expected_hw_addrs.subset?(discovered_hw_addrs)
|
48
54
|
data = send_socket.recv(1024)
|
49
55
|
|
50
56
|
device = LEDENET::Device.new(data)
|
@@ -52,6 +58,7 @@ module LEDENET
|
|
52
58
|
if device.ip and device.hw_addr and device.model
|
53
59
|
discovered_devices.push(device)
|
54
60
|
discovered_models.add(device.model)
|
61
|
+
discovered_hw_addrs.add(device.hw_addr)
|
55
62
|
end
|
56
63
|
end
|
57
64
|
end
|
data/lib/ledenet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ledenet_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Mullins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|