Alexa-Hue Bridge Plugin (old locked topic)

Posted on
Mon Jan 04, 2016 11:17 am
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Alexa-Hue Bridge Plugin (old locked topic)

This plugin will emulate a Philips Hue bridge for the purpose of publishing up to 27 devices to any Amazon Alexa device (Echo, FireTV, etc.). The 27 device limit appears to be a limitation in Amazon's Alexa implementation so there's nothing that we can do about it. If you reach that limit, consider using a Device Group in the Virtual Devices interface to group devices that you generally control together into a single device and publish that. This is a good way to create “scenes” that you can turn on/off rather than control each device individually.

This plugin is not intended to be an officially supported Alexa integration, but rather as a short-term solution until we can evaluate how best to officially support Alexa devices. See our blog post on the subject and the Terms section on the main repository page for more information. The important point here is that it's based on reverse-engineered protocol information between an Amazon Echo and a Hue hub - which means that either could change how it works and the plugin may immediately stop working. We may or may not have the time to spend trying to figure out a fix/workaround if that happens - you have been warned.

You can get the latest version from the releases section on the GitHub repository, and you can find directions for use on the main repository page.

A special thanks to forum user growlf for his hueAndMe script, which was the basis and inspiration for this plugin. Without that, it definitely wouldn't have happened.

Troubleshooting

The main problem that people are experiencing is with UPNP port conflicts. Only one app/plugin at a time can have that port (1900) bound and there are others that do it. The Sonos plugin does, along with a variety of other Mac apps. Use the following command in a terminal window to see what apps have it open - you'll need to quit them during discovery only:

Code: Select all
lsof -i :1900


Another potential problem can occur when you have an actual Hue Hub on your network, the discovery process won't work correctly while it's connected. The workaround seems to be to disconnect the network cable from the Hue Hub and then perform the discovery. You can plug the network cable back in after the discovery process is complete.

If you've ever had Mac OS X Server installed, or have somehow changed your hostname, then you may experience an error when the plugin starts up. The error you may see is this:

Code: Select all
Alexa-Hue Bridge Error Computer has no host name specified. Check the Sharing system preference and restart the plugin once the name is resolved.


This means that the plugin can't get the computer's host name, which is required for it to work. Most of the time this means you have or had Mac OS X server installed at one point. One user identified a workaround that seemed to work for him.

Another thing is to make sure your Echo device is on the same network as your Indigo server - UPnP only works on the same subnet.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jan 04, 2016 6:22 pm
tjm000 offline
Posts: 60
Joined: Aug 03, 2008
Location: Gambrills, MD

Re: Alexa-Hue Bridge Plugin

So I published one device (for an Insteon light) within the plug-in and then tried to go through the discovery process. But Echo kept saying that it could not find any devices. I turned on the debug feature and re-ran the process and captured the following events in the event log window (for two separate tries). What do the "broadcaster/responder thread" debug items mean? Another question: How does one know if they have any other UPNP agents that may be affecting the discovery process? I ended up stopping all of my other applications (other than Indigo) on my Indigo Server MacMini for the second trial below. Is there some sort of tool to use to determine if there are any other active UPNP agents?

Jan 4, 2016, 6:48:53 PM
Alexa-Hue Bridge Debug logging enabled
Alexa-Hue Bridge Thread debug logging disabled
Alexa-Hue Bridge Debug getMenuActionConfigUiValues: published device count is 1
Alexa-Hue Bridge Debug Validating action config for type: startDiscovery
Alexa-Hue Bridge Starting discovery process
Alexa-Hue Bridge Debug Validating action config for type: startDiscovery
Alexa-Hue Bridge Debug startDiscovery props validated
Alexa-Hue Bridge Debug broadcaster thread is not alive
Alexa-Hue Bridge Debug responder thread is not alive

Jan 4, 2016, 6:50:39 PM
Alexa-Hue Bridge Stopping discovery process

Jan 4, 2016, 6:51:01 PM
Alexa-Hue Bridge Debug logging disabled
Alexa-Hue Bridge Thread debug logging disabled


====================================================================================================


Jan 4, 2016, 7:00:00 PM
Alexa-Hue Bridge Debug logging enabled
Alexa-Hue Bridge Thread debug logging disabled
Alexa-Hue Bridge Debug getMenuActionConfigUiValues: published device count is 1
Alexa-Hue Bridge Debug memberDevices called with filter: typeId: manageDevices targetId: 0
Alexa-Hue Bridge Debug getMenuActionConfigUiValues: published device count is 1
Alexa-Hue Bridge Debug Validating action config for type: startDiscovery
Alexa-Hue Bridge Starting discovery process
Alexa-Hue Bridge Debug Validating action config for type: startDiscovery
Alexa-Hue Bridge Debug startDiscovery props validated
Alexa-Hue Bridge Debug broadcaster thread is not alive
Alexa-Hue Bridge Debug responder thread is not alive

Jan 4, 2016, 7:01:14 PM
Alexa-Hue Bridge Stopping discovery process

Tim

Posted on
Mon Jan 04, 2016 6:40 pm
polycron offline
Posts: 100
Joined: Jan 08, 2006

Re: Alexa-Hue Bridge Plugin

I'm having the same issue. 14 devices are seen by the plugin but get the same debug messages and no discovery on Alexa. Could it be because I'm using a non-standard port for my web server?

Jeff

Posted on
Mon Jan 04, 2016 6:53 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alexa-Hue Bridge Plugin

Turn on thread debugging in the plugin's config - that will show a lot more information.

If it's a UPNP port conflict, I believe a specific error will show up in the log, but I could have messed that up somehow.

The web server used for actual communication is starting up on port 8177 so if you have something else running on that port I'd expect to see an exception at startup.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jan 04, 2016 7:40 pm
polycron offline
Posts: 100
Joined: Jan 08, 2006

Re: Alexa-Hue Bridge Plugin

I didn't see any issues in the log file with thread debugging on. While trying to determine the IP of the Echo I power cycled it a few times to see which IP was missing on my router. After I figured out the IP address I decided to try it again (10th time is a charm). It worked and the detailed logs showed a ton of info. I'm not sure if it was because I restarted the echo or what the deal was. If you are having issues, it might be something to try. Or it could have just been a coincidence.

Jeff

Posted on
Mon Jan 04, 2016 8:10 pm
Japple55 offline
Posts: 224
Joined: Sep 26, 2015
Location: NE Tennessee

Re: Alexa-Hue Bridge Plugin

Installed the plugin and had it discover one zwave appliance module. Alexa had a little trouble with recognizing "appliance module" so I changed it to "switch" and re-discovered. Works flawlessly! I hope the rest of the devices go so smooth.

Thank you so much, Jay, for making this into a simple to install plugin, and of course thanks to Growlf for creating Hue&Me.
Jim

Posted on
Mon Jan 04, 2016 8:20 pm
nathanw offline
Posts: 152
Joined: Sep 05, 2011
Location: Boston, MA

Re: Alexa-Hue Bridge Plugin

Installed it and it's working well for the eight lights I told it about.

Thanks a lot for this! It's much easier - and more self-contained - than getting HueAndMe running separately.

Posted on
Mon Jan 04, 2016 9:05 pm
tjm000 offline
Posts: 60
Joined: Aug 03, 2008
Location: Gambrills, MD

Re: Alexa-Hue Bridge Plugin

Well, still no luck for me. I cycled power on the Echo a couple of times. Also, I added a second device to the list after the first power cycle to see if that made any difference. But still no luck for me. Here's the debug log with all of the debug options, including threads, turned on after the first power cycle (with only the single device). Arggghhh!

Code: Select all
Jan 4, 2016, 9:49:39 PM
  Enabling plugin "Alexa-Hue Bridge 1.0.0"
  Starting plugin "Alexa-Hue Bridge 1.0.0" (pid 5807)
  Alexa-Hue Bridge                1 devices published
  Started plugin "Alexa-Hue Bridge 1.0.0"
  Alexa-Hue Bridge                Starting hue bridge web server
  Alexa-Hue Bridge                Debug logging enabled
  Alexa-Hue Bridge                Thread debug logging enabled
  Alexa-Hue Bridge Debug          getMenuActionConfigUiValues: published device count is 1
  Alexa-Hue Bridge Debug          memberDevices called with filter:   typeId: manageDevices  targetId: 0
  Alexa-Hue Bridge Debug          deleteDevices called
  Alexa-Hue Bridge Debug          memberDevices called with filter:   typeId: manageDevices  targetId: 0

Jan 4, 2016, 9:50:29 PM
  Alexa-Hue Bridge Debug          selectDeviceToAdd called
  Alexa-Hue Bridge Debug          memberDevices called with filter:   typeId: manageDevices  targetId: 0
  Alexa-Hue Bridge Debug          addDevice called
  Alexa-Hue Bridge Debug          adding device: 1571360660
  Alexa-Hue Bridge Debug          addDevice: valuesDict['altName']: |Table Light|
  Alexa-Hue Bridge Debug          valuesDict = UiValuesDict : (dict)
     addDevice :  (string)
     altName : Table Light (string)
     altNameLabel :  (string)
     deleteDevices :  (string)
     enableAltNameField : true (bool)
     memberDeviceList : (list)
          Item : 843171281 (string)
     publishedLabel :  (string)
     sep1 :  (string)
     showLimitMessage : false (bool)
     showLimitMessageLabel :  (string)
     sourceDeviceMenu : 1571360660 (string)
  Alexa-Hue Bridge Debug          refreshDeviceList called
  Alexa-Hue Bridge Debug          found published device: 1571360660 - FamRm Table LED
  Alexa-Hue Bridge                1 devices published
  Alexa-Hue Bridge                A device name changed - you'll most likely want to perform the 'Alexa, discover devices' command on all Alexa devices. #100
  Alexa-Hue Bridge Debug          memberDevices called with filter:   typeId: manageDevices  targetId: 0
  Alexa-Hue Bridge Debug          getMenuActionConfigUiValues: published device count is 1
  Alexa-Hue Bridge Debug          Validating action config for type: startDiscovery
  Alexa-Hue Bridge                Starting discovery process
  Alexa-Hue Bridge Debug          Validating action config for type: startDiscovery
  Alexa-Hue Bridge Debug          startDiscovery props validated
  Alexa-Hue Bridge Debug          broadcaster thread is not alive
  Alexa-Hue Bridge Thread Debug   Broadcaster.__init__ is running
  Alexa-Hue Bridge Debug          responder thread is not alive
  Alexa-Hue Bridge Thread Debug   Broadcaster.run called

  Alexa-Hue Bridge                Stopping discovery process
  Alexa-Hue Bridge Thread Debug   Broadcaster thread stopped
  Alexa-Hue Bridge Thread Debug   Responder thread stopped

Tim

Posted on
Mon Jan 04, 2016 9:46 pm
JustJack offline
Posts: 53
Joined: Feb 16, 2013
Location: Ca

Re: Alexa-Hue Bridge Plugin

I installed the plugin and exported 4 devices. Seems to be working for me.


Sent from my iPhone using Tapatalk

Posted on
Tue Jan 05, 2016 9:55 am
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alexa-Hue Bridge Plugin

tjm000 wrote:
Well, still no luck for me. I cycled power on the Echo a couple of times. Also, I added a second device to the list after the first power cycle to see if that made any difference. But still no luck for me. Here's the debug log with all of the debug options, including threads, turned on after the first power cycle (with only the single device). Arggghhh!


The logs look fine - it looks like the discovery processes were running fine, there were just no requests from the Echo.

How long did you set the timeout for when you started discovery? Your log snippet doesn't show the timestamp when the broadcast/responder threads stopped, so I'm wondering if they stopped before you started the discovery on your Echo. Try starting them with a long timeout (maybe like 5 minutes or so) to give you plenty of time to start discovery on your Echo and allow it to finish what it needs to do.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jan 05, 2016 11:38 am
jeffgtx offline
Posts: 43
Joined: Aug 19, 2007

Re: Alexa-Hue Bridge Plugin

is my interpretation correct that this emulates a HUE hub, but can control more than hue lights? so alexa thinks she is controlling a hue light through a hue bridge, but it could be anything indigo controls with on/off?

Posted on
Tue Jan 05, 2016 1:05 pm
SteveFletcher offline
Posts: 3
Joined: Jan 05, 2016

Re: Alexa-Hue Bridge Plugin

+1 for working great with no issues.

It is ridiculous how happy this makes me.

Awesome job jay.

Posted on
Tue Jan 05, 2016 2:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alexa-Hue Bridge Plugin

jeffgtx wrote:
is my interpretation correct that this emulates a HUE hub, but can control more than hue lights? so alexa thinks she is controlling a hue light through a hue bridge, but it could be anything indigo controls with on/off?


Exactly.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jan 05, 2016 5:08 pm
tjm000 offline
Posts: 60
Joined: Aug 03, 2008
Location: Gambrills, MD

Re: Alexa-Hue Bridge Plugin

jay (support) wrote:
tjm000 wrote:
Well, still no luck for me. I cycled power on the Echo a couple of times. Also, I added a second device to the list after the first power cycle to see if that made any difference. But still no luck for me. Here's the debug log with all of the debug options, including threads, turned on after the first power cycle (with only the single device). Arggghhh!


The logs look fine - it looks like the discovery processes were running fine, there were just no requests from the Echo.

How long did you set the timeout for when you started discovery? Your log snippet doesn't show the timestamp when the broadcast/responder threads stopped, so I'm wondering if they stopped before you started the discovery on your Echo. Try starting them with a long timeout (maybe like 5 minutes or so) to give you plenty of time to start discovery on your Echo and allow it to finish what it needs to do.



I thought that I had set the timeout to 4 minutes, but I'll try again. So, the correct order for performing the discovery process is:

1) Begin the Indigo plug-in startup process with a timeout of 5 minutes, then
2) Ask Alexa to start the discovery process ?

I don't recall if I did things in this order previously; or had let the plug-in discovery startup process get through all of its steps before asking Alexa to start its discovery process.

Tim

Posted on
Tue Jan 05, 2016 5:27 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alexa-Hue Bridge Plugin

tjm000 wrote:
1) Begin the Indigo plug-in startup process with a timeout of 5 minutes, then
2) Ask Alexa to start the discovery process ?

I don't recall if I did things in this order previously; or had let the plug-in discovery startup process get through all of its steps before asking Alexa to start its discovery process.


Correct. Discovery should start up very quickly (a second at most).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Who is online

Users browsing this forum: No registered users and 2 guests