philips_hue 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/README.md +11 -10
- data/bin/all_off.rb +0 -0
- data/bin/all_on.rb +0 -0
- data/bin/flash.rb +10 -10
- data/lib/philips_hue/bridge.rb +1 -1
- data/lib/philips_hue/version.rb +1 -1
- data/philips_hue.gemspec +20 -0
- metadata +44 -8
- data/bin/test.rb +0 -8
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3-p327@lights_app --create
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
philips_hue (0.1.6)
|
5
|
+
httparty (>= 0.10.0)
|
6
|
+
json (>= 1.6)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
awesome_print (1.1.0)
|
12
|
+
coderay (1.0.9)
|
13
|
+
httparty (0.10.2)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
multi_xml (>= 0.5.2)
|
16
|
+
json (1.7.7)
|
17
|
+
method_source (0.8.1)
|
18
|
+
multi_json (1.6.1)
|
19
|
+
multi_xml (0.5.3)
|
20
|
+
pry (0.9.12)
|
21
|
+
coderay (~> 1.0.5)
|
22
|
+
method_source (~> 0.8)
|
23
|
+
slop (~> 3.4)
|
24
|
+
slop (3.4.3)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
awesome_print
|
31
|
+
philips_hue!
|
32
|
+
pry
|
data/README.md
CHANGED
@@ -12,12 +12,12 @@ Install with `gem install philips_hue`. [Check out the bin/ directory for exampl
|
|
12
12
|
You need two things to connect with your Hue, a name for your app and the IP address of the white Hue bridge.
|
13
13
|
|
14
14
|
* The IP address can be found on the Hue Community site. Login, [go here](https://www.meethue.com/en-US/user/preferencessmartbridge), click "Show me more," and find the IP under "Internal IP address." Example: `"192.168.1.14"`
|
15
|
-
* The app name can be anything you like. You must register your app with the Hue by running `PhilipsHue#register
|
15
|
+
* The app name can be anything you like. You must register your app with the Hue by running `PhilipsHue#register` and pressing the button on the bridge. You must do this again for every new app name you create. Example: `"my light app"`
|
16
|
+
* Skip this step by running the [bin/register.rb](https://github.com/dmerrick/lights_app/blob/master/bin/register.rb) script.
|
16
17
|
|
17
|
-
|
18
|
+
For example:
|
18
19
|
```ruby
|
19
|
-
|
20
|
-
hue.register!
|
20
|
+
PhilipsHue::Bridge.register("my light app", "192.168.1.14")
|
21
21
|
```
|
22
22
|
|
23
23
|
### Getting the State of a Light
|
@@ -25,11 +25,12 @@ Full example:
|
|
25
25
|
There are many available status options in the `Light` class.
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
|
29
|
-
|
28
|
+
hue = PhilipsHue::Bridge.new("my light app", "192.168.1.14")
|
29
|
+
light1, light2, light3 = hue.lights
|
30
|
+
puts light1.state
|
30
31
|
puts light1.colormode
|
31
|
-
puts
|
32
|
-
puts
|
32
|
+
puts light2.bri
|
33
|
+
puts light3
|
33
34
|
# => "Front right is on and reachable"
|
34
35
|
```
|
35
36
|
|
@@ -40,8 +41,8 @@ To change the state of a light, simply modify the value of one of the state para
|
|
40
41
|
|
41
42
|
```ruby
|
42
43
|
light1.xy = [0.6446, 0.3289]
|
43
|
-
light1.ct = 200
|
44
|
-
light1.hue = 25000
|
44
|
+
light1.ct = 200
|
45
|
+
light1.hue = 25000
|
45
46
|
# etc.
|
46
47
|
```
|
47
48
|
|
data/bin/all_off.rb
CHANGED
File without changes
|
data/bin/all_on.rb
CHANGED
File without changes
|
data/bin/flash.rb
CHANGED
@@ -22,24 +22,24 @@ options.api_url = "192.168.1.14"
|
|
22
22
|
|
23
23
|
OptionParser.new do |opts|
|
24
24
|
opts.banner = "Usage: flash.rb [options]"
|
25
|
-
opts.on("-
|
25
|
+
opts.on("-a [app_name]","--app [app_name]", "The name of the registered app") do |app|
|
26
|
+
options.app_name = app
|
27
|
+
end
|
28
|
+
opts.on("-b [addr]","--bridge [addr]", "The address of the Hue bridge") do |api|
|
29
|
+
options.api_url = api
|
30
|
+
end
|
31
|
+
opts.on("-l [id]", "--light [id]", Integer, "Light to flash") do |id|
|
26
32
|
options.light_id = id
|
27
33
|
end
|
28
|
-
opts.on("-c [color]", "The color to flash") do |color|
|
34
|
+
opts.on("-c [color]", "--color [color]", "The color to flash") do |color|
|
29
35
|
options.color = colors[color]
|
30
36
|
end
|
31
|
-
opts.on("-t [secs]", Float, "Length of flashes in seconds") do |length|
|
37
|
+
opts.on("-t [secs]", "--length [secs]", Float, "Length of flashes in seconds") do |length|
|
32
38
|
options.delay = length
|
33
39
|
end
|
34
|
-
opts.on("-n [
|
40
|
+
opts.on("-n [num]", "--repeat [num]", Integer, "Repeat [num] times") do |num|
|
35
41
|
options.repeat = num
|
36
42
|
end
|
37
|
-
opts.on("-a [app_name]","--app [app_name]", "The name of the registered app") do |app|
|
38
|
-
options.app_name = app
|
39
|
-
end
|
40
|
-
opts.on("-b [addr]","--bridge [addr]", "The address of the Hue bridge") do |api|
|
41
|
-
options.api_url = api
|
42
|
-
end
|
43
43
|
end.parse!
|
44
44
|
|
45
45
|
# get everything ready...
|
data/lib/philips_hue/bridge.rb
CHANGED
data/lib/philips_hue/version.rb
CHANGED
data/philips_hue.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path('../lib/philips_hue/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'philips_hue'
|
5
|
+
s.version = PhilipsHue::VERSION
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.date = Time.now.utc.strftime("%Y-%m-%d")
|
8
|
+
s.summary = 'Philips Hue'
|
9
|
+
s.description = 'A library to control and query Philips Hue lights'
|
10
|
+
s.authors = ['Dana Merrick']
|
11
|
+
s.email = 'dana.merrick@gmail.com'
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.homepage = 'https://github.com/dmerrick/lights_app'
|
14
|
+
s.extra_rdoc_files = ['README.md']
|
15
|
+
s.add_runtime_dependency 'httparty', ['>= 0.10.0']
|
16
|
+
s.add_runtime_dependency 'json', ['>= 1.6']
|
17
|
+
s.add_development_dependency 'awesome_print'
|
18
|
+
s.add_development_dependency 'pry'
|
19
|
+
#s.post_install_message = ''
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: philips_hue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -43,6 +43,38 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '1.6'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: awesome_print
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pry
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
46
78
|
description: A library to control and query Philips Hue lights
|
47
79
|
email: dana.merrick@gmail.com
|
48
80
|
executables: []
|
@@ -50,18 +82,22 @@ extensions: []
|
|
50
82
|
extra_rdoc_files:
|
51
83
|
- README.md
|
52
84
|
files:
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
85
|
+
- .gitignore
|
86
|
+
- .rvmrc
|
87
|
+
- Gemfile
|
88
|
+
- Gemfile.lock
|
89
|
+
- README.md
|
57
90
|
- bin/all_off.rb
|
58
91
|
- bin/all_on.rb
|
59
92
|
- bin/flash.rb
|
60
93
|
- bin/light_show.rb
|
61
94
|
- bin/register.rb
|
62
95
|
- bin/sandbox.rb
|
63
|
-
-
|
64
|
-
-
|
96
|
+
- lib/philips_hue.rb
|
97
|
+
- lib/philips_hue/bridge.rb
|
98
|
+
- lib/philips_hue/light.rb
|
99
|
+
- lib/philips_hue/version.rb
|
100
|
+
- philips_hue.gemspec
|
65
101
|
homepage: https://github.com/dmerrick/lights_app
|
66
102
|
licenses: []
|
67
103
|
post_install_message:
|