Integration with Amazon Echo

If you have a feature you'd like to see in Indigo, post it here. Others can refine the idea if they like. Please keep each topic to one feature or a closely related set of features and don't add other unrelated requests to an existing topic. Use the Hardware Support Requests forum below to request support for some bit of hardware - but be sure to check the 3rd Party Plugins Forum first though to make sure there isn't already a plugin for it.
growlf
Posts: 1
Joined: Fri Dec 11, 2015 10:01 am

Re: Integration with Amazon Echo

Post by growlf »

Hello all,

I was a bit frustrated with some of the hue bridge options (not properly handling to UPnP requests, malformed responses, etc.) so I set out to write a better hue hub emulator. That was several months ago, and I ended up distracted with other work. That said, I finally finished something up, and I think it might be useful to the Indigo community.

1. It allows you to define devices very easily in a config file.
2. You can point it at your Indigo server (assuming web services are active) and it will read the devices and make them all available as hue bulbs.
3. "Weird" devices can be controlled by creating virtual on/off devices. Works fine on my garage door.
4. For most people with lights, it should take about a minute to setup and run, assuming you can run a python script.

Here it is:

https://github.com/johnray/hueAndMe

Anyway, works for me. I'll update it and fix bugs (maybe add error handling) as time allows.

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

Re: Integration with Amazon Echo

Post by jay (support) »

Thanks for the contribution. Quickly ran across a problem: it doesn't handle extended characters in device names.
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: Integration with Amazon Echo

Post by jay (support) »

Just did a pull request to fix a couple of bugs and add inclusions. Adding inclusions is going to be very useful for users with a lot of devices, so rather than exclude a large number of devices, they can include a smaller number (the list will be more manageable).

I'm very impressed with the speed, though I guess I shouldn't be surprised since the echo is talking directly to the script on the same network rather than having to go out through the reflector, etc.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
RogueProeliator
Posts: 2538
Joined: Tue Nov 13, 2012 3:54 pm
Location: Baton Rouge, LA

Re: Integration with Amazon Echo

Post by RogueProeliator »

Wow, I am really impressed with this idea / setup and it may actually push me to try out an Echo... especially if I were to get one for Christmas or birthday. HINT, WIFE, HINT! In all seriousness, I hope to give this a try if I can get my hands on an Echo. Looking at the code it wouldn't be too bad to turn into a plugin for the management (even if the main processing of the script remained as-is).

For those using this - I've read in the past a complain about the Echo being extremely strict about the syntax of the voice command... which is one reason I have previously stated I think a connected Siri (or maybe Google Now later) device would be better. However, they may improve on things and/or users may find this is not a real issue. Anyone with experience care to comment?
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Integration with Amazon Echo

Post by jay (support) »

RogueProeliator wrote:Wow, I am really impressed with this idea / setup and it may actually push me to try out an Echo... especially if I were to get one for Christmas or birthday. HINT, WIFE, HINT! In all seriousness, I hope to give this a try if I can get my hands on an Echo. Looking at the code it wouldn't be too bad to turn into a plugin for the management (even if the main processing of the script remained as-is).
My thought exactly - looking into it as we speak in fact... ;) The only downside is the 27 device limit. However, if you think about it, it's unlikely you're going to have that many devices in any given room/area where the Echo (or Fire TV now) can hear. But, of course, if you have multiple Echos and Fire TVs then it becomes more problematic. Anyway, it's definitely interesting enough that I'm investigating making it into a plugin.
RogueProeliator wrote:For those using this - I've read in the past a complain about the Echo being extremely strict about the syntax of the voice command... which is one reason I have previously stated I think a connected Siri (or maybe Google Now later) device would be better. However, they may improve on things and/or users may find this is not a real issue. Anyone with experience care to comment?
I don't know - I don't see it being much more strict than Siri, though I tend to be more precise when I'm talking to a device than I am when speaking conversationally. So, I see about the same rate of recognition failure. In fact, I like Amazons approach to failures better. With Siri, when it has a failure, most often it just guesses at what it thinks you want which often results in something useless and you have to stop it and try again. When Alexa fails, it says it didn't understand and I can quickly restate it. Most of the failures come when I'm at the range of it's detection - in my house, that's about 20 feet or so. I don't often get failures otherwise. Amazon bought it's speech recognition technology from another company (Yap) 4 years ago that had been working on it for 5 years, so it's been in development for almost 10 year - it seems quite good to me. (It also acquired Ivona for it's text to speech, which I think is superior to Siri's synthesis)
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
jfeger
Posts: 84
Joined: Wed Jan 02, 2013 12:51 am

Re: Integration with Amazon Echo

Post by jfeger »

growlf wrote:Hello all,

I was a bit frustrated with some of the hue bridge options (not properly handling to UPnP requests, malformed responses, etc.) so I set out to write a better hue hub emulator. That was several months ago, and I ended up distracted with other work. That said, I finally finished something up, and I think it might be useful to the Indigo community.

1. It allows you to define devices very easily in a config file.
2. You can point it at your Indigo server (assuming web services are active) and it will read the devices and make them all available as hue bulbs.
3. "Weird" devices can be controlled by creating virtual on/off devices. Works fine on my garage door.
4. For most people with lights, it should take about a minute to setup and run, assuming you can run a python script.

Here it is:

https://github.com/johnray/hueAndMe

Anyway, works for me. I'll update it and fix bugs (maybe add error handling) as time allows.

Best wishes,
John
Awesome work. I haven't been able to get this to load for some off reason. I keep getting a traceback related to UPNP and address binding. I have tried various ports for the "server" section, with no luck. I have validated I do not have any services running on the ports I tried. Does this need to use an IP different than the main IP of the machine? Im running this on the same machine as Indigo. I tried the loopback IP (127.0.0.1) as well as the LAN IP of the computer. Ive also tried "guess" as the first attempt

bash-3.2# python hueAndMe.py
Loaded 0 devices from config file.
Adding Dining Room...
Loaded 1 devices from Indigo.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "hueAndMe.py", line 58, in run
sock.bind(('', UPNP_PORT))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 48] Address already in use

Thanks,
James
jfeger
Posts: 84
Joined: Wed Jan 02, 2013 12:51 am

Re: Integration with Amazon Echo

Post by jfeger »

This is interesting, as I was able to fire up another computer and the script loaded without issue. I rebooted the Indigo server and tried again, and get the same error. Im not sure what would be causing this.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Integration with Amazon Echo

Post by jay (support) »

What port did you configure? You'd get that error if the port specified was already in use by something else.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
hdfreak
Posts: 19
Joined: Thu Jan 01, 2015 10:26 am

Re: Integration with Amazon Echo

Post by hdfreak »

I'm getting the same error as James. I've tried a plethora of different ports on the "server_port" line with the same result.

So, just to be sure I'm not doing something stupid:
- the "server_ip" should be where you are launching the python script
- the port should be 80? (I've tried others too)
- "base_url" should be Indigo server with 8176 as the default port?

In my case, they're the same IP address. Is this ok? All of my devices were loaded once I commented out "inclusions" (no devices are loaded if I try to add anything to included).

Thanks for any assistance--looking forward to playing with this!
nathanw
Posts: 175
Joined: Mon Sep 05, 2011 3:51 pm
Location: Boston, MA

Re: Integration with Amazon Echo

Post by nathanw »

+1 on hueAndMe. That was a fine dose of Just Working.

Now to figure out how I can make this useful, and not just a party trick.
jfeger
Posts: 84
Joined: Wed Jan 02, 2013 12:51 am

Re: Integration with Amazon Echo

Post by jfeger »

jay (support) wrote:What port did you configure? You'd get that error if the port specified was already in use by something else.
Hi Jay,
I've tried many ports, including 80,89,777,8002. I checked an lsof dump to see if the ports were in use, and they weren't. I also tried doing a basic telnet to the port to see if anything responded. It's a bit bizarre for sure.

Thanks,
James

In a side note, when I did get the script to launch on a temporary machine, it worked great. I'm looking forward to having it working on my Indigo server.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Integration with Amazon Echo

Post by jay (support) »

I just noticed that it's not the server port that's the problem, but there's some other process that's opening the UPNP port (1900). If you don't have multiple copies of the script running accidentally, then there's some other application on your Mac that's got that port open.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
jfeger
Posts: 84
Joined: Wed Jan 02, 2013 12:51 am

Re: Integration with Amazon Echo

Post by jfeger »

Ah, ok. That makes sense. Ill take a look. It will be a day or two before I get to it though.
hdfreak
Posts: 19
Joined: Thu Jan 01, 2015 10:26 am

Re: Integration with Amazon Echo

Post by hdfreak »

jay (support) wrote:I just noticed that it's not the server port that's the problem, but there's some other process that's opening the UPNP port (1900). If you don't have multiple copies of the script running accidentally, then there's some other application on your Mac that's got that port open.
Thanks, Jay. Ended up finding Sonos desktop app that was tying up port 1900. Once I killed that and ran the script again it worked perfectly.

And thank you, John, for taking the time to write this. Amazingly simple, once I cleared port 1900.

I did try on another machine with no luck, and when I looked at port 1900 I got back this:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
IndigoPlu 34483 HTPC 24u IPv4 0x2d8fbecf06162865 0t0 UDP *:ssdp

And idea what plugin it is?
User avatar
RogueProeliator
Posts: 2538
Joined: Tue Nov 13, 2012 3:54 pm
Location: Baton Rouge, LA

Re: Integration with Amazon Echo

Post by RogueProeliator »

The only downside is the 27 device limit. However, if you think about it, it's unlikely you're going to have that many devices in any given room/area where the Echo (or Fire TV now) can hear. But, of course, if you have multiple Echos and Fire TVs then it becomes more problematic. Anyway, it's definitely interesting enough that I'm investigating making it into a plugin.
I'm not so sure there is an easy solution, but every time I build a feature and think "it's unlikely...", the first user requires the exact situation. I could see wanting more than 27 devices via voice control in my situation in order to support action groups or virtual devices (or some other mechanism) that would access more than lights.

I normally frown on adding hardware just for an interface, but I guess if I REALLY needed more than 27 I could just buy my first Raspberry Pi and run the script on that, giving up the management as a plugin. Might just find I only need 27 for the convenience, though!
I don't know - I don't see it being much more strict than Siri, though I tend to be more precise when I'm talking to a device than I am when speaking conversationally. So, I see about the same rate of recognition failure. In fact, I like Amazons approach to failures better. With Siri, when it has a failure, most often it just guesses at what it thinks you want which often results in something useless and you have to stop it and try again. When Alexa fails, it says it didn't understand and I can quickly restate it.
Thanks, it is good to hear a direct comparison from use exactly how I would consider it... most of what I had read on Echo was early on AND some may have been more relevant for non-automation uses. IIRC, one example was that you could not ask follow-up questions as there was no concept of state. Example, I can ask Google Now - "How long is the movie Despicable Me?" ... get the answer ... "What is it rated?" without re-stating it is Despicable Me that I am questioning. But I doubt that type of conversation would be highly necessary for home automation. Might have a few specific use cases but not in general.

Adam
Post Reply

Return to “Feature Requests”