Alexa-Hue Bridge Plugin (old locked topic)

Discuss the Alexa-Hue Bridge plugin.
jfeger
Posts: 84
Joined: Wed Jan 02, 2013 12:51 am

Re: Alexa-Hue Bridge Plugin

Post by jfeger »

Feedback from my side ... after about twenty minutes of tinkering, I am calling it "good". Thank you Jay, this is a very nice option. The twenty minutes included creating different virtual devices to play with, a few discovery attempts, etc. No issues.
webdeck
Posts: 461
Joined: Sat May 07, 2005 11:27 pm

Re: Alexa-Hue Bridge Plugin

Post by webdeck »

I'm having the same problem where my Echo keeps saying it couldn't find any devices. I started discovery for 5 minutes. I said "Alexa, discover devices" and she said she couldn't find any. Sometimes she says that she isn't able to discover devices at this time after a short delay, but most of the time it's a long delay and then she says she couldn't find any devices.

At first, I thought, maybe Plex is interfering, but I turned it off and it still didn't work. I also tried turning homebridge off.

I'm running Indigo 6.1.4 on a Late 2014 Mac Mini running OS X 10.10.5 and Server 5.0.15.

Here is the log:

Code: Select all

  Alexa-Hue Bridge                Debug logging enabled
  Alexa-Hue Bridge                Thread debug logging enabled
  Alexa-Hue Bridge                Stopping discovery process
  Alexa-Hue Bridge Thread Debug   Broadcaster thread stopped
  Alexa-Hue Bridge Thread Debug   Responder thread stopped
  Alexa-Hue Bridge Debug          getMenuActionConfigUiValues: published device count is 18
  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 Thread Debug   Broadcaster.run called
  Alexa-Hue Bridge Debug          responder thread is not alive

Jan 5, 2016, 10:01:38 PM
  Alexa-Hue Bridge                Debug logging disabled
  Alexa-Hue Bridge                Thread debug logging disabled
  Alexa-Hue Bridge                Stopping discovery process
Even when I get the "unable to discover devices" error, there isn't anything else in the Indigo log.

I would love to get this working, as it would be a big improvement over the slower "Alexa, tell Indigo to turn on..." approach I'm using now that has to route through an Alexa Skill.

Thanks,
-Mike
webdeck
Posts: 461
Joined: Sat May 07, 2005 11:27 pm

Re: Alexa-Hue Bridge Plugin

Post by webdeck »

webdeck wrote:I'm having the same problem where my Echo keeps saying it couldn't find any devices. I started discovery for 5 minutes. I said "Alexa, discover devices" and she said she couldn't find any. Sometimes she says that she isn't able to discover devices at this time after a short delay, but most of the time it's a long delay and then she says she couldn't find any devices.

At first, I thought, maybe Plex is interfering, but I turned it off and it still didn't work. I also tried turning homebridge off.

I'm running Indigo 6.1.4 on a Late 2014 Mac Mini running OS X 10.10.5 and Server 5.0.15.

Here is the log:

Code: Select all

  Alexa-Hue Bridge                Debug logging enabled
  Alexa-Hue Bridge                Thread debug logging enabled
  Alexa-Hue Bridge                Stopping discovery process
  Alexa-Hue Bridge Thread Debug   Broadcaster thread stopped
  Alexa-Hue Bridge Thread Debug   Responder thread stopped
  Alexa-Hue Bridge Debug          getMenuActionConfigUiValues: published device count is 18
  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 Thread Debug   Broadcaster.run called
  Alexa-Hue Bridge Debug          responder thread is not alive

Jan 5, 2016, 10:01:38 PM
  Alexa-Hue Bridge                Debug logging disabled
  Alexa-Hue Bridge                Thread debug logging disabled
  Alexa-Hue Bridge                Stopping discovery process
Even when I get the "unable to discover devices" error, there isn't anything else in the Indigo log.

I would love to get this working, as it would be a big improvement over the slower "Alexa, tell Indigo to turn on..." approach I'm using now that has to route through an Alexa Skill.

Thanks,
-Mike
Okay, I decided to do a little digging. Maybe it's MythTV Backend or Squeezebox Server. I looked for anything using port 1900 (ssdp):

Code: Select all

# lsof -i :1900
COMMAND     PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
perl5.18   1558 server   31u  IPv4 0x7eda578b7125f07b      0t0  UDP localhost:ssdp
perl5.18   1558 server   32u  IPv4 0x7eda578b7125ee23      0t0  UDP home.webdeck.com:ssdp
perl5.18   1558 server   33u  IPv4 0x7eda578b5bd3852b      0t0  UDP *:ssdp
MythBacke 59715 mythtv   66u  IPv4 0x7eda578b7126114b      0t0  UDP 239.255.255.250:ssdp
Do I need to stop all of those services to get the discovery phase to work? Can I resume them after I've completed the discovery?

Thanks,
-Mike
simplyahobby
Posts: 6
Joined: Tue Jan 05, 2016 7:55 am
Contact:

Re: Alexa-Hue Bridge Plugin

Post by simplyahobby »

I've had similar problems getting this to work on my system as well. Alexa fails to discover the devices every time. I'm running Indigo 6 on Yosemite on an aging iMac.

I've tried toggling other plugins, increasing the time for the discovery on the Indigo side, disabling the firewall, and disabling other software on the Mac but so far nothing has made a difference (I've also tried various combinations of these attempts with the firewall turned off for most of them).

For some reason to even get the plugin to work on my system I had to change (in plugin.py) self.host = socket.gethostbyname(socket.gethostname()) to self.host = '' or change 'socket.gethostname()' to a specific host name for my system. I'm not sure if this change is actually creating problems with the discovery process and I'll admit that I'm not very familiar with Python yet.

With this change in place the log, with full debugging enabled, appears to show that the plugin is working properly. I've checked my network devices (router, wifi extender) and none appear to have a configuration that should interfere with UPnP. I've spent a couple of nights trying to figure this issue out but so far no luck.

Any suggestions will be appreciated. The iMac I'm using has served many functions over the years so it's certainly possible that I have something installed that is causing an issue. My next step is to fire up some network analysis tools to see if the plugin discovery traffic is actually getting beyond the iMac. I've tried using an iPhone app for Hue just to see if it would detect the bridge but no luck though I don't know if it's expecting more than what the plugin provides.

It's an awesome capability that I've been looking forward to. Not only will it be convenient but perhaps it will finally provide a method that my wife actually likes to use for interacting with our home automation capabilities. :)
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Alexa-Hue Bridge Plugin

Post by jay (support) »

webdeck wrote:Okay, I decided to do a little digging. Maybe it's MythTV Backend or Squeezebox Server. I looked for anything using port 1900 (ssdp):

Code: Select all

# lsof -i :1900
COMMAND     PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
perl5.18   1558 server   31u  IPv4 0x7eda578b7125f07b      0t0  UDP localhost:ssdp
perl5.18   1558 server   32u  IPv4 0x7eda578b7125ee23      0t0  UDP home.webdeck.com:ssdp
perl5.18   1558 server   33u  IPv4 0x7eda578b5bd3852b      0t0  UDP *:ssdp
MythBacke 59715 mythtv   66u  IPv4 0x7eda578b7126114b      0t0  UDP 239.255.255.250:ssdp
Do I need to stop all of those services to get the discovery phase to work? Can I resume them after I've completed the discovery?
Yes, there can only be one process that successfully binds to port 1900 - which begs the question of how you have two different processes using the same port (are those running on different IP addresses maybe?). But, in any event, any app that's bound to port 1900 will have to be shut down for discovery to work. I'll have another look at the code - I believe it should be showing an error when it tries to bind to port 1900 when there's a conflict.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Alexa-Hue Bridge Plugin

Post by jay (support) »

simplyahobby wrote:I've had similar problems getting this to work on my system as well. Alexa fails to discover the devices every time. I'm running Indigo 6 on Yosemite on an aging iMac.

I've tried toggling other plugins, increasing the time for the discovery on the Indigo side, disabling the firewall, and disabling other software on the Mac but so far nothing has made a difference (I've also tried various combinations of these attempts with the firewall turned off for most of them).

For some reason to even get the plugin to work on my system I had to change (in plugin.py) self.host = socket.gethostbyname(socket.gethostname()) to self.host = '' or change 'socket.gethostname()' to a specific host name for my system. I'm not sure if this change is actually creating problems with the discovery process and I'll admit that I'm not very familiar with Python yet.

With this change in place the log, with full debugging enabled, appears to show that the plugin is working properly. I've checked my network devices (router, wifi extender) and none appear to have a configuration that should interfere with UPnP. I've spent a couple of nights trying to figure this issue out but so far no luck.

Any suggestions will be appreciated. The iMac I'm using has served many functions over the years so it's certainly possible that I have something installed that is causing an issue. My next step is to fire up some network analysis tools to see if the plugin discovery traffic is actually getting beyond the iMac. I've tried using an iPhone app for Hue just to see if it would detect the bridge but no luck though I don't know if it's expecting more than what the plugin provides.

It's an awesome capability that I've been looking forward to. Not only will it be convenient but perhaps it will finally provide a method that my wife actually likes to use for interacting with our home automation capabilities. :)
I think we should start with the error are you getting on the line you changed above - that would be important information I think. Also, what OS version are you running?
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
simplyahobby
Posts: 6
Joined: Tue Jan 05, 2016 7:55 am
Contact:

Re: Alexa-Hue Bridge Plugin

Post by simplyahobby »

Thanks for the quick response. Without the script modification this is the error that I receive:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "plugin.py", line 38, in __init__
<class 'socket.gaierror'>: (8, 'nodename nor servname provided, or not known')

It's running on Yosemite 10.10.5 on a Mid 2011 iMac with 16 GB RAM. Indigo reports that it is the latest available version. The system has a private, static IP address assigned. The local hostname is also defined in the network settings.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Alexa-Hue Bridge Plugin

Post by jay (support) »

Hmmm - sounds like your network config is somewhat non-standard if socket.gethostname() doesn't work. Whatever is causing that failure might very well be related to what's causing the discovery failures as well, but that's just a guess.

Open a terminal window and start up a python interpreter:

Code: Select all

FatMac:~ jay$ python
Python 2.7.10 (default, Oct 23 2015, 18:05:06) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Then type in:

Code: Select all

import socket
socket.gethostname()
and see what's returned. It should return the name of your Mac as it shows in the Sharing System Preference at the top under Computer Name. Mine's 'FatMac.local' for instance.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
simplyahobby
Posts: 6
Joined: Tue Jan 05, 2016 7:55 am
Contact:

Re: Alexa-Hue Bridge Plugin

Post by simplyahobby »

Thanks. I ran the commands and the machine name came back with ".private" instead of ".local" appended. The first part matched the name that I expected.

This may have something to do with having OS X Server installed, which I use primarily for its VPN server.

I was able to resolve the discovery issue. I found that the video surveillance software that I use had several instances accessing port 1900 (Sighthound Video). I had considered that this might be an issue yesterday but what I learned today is that even when the cameras are disabled in the software, and it isn't pulling video feeds, that it still holds the port open. I had to stop accessing the feeds and also exit the software. After doing that the only thing using 1900 was the discovery process for the plugin. The next time that I tried discovery it worked; the first time it has worked since I started this process.

Small tip for anyone working on this remotely during their lunch break: The Alexa app, at least in iOS, doesn't appear to connect to a registered Alexa device over VPN unless the iOS device is connected to a wifi network (it seems to require a wifi connection even though the Alexa is accessible over my VPN). I was able to remotely initiate discovery this way and it does list all of my defined devices.

I was not able to verify if it can control them from Alexa on my break. I attempted to use text-to-speech via the "say" command, which I have used with Alexa in the past, but it doesn't appear to be hearing it based on the Alexa History even though Alexa is actually being used as a Bluetooth speaker for that system. There may be a couple of different reasons for this and perhaps some other ways to test but I'll just wait and test functionality later this evening.
eme jota ce
Posts: 655
Joined: Thu Jul 09, 2009 1:25 pm
Location: SW Florida

Re: Alexa-Hue Bridge Plugin

Post by eme jota ce »

Cool plugin.

Does this plugin function if we already have Hue bulbs setup in Indigo using the Hue Plugin?

Alexa seems to discover my Hue bulbs, only, but not the devices I've published via this plugin.

mjc
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Alexa-Hue Bridge Plugin

Post by jay (support) »

I just checked in some minor changes and a new 1.0.1 release that will better log when another app (or plugin) on your Mac has the UPNP port open, with directions on what to do next. Also updated the README with more information to cover that scenario.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Alexa-Hue Bridge Plugin

Post by jay (support) »

eme jota ce wrote:Cool plugin.

Does this plugin function if we already have Hue bulbs setup in Indigo using the Hue Plugin?

Alexa seems to discover my Hue bulbs, only, but not the devices I've published via this plugin.

mjc
Yes, it will. Download and install the latest version of the plugin that I just uploaded - I expect you have some other app on your Mac that's using the UPNP port. If you use the Sonos plugin, you'll need to disable it only during discovery.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
tjm000
Posts: 60
Joined: Sun Aug 03, 2008 4:48 am
Location: Gambrills, MD

Re: Alexa-Hue Bridge Plugin

Post by tjm000 »

Still no progress in getting this to work. I'm going to hold off till this weekend to try and dig into it some more. But I do have a question. I noticed that in the Alexa iPad App, that under Settings > Connected Home that there are only three categories of connected devices; Insteon, SmartThings, and Wink. Is there supposed to be a Hue category as well?
Tim
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Alexa-Hue Bridge Plugin

Post by jay (support) »

Those are for Alexa Skill Kit plugins - not needed for the Hue since it's built-in to the device (rather than a hosted skill). Notice the "cloud-connected" bit under the description.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Alexa-Hue Bridge Plugin

Post by jay (support) »

BTW, I've also seen something unusual today: on two occasions, I've tapped the Discover devices button in the Alexa iOS app and it shows the progress bar, but when it's done Alexa herself says nothing on my Echo. I then used the voice command "Alexa, discover devices" and she immediately replied that she couldn't and to try later. I then force quit the Alexa app on my iPhone, then started it back up and hit the Discover devices button and it worked fine.

So, there appears to be a bug with the Alexa iOS app (there are actually quite a few) that can cause discovery to fail, and once it gets into that state a force-quit restart cycle seems to clear it.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
Locked

Return to “Alexa-Hue Bridge”