armzilla / amazon-echo-ha-bridge

emulates philips hue api to other home automation gateways
Apache License 2.0
721 stars 168 forks source link

Add support for Phillips Hue colors #71

Open eschizoid opened 8 years ago

eschizoid commented 8 years ago

@armzilla The current implementation only allows switching on/off and dimming the Hue Bulbs. One of the main features of the Hue Bulbs are their colors, it would be ideal if you can add this support through the amazon-echo-ha-bridge.

Perhaps something like the following:

{
  "name": "green light entry",
  "deviceType": "switch",
  "offUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31",
  "onUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}&newColorTarget=${color}"
}

And query string ${color} can take any value between 0-360

eschizoid commented 8 years ago

Hey @armzilla does this sounds like something feasible to do?

arch1v1st commented 8 years ago

To my knowledge the 'connect home' devices can only turn on/off/dim at the moment, so I don't believe this is doable directly. Depending on your home automation you might be able to create a virtual switch and/or rule to accomplish it, but then the voice commands are not intuitive - (i.e. 'Alexa, turn on blue in the office')

To work around this I have started a new project which has been implemented with the Amazon Skills Kit. It uses custom intents and can be extended to do almost anything imaginable. For more information, see https://github.com/unityfire/alexa-ha

eschizoid commented 8 years ago

@arch1v1st Yea I remember looking into your project couple of days ago. However, I don't have a public ip.

Note that due to the Amazon Echo/Alexa architecture it is NOT possible to keep everything on your local network - the voice processing must be conducted in the cloud, and you are currently required to setup port forwarding on your firewall to allow AWS access to an internally hosted application. The AWS ASK service then issues commands to your HA controller through your public facing endpoint.

You think there will be a workaround to run everything locally?

arch1v1st commented 8 years ago

Hey @eschizoid - work is underway to publish Alexa-HA as an 'official Skill' for OpenHAB. If you are already using OpenHAB, a solution is coming which does not require a public IP address, that can control anything in your home... Otherwise a considerable amount of development is needed to make this work with other Home Automation controllers/products.

eschizoid commented 8 years ago

@arch1v1st Fantastic I'm already running openHAB on my raspberry. Let me know if you need help testing something.

arch1v1st commented 8 years ago

Great! :) Once we get to the testing stage for the official Skill I will certain keep you in mind. If you'd like to follow the latest happenings beyond the Alexa-HA GitHub repo, we have an active discussion thread going here: https://community.openhab.org/t/amazon-echo-skill-for-openhab-available/8113/

Regarding your point that you do not have a public IP address, do you have a dynamic IP? Or does your ISP only provide a private IP? The reason I ask is if you do have a dynamic IP you could likely use a Dynamic DNS provider to get a static domain to use... http://www.makeuseof.com/tag/5-best-dynamic-dns-providers-can-lookup-free-today/

In the mean time, as mentioned Amazon Echo HA Bridge can do it, but it may require creating a virtual switch item which triggers an OpenHAB rule to change the color...

eschizoid commented 8 years ago

@arch1v1st Only a private IP :grimacing:, but thanks for the information though.

Last year I logged this ticket: https://github.com/openhab/openhab/issues/3365

And finally somebody is taking this huge task, thank you so much :blush:.

arch1v1st commented 8 years ago

Cheers :-) After seeing the power of the Echo's far field voice recognition, I initially set out to build a Skill for my own use... Once realizing how re-usable this is for many different types of applications I'm stoked to share the Alexa-HA code with the open source community, build an official Skill, and make this quickly and easily accessible for all.