huemote 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33e0123a389a11d755de13f14aa2f4826ab35f7b
4
- data.tar.gz: 2bc12f2992fa4e3611aed8c43f8a80bb7247f115
3
+ metadata.gz: 9010083d38b18502ddbc4578899fcf199db83ee8
4
+ data.tar.gz: c0e2fc0f6a9b6fb9374ec0cd098c69f0b89c55b7
5
5
  SHA512:
6
- metadata.gz: 019d60ce3b9a6a8631c2fa717ede95b202d93616b1abd7d721de35efbe283a4e59b2c62e3d53bdbefb5f39cae268396df024ca56bf7b02f563b94948f3e25b59
7
- data.tar.gz: 7b5afa4964f62c0ded5435a290a2d04abb9f821e57f7066e5819a8ff25f4e3d9eb15170a99a6582071bcbc395188d77fd36cc4724a36bc2cb0e33b2bd38fdd63
6
+ metadata.gz: 9efec171e29f6b5b3ea924a5d78a85602fd5f184d07a5953621fcf4b94d4c16063b517f972266be2f07e7c4c31a75f72d094656b41cc2373184d6f52dafdd80d
7
+ data.tar.gz: c359dc6e8424663a8cd5b5fcbd838ab37d1a1f8770f87782d3327d5fdab25ed2fc1b4d8beb6c39c3e7cc3dff5a6dc8b6d82c3b93e19b2ac6435393ee5283b887
@@ -8,8 +8,8 @@ module Huemote
8
8
  require_relative './huemote/bridge'
9
9
 
10
10
  class << self
11
- def discover(broadcast='255.255.255.255')
12
- Huemote::Bridge.send(:discover,broadcast)
11
+ def discover
12
+ Huemote::Bridge.send(:discover)
13
13
  end
14
14
  end
15
15
  end
@@ -4,7 +4,8 @@ require 'ipaddr'
4
4
  module Huemote
5
5
  class Bridge
6
6
  DEVICE_TYPE = "Huemote"
7
- USERNAME = "HuemoteRubyGem"
7
+ GOOGLE_IP = "64.233.187.99"
8
+ USERNAME = "HuemoteRubyGem"
8
9
 
9
10
  class << self
10
11
  def get
@@ -13,10 +14,11 @@ module Huemote
13
14
 
14
15
  private
15
16
 
16
- def discover(broadcast = '255.255.255.255')
17
+ def discover
17
18
  client = Huemote::Client.new
18
- arp = `ping -t 1 #{broadcast} > /dev/null && arp -na | grep 0:17:88`.split("\n")[0]
19
- host = /\((\d+\.\d+\.\d+\.\d+)\)/.match(arp)[1]
19
+ ip = UDPSocket.open {|s| s.connect(GOOGLE_IP, 1); s.addr.last}
20
+ device = `nmap -sP #{ip.split('.')[0..-2].join('.')}.* > /dev/null && arp -na | grep 0:17:88`.split("\n")[0]
21
+ host = /\((\d+\.\d+\.\d+\.\d+)\)/.match(device)[1]
20
22
 
21
23
  body = client.get("http://#{host}:80/description.xml").body
22
24
 
@@ -1,3 +1,3 @@
1
1
  module Huemote
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huemote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gisi