alexa_hue 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/README.md +26 -0
- data/alexa_hue.gemspec +2 -1
- data/lib/alexa_hue.rb +0 -16
- data/lib/alexa_hue/custom_slots.rb +2 -2
- data/lib/alexa_hue/hue/client.rb +7 -4
- data/lib/alexa_hue/hue/voice_parser.rb +1 -0
- data/lib/alexa_hue/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74ccfb20286a662feb0b45d2cdb4b0cc11f02c39
|
4
|
+
data.tar.gz: 7ffb4a66747a207b92d2e35632dee93a935eda26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e11657c198e45afffb7317ded242e175836b03b38af9f77b67d6b8b42574c538a416e1d1a9efa9a4ad9a948b97ea99acf52243d9e06fc4ad66ed29644acc15c9
|
7
|
+
data.tar.gz: cfa9faba82b2f9939a3790e63a800cb11656d83d04d38b34dff177fc16c6969479503fc1cee65d964c987d21b04ef739c044b5cdcafc6308c013fa3212878671
|
data/Gemfile
CHANGED
@@ -4,12 +4,14 @@ gemspec
|
|
4
4
|
|
5
5
|
gem 'chronic', '~> 0.10.0'
|
6
6
|
gem 'chronic_duration', '~> 0'
|
7
|
-
gem '
|
7
|
+
gem 'curb'
|
8
|
+
gem 'oj'
|
8
9
|
gem 'numbers_in_words', '~> 0.2.0'
|
9
10
|
gem 'sinatra'
|
10
11
|
gem 'alexa_objects'
|
11
12
|
gem 'activesupport'
|
12
13
|
gem 'takeout', '~> 1.0.6'
|
14
|
+
gem 'json', '1.8.3'
|
13
15
|
|
14
16
|
group :development do
|
15
17
|
gem "guard", "2.12.5", require: false
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Alexa Hue
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/alexa_hue.svg)](http://badge.fury.io/rb/alexa_hue)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/kylegrantlucas/takeout/badges/gpa.svg)](https://codeclimate.com/github/kylegrantlucas/takeout)
|
4
|
+
|
5
|
+
A SingingAssistant middleware for using Alexa commands with Phillips Hue products 💡
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your SingingAssistant installation's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'alexa_hue'
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
TODO: Write usage instructions here
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kylegrantlucas/alexa_hue. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
26
|
+
|
data/alexa_hue.gemspec
CHANGED
@@ -21,7 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'json'
|
23
23
|
spec.add_runtime_dependency 'alexa_objects'
|
24
|
-
spec.add_runtime_dependency '
|
24
|
+
spec.add_runtime_dependency 'curb'
|
25
|
+
spec.add_runtime_dependency 'oj'
|
25
26
|
spec.add_runtime_dependency 'numbers_in_words'
|
26
27
|
spec.add_runtime_dependency 'activesupport'
|
27
28
|
spec.add_runtime_dependency 'chronic'
|
data/lib/alexa_hue.rb
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'alexa_objects'
|
3
|
-
require 'httparty'
|
4
3
|
require 'numbers_in_words'
|
5
|
-
require 'numbers_in_words/duck_punch'
|
6
|
-
require 'chronic'
|
7
4
|
require 'alexa_hue/version'
|
8
5
|
require 'sinatra/extension'
|
9
6
|
require 'numbers_in_words/duck_punch'
|
10
7
|
require 'alexa_hue/hue/voice_parser'
|
11
8
|
require 'alexa_hue/hue/helpers'
|
12
|
-
require 'chronic_duration'
|
13
9
|
|
14
10
|
module Hue
|
15
11
|
include Hue::Helpers
|
@@ -31,18 +27,6 @@ module Hue
|
|
31
27
|
halt AlexaObjects::Response.new(end_session: false, spoken_response: "Please specify which light or lights you'd like to adjust. I'm ready to control the lights.").to_json
|
32
28
|
end
|
33
29
|
|
34
|
-
# if @echo_request.slots.lights
|
35
|
-
# if @echo_request.slots.lights.include?('lights')
|
36
|
-
# if !(switch.list_groups.keys.join(', ').downcase.include?("#{@echo_request.slots.lights.sub(' lights','')}"))
|
37
|
-
# halt AlexaObjects::Response.new(spoken_response: "I couldn't find a group with the name #{@echo_request.slots.lights}").to_json
|
38
|
-
# end
|
39
|
-
# elsif @echo_request.slots.lights.include?('light')
|
40
|
-
# if !(switch.list_lights.keys.join(', ').downcase.include?("#{@echo_request.slots.lights.sub(' light','')}"))
|
41
|
-
# halt AlexaObjects::Response.new(spoken_response: "I couldn't find a light with the name #{@echo_request.slots.lights}").to_json
|
42
|
-
# end
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
|
46
30
|
return AlexaObjects::Response.new(spoken_response: "okay").to_json
|
47
31
|
end
|
48
32
|
end
|
@@ -3,8 +3,8 @@ module Hue
|
|
3
3
|
def self.custom_slots
|
4
4
|
client = Hue::Client.new
|
5
5
|
slots = "LIGHTS"
|
6
|
-
client.instance_variable_get("@lights").keys.each {|x| slots << "\n#{x}"}
|
7
|
-
client.instance_variable_get("@groups").keys.each {|x| slots << "\n#{x}"}
|
6
|
+
client.instance_variable_get("@lights").keys.each {|x| slots << "\n#{x} light"}
|
7
|
+
client.instance_variable_get("@groups").keys.each {|x| slots << "\n#{x} lights"}
|
8
8
|
slots << "\n\nSCENE"
|
9
9
|
client.instance_variable_get("@scenes").keys.each {|x| slots << "\n#{x}"}
|
10
10
|
slots << "\n"
|
data/lib/alexa_hue/hue/client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'takeout'
|
2
|
-
require '
|
2
|
+
require 'curb'
|
3
|
+
require 'oj'
|
3
4
|
require 'alexa_hue/hue/helpers'
|
4
5
|
require 'alexa_hue/hue/request_body'
|
5
6
|
|
@@ -7,11 +8,11 @@ require 'alexa_hue/hue/request_body'
|
|
7
8
|
module Hue
|
8
9
|
class Client
|
9
10
|
include Hue::Helpers
|
10
|
-
attr_accessor :client, :user, :bridge_ip, :scenes, :groups, :lights, :schedule_ids, :schedule_params, :command, :_group
|
11
|
+
attr_accessor :client, :user, :bridge_ip, :scenes, :groups, :lights, :schedule_ids, :schedule_params, :command, :_group, :body
|
11
12
|
|
12
13
|
def initialize(options={}, &block)
|
13
14
|
# JUST UPNP SUPPORT FOR NOW
|
14
|
-
@bridge_ip =
|
15
|
+
@bridge_ip = Oj.load(Curl.get("https://www.meethue.com/api/nupnp")).first["internalipaddress"] rescue nil
|
15
16
|
@user = "1234567890"
|
16
17
|
@groups, @lights, @scenes = {}, {}, []
|
17
18
|
prefix = "/api/#{@user}"
|
@@ -37,10 +38,12 @@ module Hue
|
|
37
38
|
|
38
39
|
@client = Takeout::Client.new(uri: @bridge_ip, endpoint_prefix: prefix, schemas: schemas, headers: { "Expect" => "100-continue" })
|
39
40
|
|
41
|
+
@lights_array, @schedule_ids, @schedule_params, @command, @_group, @body = [], [], [], "", "0", Hue::RequestBody.new
|
42
|
+
|
40
43
|
authorize_user
|
41
44
|
populate_client
|
42
45
|
|
43
|
-
|
46
|
+
|
44
47
|
|
45
48
|
# TODO: Do blocks right
|
46
49
|
instance_eval(&block) if block_given?
|
data/lib/alexa_hue/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa_hue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Lucas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -39,7 +39,21 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: curb
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: oj
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -216,6 +230,7 @@ files:
|
|
216
230
|
- ".gitignore"
|
217
231
|
- Gemfile
|
218
232
|
- Guardfile
|
233
|
+
- README.md
|
219
234
|
- Rakefile
|
220
235
|
- alexa_hue.gemspec
|
221
236
|
- lib/alexa_hue.rb
|