huemote 0.0.4 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9010083d38b18502ddbc4578899fcf199db83ee8
4
- data.tar.gz: c0e2fc0f6a9b6fb9374ec0cd098c69f0b89c55b7
3
+ metadata.gz: 5d0b8b6f5a8a97cf8b6b65413026efd02bbb124a
4
+ data.tar.gz: 85a127ff1aa6ef4f1c2175f84d07f7f9a4f21c5c
5
5
  SHA512:
6
- metadata.gz: 9efec171e29f6b5b3ea924a5d78a85602fd5f184d07a5953621fcf4b94d4c16063b517f972266be2f07e7c4c31a75f72d094656b41cc2373184d6f52dafdd80d
7
- data.tar.gz: c359dc6e8424663a8cd5b5fcbd838ab37d1a1f8770f87782d3327d5fdab25ed2fc1b4d8beb6c39c3e7cc3dff5a6dc8b6d82c3b93e19b2ac6435393ee5283b887
6
+ metadata.gz: c5047b057003449eb4fc8cefdf962834e066e83bc40e8301694022e1aa02d30a4b0b897ee31e0d763f34a3fa91f8b66514431254a1b5e76867d9e103898ef60a
7
+ data.tar.gz: aa0783d7080b5be8d235caba338148124aadfe078416a2ed8d13142eae68109aeff5c10cf6778528a1de64b2382d4b1b49653976b89e0fff842aa107e9a97f0d
data/README.md CHANGED
@@ -16,6 +16,11 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install huemote
18
18
 
19
+ ## Recent Updates:
20
+ ### 0.1.0:
21
+ * Added `Huemote::Light#kelvin` - which will delegate to `Huemote::Light#ct`, by computing the mired value (constrained between 154-500 mired)
22
+ * Added support for setting a static IP (honestly, the preferred mechanism at this point; getting a stable method of device detection has been a nightmare). Run `Huemote.set_ip '192.168.1.x'` or equivalent, and then use the library as normal.
23
+
19
24
  ## Usage
20
25
 
21
26
  You can fetch all lights on your network via:
@@ -8,6 +8,10 @@ module Huemote
8
8
  require_relative './huemote/bridge'
9
9
 
10
10
  class << self
11
+ def set_ip(ip)
12
+ Huemote::Bridge.send(:set_ip,ip)
13
+ end
14
+
11
15
  def discover
12
16
  Huemote::Bridge.send(:discover)
13
17
  end
@@ -8,8 +8,20 @@ module Huemote
8
8
  USERNAME = "HuemoteRubyGem"
9
9
 
10
10
  class << self
11
+ def set_ip(ip)
12
+ @static_ip = ip
13
+ end
14
+
11
15
  def get
12
- @bridge ||= discover
16
+ @bridge ||= begin
17
+ if @static_ip
18
+ client = Huemote::Client.new
19
+ body = client.get("http://#{@static_ip}:80/description.xml").body
20
+ self.new(@static_ip,80,body)
21
+ else
22
+ discover
23
+ end
24
+ end
13
25
  end
14
26
 
15
27
  private
@@ -56,6 +56,10 @@ module Huemote
56
56
  on? ? off! : on!
57
57
  end
58
58
 
59
+ def kelvin(temp)
60
+ ct [[1000000/temp,154].max,500].min
61
+ end
62
+
59
63
  STATES.each do |name,state|
60
64
  define_method name do |arg|
61
65
  set!(state => arg)
@@ -1,3 +1,3 @@
1
1
  module Huemote
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huemote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gisi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-08 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Huemote is a Ruby gem for managing Philips Hue lights
14
14
  email:
@@ -58,4 +58,3 @@ summary: Huemote is a Ruby gem for managing Philips Hue lights
58
58
  test_files:
59
59
  - spec/huemote/bridge_spec.rb
60
60
  - spec/spec_helper.rb
61
- has_rdoc: