Giter VIP home page Giter VIP logo

alexa-hue's People

Contributors

bryant1410 avatar eschizoid avatar sarkonovich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alexa-hue's Issues

Smart Home

Hi, seems im having a few issues. Everything is setup and im at the final step of actually using the skill. My setup is, Hue Bridge, Smarthings hub and an echo. So the skill is enabled and I can see it in alexa, but when I ask 'alexa to tell "invication"..' to do whatever. It complains about no smart devices. I dont see anything suggesting I need to discover anything in the tut so I am assuming im doing something wrong?

error: Unknown slot type 'LIGHTS' for slot 'Lights'

"Now, for the custom slot values "LIGHTS" and "SCENES" substitute in the appropriate values for your lights and scenes."

How do we alter custom_slots? Do we remove LIGHTS and replace it with something else, or do we remove entries under LIGHTS that aren't applicable (fireplace lights, etc)?

Thanks!

Receiving 404 response from Sinatra

I followed the instructions and am getting some errors. The Ruby window (I'm using the Ruby for windows installer) is showing the requests coming in, but it seems to be returning 404 responses. Then on the AWS lambda side, I'm seeing SyntaxError: Unexpected token <. Which I assume is due to the 404 being returned instead of the correct response. I've skipped the ngrok for now to eliminate variables and simply exposed the port for the Sinatra in Ruby to be public using port forwarding on my router. I also have a static public IP, so no dynamic IP issues to worry about. I have tested and can access sinatra from outside of my network (tested using a VPN from another machine). When I navigate directly to the site using the url and the port (either inside or outside the network), I'm getting the sinatra 404 page as well. Which I originally assumed was because I wasn't posting with the JSON object, but I'm not sure if that's an issue as well.
Any help would be greatly appreciated. I'm happy to provide any additional information needed.

Error from Sinatra:
c:\Ruby22\AlexaHue>ruby app.rb
[2016-03-27 12:52:55] INFO WEBrick 1.3.1
[2016-03-27 12:52:55] INFO ruby 2.2.4 (2015-12-16) [i386-mingw32]
== Sinatra (v1.4.7) has taken the stage on 4567 for development with backup from
WEBrick
[2016-03-27 12:52:55] INFO WEBrick::HTTPServer#start: pid=10992 port=4567
ec2-52-205-255-162.compute-1.amazonaws.com - - [27/Mar/2016:12:53:11 Eastern Day
light Time] "POST / HTTP/1.1" 404 515

  • -> /

Error from AWS Lambda:

START RequestId: 9a58fa47-f433-11e5-93a7-7bd2784fb5e8 Version: $LATEST
2016-03-27T15:50:18.014Z 9a58fa47-f433-11e5-93a7-7bd2784fb5e8 SyntaxError: Unexpected token < at Object.parse (native) at IncomingMessage. (/var/task/index.js:40:38) at IncomingMessage.emit (events.js:117:20) at _stream_readable.js:944:16 at process._tickCallback (node.js:448:13)
END RequestId: 9a58fa47-f433-11e5-93a7-7bd2784fb5e8
REPORT RequestId: 9a58fa47-f433-11e5-93a7-7bd2784fb5e8 Duration: 456.97 ms Billed Duration: 500 ms Memory Size: 128 MB Max Memory Used: 9 MB
Process exited before completing request

500 Internal Server Error

I'm setting up the skill on AWS and when I try to test it I see that a request is hitting my running server (I'm running the docker container on OS X). However, the server is failing to respond with a valid response. Instead I get back to a "500 Internal Server Error" and see the following on the console

2016-12-03 16:23:11 - Errno::ECONNRESET - Connection reset by peer:
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/protocol.rb:153:in `read_nonblock'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/protocol.rb:122:in `read_all'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http/response.rb:298:in `block in read_body_0'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http/response.rb:275:in `inflater'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http/response.rb:280:in `read_body_0'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http/response.rb:201:in `read_body'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http/response.rb:226:in `body'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http/response.rb:163:in `reading_body'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http.rb:1422:in `transport_request'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http.rb:1384:in `request'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http.rb:1377:in `block in request'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http.rb:853:in `start'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/net/http.rb:1375:in `request'
	/usr/local/rvm/gems/ruby-2.2.4/gems/httparty-0.13.7/lib/httparty/request.rb:117:in `perform'
	/usr/local/rvm/gems/ruby-2.2.4/gems/httparty-0.13.7/lib/httparty.rb:545:in `perform_request'
	/usr/local/rvm/gems/ruby-2.2.4/gems/httparty-0.13.7/lib/httparty.rb:476:in `get'
	/usr/local/rvm/gems/ruby-2.2.4/gems/httparty-0.13.7/lib/httparty.rb:583:in `get'
	/usr/local/www/Alexa-Hue/hue_switch.rb:247:in `authorize_user'
	/usr/local/www/Alexa-Hue/hue_switch.rb:49:in `initialize'
	/usr/local/www/Alexa-Hue/lights.rb:20:in `new'
	/usr/local/www/Alexa-Hue/lights.rb:20:in `block in registered'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `block in compile!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `[]'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in `route_eval'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in `block in process_route'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `process_route'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `each'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in `block in dispatch!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in `dispatch!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'
	/usr/local/rvm/gems/ruby-2.2.4/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call'
	/usr/local/rvm/gems/ruby-2.2.4/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
	/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
172.17.0.3 - - [03/Dec/2016:16:23:11 EST] "POST /lights HTTP/1.1" 500 30
- -> /lights

I do have the skill enabled on my Alexa app, but I am not sure if it is correctly linked with my Hue hub. I hit the button on my hub and enabled the skill (within 30 seconds). I'm not quite sure what the issue might be.

The test utterance I'm sending from the AWS Skill test page is "turn on main light" (also tried "Aeneas turn on main light" and "ask Aeneas to turn on the main light" and "alexa ask aeneas to turn on main light". In my Hue hub I have a light called "Main" and in the AWS Skill custom slot type, for LIGHTS I have a light "main light".

Timer/Scheduler problem

I think I figured out why my timer's don't seem to work correctly...

It looks like you convert relative timers ("in 15 seconds") into absolute times by adding the "adder" to the current time. but that current time is the PCs localtime... and if there is any discrepancy between the server's localtime and the Hue Bridge's system time, then the timer won't go off at the "right time".

Just to drive the point home, say my box is running one minute ahead of the bridge... then when I say "do X in 20 seconds" (and the ruby server has local time 12:00:00), the schedule will be set for the time 12:00:20. But if the Hue Bridge's time is 1 minute behind (at 11:59:00) at the time it receives the request, then the timer won't be triggered for a full minute after one would expect it to trigger... Worse yet, I'm pretty sure if the local machine's system clock is running BEHIND the hue bridge, then the timers may end up scheduled in "the past" as far as the bridge is concerned... leading to more unstable behavior. (perceived as buggy by users)

As I doubt the Hue bridge actually allows relative schedules to be set, maybe there is a way to pull the time from the bridge, and use that time as the base instead of the local box's system clock... (Good chance the Hue bridge is just using whatever time the wifi router tells it (I haven't looked, but seems like a good guess))

If that fails, then perhaps there's a way to derive the delta between the local machine's system time and the hue bridge's time (some kind of training? maybe the user can be involved if it comes to it), and just store that off and correct for that whenever timers are set... (not ideal...)

I'll keep playing with it, but I figured I'd at least bring it up.. seeing as it takes much less time to find issues and even isolate them... than it does to fix them! (and I'm always short on time...)

Support for multiple hubs??

OK, so I don't write code every day anymore, but did for decades so I am up for doing some work if needed :-)

I am wondering if this code as it is now is capable of working with multiple hue bridges. I have 3 bridges in my home and would LOVE to get this skill working with all of them.

So far I have managed to get my server running and am able to request the list of lights, groups, scenes, etc. It was a major victory just to get this far with the server setups, etc. I subscribed to NGROK so that I have a dedicated address now. THANK YOU for doing all this work. I wish I could contact Steven directly but haven't figured out yet how to do that!

Regardless, thank you for doing so much work, making it public, etc. Would love to donate to the cause.

-mike

Error starting server?

Hello, I'm so excited to get this working, but I'm having an issue starting the server - I installed the Ruby 2.2.0 via rpm on my rpi, did the bundle install, and then did ruby app.rb, but I receive the following:

/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- sinatra/base (LoadError) from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from app.rb:1:in `

'

I'm installing Sinatra now incase that is the issue, but if not, any other ideas? Thanks!

Thank you!

Testing the server.

I have followed the Raspberry Pi3 without docker instructions.

I have started the app in the background ruby ./app.rb &

When ever I try and test on my ocal connection in the browser I get connection refused.
192.168.1.201:4567/lights

I did not install docker nor ngrok, I have a static IP and can port forward from my router.

I also have a LAMP server running on this same install and that accesses fine. I have never used ruby so not sure where to go from here.
Thanks

Better skill instructions

Can you post a more descriptive instructions on setting up the skill? Having issues on what exactly to enter on slot type

Running bash script on reboot

Hello !
Thank you for this amazing script ! I got everything running nicely on a Raspberry Pi 2 with docker. I know it's going to be a stupid question but is it possible to run the script automatically when the Pi reboot ?

Thank you again !

Skills error

Intent Schema:

The intent schema is missing the following built-in intents: {"intent":"AMAZON.PauseIntent"}, {"intent":"AMAZON.ResumeIntent"}

Sample Utterances:

Error: There was a problem with your request: Unknown slot type 'LIGHTS' for slot 'Lights'

Add docker as server-side installation option

While my Docker experience equates to the sum total of a few hours, I threw together a dockerfile for getting the server-side component up and running. It can be found here https://hub.docker.com/r/jpeffer/docker-alexa-hue.

Docker toolset, along with Kitematic, can get things up and running quite easily. If using Kitematic, set the externally mapped port under the container's settings, otherwise a random port will be used every time the container restarts.

setting light timers gives an error

I recently ran though this and got it working except for the timer or alarm functions. She says "youve set the schedule to a time in the past" every time. Im looking though the code and I can't find a reason for it.

I am using this version of the repo, I have installed the jpeffer docker container on a windows box.
All times are in sync between amazon, Alexa, computer, and vm

Light group names

Hey Steve,

I'm Raul btw... we've been going back and forth a bit on Reddit.

So one of the things that I like is to make the echo commands as short and natural as possible. (if I can shave a syllable off of a command, I'm happy)

With that, I want to be able to use this skill to say a command like "tell phillip to turn the lights blue"/

The problem is that the skill as is, expects to hear a group name before the "lights" keyword, and the command fails with the "I couldn't find a group with the name" ... response.

I think there should be an option to designate a DEFAULT light group name, that you fall back to if (and only if) the user does not specify any group name. This would let people speak more naturally to the echo...

The remote endpoint could not be called, or the response it returned was invalid.

Hiya
So close to getting this to work......
If I ask to turn off front room lights then no problem (using the aws test function)
If I try to invoke a scene then I get the above error (same with light colours) - I downloaded all4hue and created the scene test that uses front room lights. I have also added test to the custom slot SCENE.
help me obi wan you're my only hope......

almost got it running ...

Hi @sarkonovich,
Thanks for this. I think it provides much needed functionality to the Echo and Hue compatibility.

Your instructions are great, I was able to follow them and get everything almost up and running.
I am getting hung up on the last part.
The basics: lambda, skills, and ngrok are working, app runs but produces errors.
I set up the basic authorization, as well as the application id check.
I can see the request from Echo being received on the ngrok logs.
As far as I can tell, Echo is passing the correct info through the lambada and to app.rb (example log below).
However, it is erroring when trying to execute the request.

Some Info:
The custom slots of type LIGHTS contains bedroom lights and various specific lights, eg. overhead desk light.

I can use the debug feature of the hue to directly control the hub from the server via web-browser.
Example: running GET /api/<user_id>/lights on http://<bridge ip address>/debug/clip.html
produces

{ "1": { "state": <stuff here> , "type": "Extended color light", "name": "Overhead Desk",  <more stuff>}, 
  "2": { "state": <stuff here> , "type": "Extended color light", "name": "Overhead Door", <more stuff> }, 
  "3": { "state": <stuff here> , "type": "Extended color light", "name": "Overhead Other",  <more stuff>}
}

and GET /api/<user_id>groups/

{ "1": { "name": "bedroom lights", 
          "lights": [ "1", "2", "3" ], 
          "type": "LightGroup", 
          "action": <stuff here> 
         }
}

However, when it comes down to the app.rb I get some weird errors.
When I run the skill for the first time, I don't get any feedback, e.g., no remainder to pair. This is independent of whether I push the link button on the bridge or not (I've tried multiple times).

Here is an example of the types of errors:
The request: Alexa tell house lights to turn the bedroom lights blue

$ ruby app.rb 
[2016-01-28 22:15:19] INFO  WEBrick 1.3.1
[2016-01-28 22:15:19] INFO  ruby 2.3.0 (2015-12-25) [x86_64-darwin10.0]
== Sinatra (v1.4.7) has taken the stage on 4567 for development with backup from WEBrick
[2016-01-28 22:15:19] INFO  WEBrick::HTTPServer#start: pid=288 port=4567
#<struct brightness=nil, start=nil, stop=nil, saturation=nil, color="blue", time=nil, endsession=nil, string=nil, scene=nil, savescene=nil, lights="bedroom lights", state=nil, schedule=nil, flash=nil>
color blue  bedroom lights  
color blue  bedroom lights  
2016-01-28 22:41:56 - NameError - uninitialized constant Sinatra::Lights::Switch:
    /Alexa-Hue/lights.rb:60:in `block in registered'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `block in compile!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in `route_eval'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in `block in process_route'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `process_route'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `each'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in `block in dispatch!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in `dispatch!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/show_exceptions.rb:25:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
    /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
    /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
    /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
127.0.0.1 - - [28/Jan/2016:22:41:56 EST] "POST /lights HTTP/1.1" 500 119401
- -> /lights
127.0.0.1 - - [28/Jan/2016:22:41:58 EST] "POST /lights HTTP/1.1" 200 186
- -> /lights

Another one not involving the groups but a single light
The request: Alexa tell house lights to turn the overhead desk light blue

#<struct brightness=nil, start=nil, stop=nil, saturation=nil, color="blue", time=nil, endsession=nil, string=nil, scene=nil, savescene=nil, lights="overhead desk light", state=nil, schedule=nil, flash=nil>
color blue  overhead desk light  
color blue  overhead desk light  
2016-01-28 23:28:05 - NameError - uninitialized constant Sinatra::Lights::Switch:
    /Alexa-Hue/lights.rb:60:in `block in registered'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `block in compile!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in `route_eval'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in `block in process_route'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `process_route'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `each'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in `block in dispatch!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in `dispatch!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/show_exceptions.rb:25:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'
    /usr/local/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call'
    /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
    /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
    /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
    /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
127.0.0.1 - - [28/Jan/2016:23:28:05 EST] "POST /lights HTTP/1.1" 500 119401
- -> /lights
127.0.0.1 - - [28/Jan/2016:23:28:07 EST] "POST /lights HTTP/1.1" 200 186
- -> /lights
^C== Sinatra has ended his set (crowd applauds)
[2016-01-28 23:37:19] INFO  going to shutdown ...
[2016-01-28 23:37:19] INFO  WEBrick::HTTPServer#start done.

Any ideas as to what could be the problem?

Thanks

Latest Bridge Upgrade Breaks Alexa-Hue

In the latest upgrade to the Hue bridge, the ability for an app to set a username for an authorized user has been deprecated. All usernames now must be generated on the bridge. Alexa-Hue worked by creating a new user ("1234567890"). Since this is no longer allowed, the skill cannot gracefully link to the bridge.

So, for now we need to hardcode in a username that is generated on the bridge.

Here's (unfortunately) what you have to do.

  1. Find the IP address of your Hue bridge.
  2. Open a browser and go the the following address:

/debug/clip.html
(e.g., 192.168.1.107/debug/clip.html)

  1. Create a new authorized user
    3a. Under "URL:" type in /api
    3b. Under "Message Body" paste in: {"devicetype": "alexa_hue#amazon_echo"}
    3c. Push the link button on the bridge, and then within about 20 seconds
    3d. Click "POST"

You'll get a message that says "username:" and then a long string like:

"n4z9jiZsL5mldyrtmt9RjrCX95Bvk7a9i4zjakBi"

Copy that.

  1. Edit the hue_switch.rb file.
    4a. If you've done a "manual" (i.e., non-docker install) this is trivial. Open the file up in a text editor.

On line 29 of the file, you'll see:

@user = "1234567890"

Simply replace the string between the quotes with the long string you copied in step 3. So, the line should now read, e.g:

@user = "n4z9jiZsL5mldyrtmt9RjrCX95Bvk7a9i4zjakBi"

Save the file.

(Note: if you've edited the quotation marks, make sure your editor does not replace quotation marks with "smart quotes.")

4b. If you've done the Docker install, editing the file is a bit trickier.

  • Open up the program "Kitematic" (installed with Docker.)
  • Highlight the container "docker-alexa-hue." (You should see a terminal window in the middle column of Kitematic now.)
  • Just above that terminal window, click on "Exec"
  • In the window that opens, type in: vim hue_switch.rb

VIM is a text editor, but if you've never used it, there's no figuring it out on your own!

  • Use the arrow keys to move the end of line 29, the line with

@user = "1234567890"

(The cursor should be over the closing quotation mark.)

  • Press the "i" key on your keyboard. (You should see "--insert--" appear at the bottom of the terminal.
  • Backspace to delete the number, leaving just the quotation marks.
  • Paste in (ctrl-v) the long string you copied in step 3.
  • Press escape
  • Press colon (you should see a colon appear at the bottom of the terminal.)
  • Type: wq
  • hit return

You can close the terminal. You're done. Alexa-Hue should be good to go!

"There was a problem with the requested skills response"

My tunnel is up and I can see it displayed.
Ive tried hitting the button on the bridge before making a command.
Ive tried controlling the lights and just asking what lights I have.
The alexa app displays, "the target Lambda application returned a failure response"

Any ideas?

Alexa Cannot Find Light

Hi,

I have been trying to get this working for a few days now. Am not sure if this is the right forum so apologies if I am asking in the wrong place.

I have followed instructions but continually end at the same point.

I can ask Alexa to list the lights and she sends a card to the alexa app with all my lights, so I know it can see my lights.

But when I ask her to perform an action she continually replies with the same response
If I ask Alexa to "Alexa ask lighting to turn rose light blue"
The response I get back is;
"Please specify which light you would like to adjust I am ready to control the lights"
Unfortunately re-specifying a light makes no difference she just repeats the above.

In debugging it I have bypassed ngrok and have AWS talking directly to my server
ie
'amzn1.echo-sdk-ams.app.c26243f9-2294-4f16-8b07-ad9ee1b7afe7':'http://cool.no-ip.net:4567/lights'

I have my server running docker (ubuntu 16.04 on Hp Microserver ) port 4567 open to internet

I have had docker pull image sarkonovich/docker-alexa-hue

My Server Started by

"docker run -e "TZ=Australia/Melbourne" -itdP --net=host --name=docker-alexa-hue sarkonovich/docker-alexa-hue"

from docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
25c9cfe1685a sarkonovich/docker-alexa-hue "/bin/sh -c '/bin/bas" 46 minutes ago Up 46 minutes docker-alexa-hue

output from docker-alexa-hue image

root@phobos:~/hue/Alexa-Hue# docker logs 25c9cfe1685a
[2016-07-18 18:18:55] INFO WEBrick 1.3.1
[2016-07-18 18:18:55] INFO ruby 2.2.4 (2015-12-16) [x86_64-linux]
== Sinatra (v1.4.7) has taken the stage on 4567 for production with backup from WEBrick
[2016-07-18 18:18:55] INFO WEBrick::HTTPServer#start: pid=1 port=4567
ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:30:11 AEST] "POST /lights HTTP/1.1" 200 361

  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:31:02 AEST] "POST /lights HTTP/1.1" 200 352
  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:33:33 AEST] "POST /lights HTTP/1.1" 200 276
  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:33:45 AEST] "POST /lights HTTP/1.1" 200 276
  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:33:55 AEST] "POST /lights HTTP/1.1" 200 276
  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:34:08 AEST] "POST /lights HTTP/1.1" 200 276
  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:34:17 AEST] "POST /lights HTTP/1.1" 200 276
  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:34:29 AEST] "POST /lights HTTP/1.1" 200 200
  • -> /lights
    ec2-54-87-208-204.compute-1.amazonaws.com - - [18/Jul/2016:18:35:11 AEST] "POST /lights HTTP/1.1" 200 276
  • -> /lights

Any help or pointers would be greatful

Thanks
Brian T.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.