renstar 0.4.3 → 0.4.4
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 +4 -4
- data/lib/renstar/discovery.rb +1 -15
- data/lib/renstar/thermostat.rb +12 -0
- data/lib/renstar/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5990b28a9195f211562ebc90e3164440e0a8e401272fa87c7d9a3f0bf8636a4
|
|
4
|
+
data.tar.gz: de3c2bc468511bbc4ce4e57030883996384a83572a70fa649fb882980318a78f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08cb4e79d6675044dad081a517a5efd9c683b80e593f566459202084c35962f7c37c7f92448cad5d1a957a1753d972de8cbb7ca96e08db0d86716701af1aec6c'
|
|
7
|
+
data.tar.gz: 70a6044088c34b6a0c56d410cc63a1bfee460b6a4c2290846d09f03ed9263504f33c2b1706228e459a2be233de1e0a55439aa6a824b7047d2cc7721950ceb51d
|
data/lib/renstar/discovery.rb
CHANGED
|
@@ -8,17 +8,8 @@ module Renstar
|
|
|
8
8
|
# the network
|
|
9
9
|
module Discovery
|
|
10
10
|
# Discovery timeout when searching for thermostats
|
|
11
|
-
DEFAULT_TIMEOUT = 3
|
|
12
11
|
SERVICE = 'venstar:thermostat:ecp'
|
|
13
12
|
|
|
14
|
-
def search(timeout = DEFAULT_TIMEOUT)
|
|
15
|
-
all_thermos = []
|
|
16
|
-
ips.each do |ip|
|
|
17
|
-
all_thermos << ssdp_search(ip, timeout)
|
|
18
|
-
end
|
|
19
|
-
all_thermos.flatten
|
|
20
|
-
end
|
|
21
|
-
|
|
22
13
|
private
|
|
23
14
|
|
|
24
15
|
def ips
|
|
@@ -28,15 +19,10 @@ module Renstar
|
|
|
28
19
|
end
|
|
29
20
|
|
|
30
21
|
# do an SSDP search using the given IP from a found local interface
|
|
31
|
-
def ssdp_search(ip, timeout =
|
|
22
|
+
def ssdp_search(ip, timeout = 5)
|
|
32
23
|
puts "Searching subnet associated with #{ip.ip_address}"
|
|
33
24
|
ssdp = SSDP::Consumer.new({ bind: ip.ip_address })
|
|
34
25
|
thermos = ssdp.search(service: SERVICE, timeout: timeout)
|
|
35
|
-
thermos.map do |thermo|
|
|
36
|
-
location = thermo[:params]['Location']
|
|
37
|
-
usn = thermo[:params]['USN']
|
|
38
|
-
Renstar::Thermostat.new(location, usn)
|
|
39
|
-
end
|
|
40
26
|
end
|
|
41
27
|
end
|
|
42
28
|
end
|
data/lib/renstar/thermostat.rb
CHANGED
|
@@ -30,6 +30,18 @@ module Renstar
|
|
|
30
30
|
@cached_info = info
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def self.search(timeout = 3)
|
|
34
|
+
all_thermos = []
|
|
35
|
+
ips.each do |ip|
|
|
36
|
+
all_thermos << ssdp_search(ip, timeout)
|
|
37
|
+
end
|
|
38
|
+
all_thermos.flatten.map do |thermo|
|
|
39
|
+
location = thermo[:params]['Location']
|
|
40
|
+
usn = thermo[:params]['USN']
|
|
41
|
+
Renstar::Thermostat.new(location, usn)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
33
45
|
def update
|
|
34
46
|
@cache_timestamp = Time.now
|
|
35
47
|
@cached_info = info
|
data/lib/renstar/version.rb
CHANGED