wemote 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wemote.rb +2 -2
- data/lib/wemote/switch.rb +5 -2
- data/lib/wemote/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fab169b7fb29b3ed90820cfa268951f6a88f28d
|
4
|
+
data.tar.gz: cd0c3fd1971486865e170eae94cca933e1558070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f365c6b952fd03d3b38d53081ede3d21ac1d28a1c4568e0d0275d9f3ddc0732a0b8651fbf33a20c0aa43d9335b0d41449906df90f4902e74a064f2f08e304de1
|
7
|
+
data.tar.gz: aafdae13551a09dfc8b4ce12336e6a3e3971add9667f7a61c5dd4b57353e5d49e4f69112d0a6945304852e00320d33ef89a2d3029006ae3decd2e42c053274e6
|
data/lib/wemote.rb
CHANGED
data/lib/wemote/switch.rb
CHANGED
@@ -10,6 +10,8 @@ module Wemote
|
|
10
10
|
# to be executed any time the switch changes state.
|
11
11
|
class Switch
|
12
12
|
|
13
|
+
GOOGLE_IP = "64.233.187.99"
|
14
|
+
|
13
15
|
GET_HEADERS = {
|
14
16
|
"SOAPACTION" => '"urn:Belkin:service:basicevent:1#GetBinaryState"',
|
15
17
|
"Content-type" => 'text/xml; charset="utf-8"'
|
@@ -40,8 +42,9 @@ module Wemote
|
|
40
42
|
|
41
43
|
private
|
42
44
|
|
43
|
-
def discover
|
44
|
-
|
45
|
+
def discover
|
46
|
+
ip = UDPSocket.open {|s| s.connect(GOOGLE_IP, 1); s.addr.last}
|
47
|
+
`nmap -sP #{ip.split('.')[0..-2].join('.')}.* > /dev/null && arp -na | grep b4:75`.split("\n").map do |device|
|
45
48
|
self.new(/\((\d+\.\d+\.\d+\.\d+)\)/.match(device)[1])
|
46
49
|
end.reject{|device| device.instance_variable_get(:@port).nil? }
|
47
50
|
end
|
data/lib/wemote/version.rb
CHANGED