sarkonovich / Alexa-Hue

Control Hue Lights with Alexa
131 stars 28 forks source link

Latest Bridge Upgrade Breaks Alexa-Hue #10

Closed sarkonovich closed 8 years ago

sarkonovich commented 8 years ago

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!
eschizoid commented 8 years ago

@sarkonovich I can send a PR for https://github.com/jpeffer/docker-alexa-hue that executes a curl command in order to get the new user and replace it in hue_switch.rb. How does it sound to you?

sarkonovich commented 8 years ago

Mariano,

That sounds good. Just to be clear (don't know that much about curl), I assume the request will return the new user, but it won't write that value in the hue_switch.rb file, right?

The thing is, I'm going to have to rewrite the authentication part of hue_switch.rb soon anyway to fix this. But using curl to generate/return a new user is much easier than the workaround up there now.

Maybe it would make sense to just include the curl request as the workaround for now? What do you think?

Steve

On Mon, May 2, 2016 at 2:15 PM, Mariano Gonzalez notifications@github.com wrote:

@sarkonovich https://github.com/sarkonovich I can send a PR for https://github.com/jpeffer/docker-alexa-hue that executes a curl command in order to get the new user and replace it in hue_switch.rb. How does it sound to you?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/sarkonovich/Alexa-Hue/issues/10#issuecomment-216366674

sarkonovich commented 8 years ago

Updated routine for creating new users.

eschizoid commented 8 years ago

Not sure if this is helpful or not, but I'm getting the following error when trying to get a new user:

screen shot 2016-05-03 at 9 12 48 am

sarkonovich commented 8 years ago

@eschizoid Thanks. I've just fixed the issue, so there is no need for this work around. (The issue you're showing is that you need to press the link button on the bridge before sending the POST command.)

I've just updated the Docker image to the newest version of Alexa-Hue.

Note that the Docker image is now pulled from sarkonovich/docker-alexa-hue. Pull down the new image and everything should work.

eschizoid commented 8 years ago

@sarkonovich Great news!

eschizoid commented 8 years ago

@sarkonovich I'm building a docker image for ARM architectures (basically for Pi's) and I'm reusing all the work done by wernight/ngrok and jpeffer/docker-alexa-hue. I should be done testing it today or tomorrow. Perhaps a pull request updating the README.md file in case people wants to use this whith their Pi's what you think?

Here are the repos I've created so far:

https://hub.docker.com/r/eschizoid/docker-ngrok-armhf https://hub.docker.com/r/eschizoid/docker-alexa-hue-armhf

Unfortunately I don't have a way to prove the image works because the automated build feature on the official Docker Hub only runs the normal x86_64 architectures.

sarkonovich commented 8 years ago

I'd be happy to update the Readme if you get this working! I looked into this very briefly, but it seemed easier just to install Ruby. But the more ways to do this the better!

Have you looked into hypriot for automated docker builds in ARM?

http://blog.hypriot.com/

Also, note: until jpeffer puts updates his build, his image won't work. You'll need to get the most recent image from sarkonovich/docker-alexa-hue

Steve

On Tue, May 3, 2016 at 7:49 AM, Mariano Gonzalez notifications@github.com wrote:

@sarkonovich https://github.com/sarkonovich I'm building a docker image for ARM architectures (basically for Pi's) and I'm reusing all the work done by wernight/ngrok and jpeffer/docker-alexa-hue. I should be done testing it today or tomorrow. Perhaps a pull request updating the README.md file in case people wants to use this whith their Pi's what you think?

Here are the repos I've created so far:

https://hub.docker.com/r/eschizoid/docker-ngrok-armhf https://hub.docker.com/r/eschizoid/docker-alexa-hue-armhf/

Unfortunately I don't have a way to prove the image works because the automated build feature on the official Docker Hub only runs the normal x86_64 architectures.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/sarkonovich/Alexa-Hue/issues/10#issuecomment-216552870

eschizoid commented 8 years ago

Have you looked into hypriot for automated docker builds in ARM? http://blog.hypriot.com/

Yes, unfortunately I gave up because their distro is kinda unstable. For instance, the wifi module for the Raspbery Pi 3 does not work with that distro.

Also, note: until jpeffer puts updates his build, his image won't work. You'll need to get the most recent image from sarkonovich/docker-alexa-hue

Completely aware of it 😉 I'm no relying on his image at all you can see this here:

https://github.com/eschizoid/docker-rvm/blob/master/Dockerfile https://github.com/eschizoid/docker-alexa-hue/blob/master/Dockerfile https://github.com/eschizoid/docker-ngrok/blob/master/Dockerfile

eschizoid commented 8 years ago

@sarkonovich Images for Raspberry-pi working properly!