Playing around with Amazon Echo (technical interface discussion)

I’m being adventurous and giving it a go on an old Ninja Block (Beagle Bone) running Ubuntu.
That Beagle needed something to do, since Ninja is going out of business, sadly (though it will stay open source). Well… I’ve killed the Ninja cloud process so as to give the Emulator all the CPU.

(I have an Ubuntu Virtual Machine available too, but avoiding hogging up my PC for now.)

Just got it working! … the Echo’s response can seem a little slow; perhaps the Beagle Bone is under powered for optimal processing. But I’ll keep you posted regarding stability.

It should work similarly on a Pi, of course … I’m not sure which platform is optimal.

Feel welcome to PM me if you have questions … but Ron is cleaning things up and adding improvements as we test. The big deal will be adding support for dimming, as well as Hello Home phrases, and perhaps some other binary actuators.

Native SDK … will wait until after the holiday weekend!

My response time is quick running in Ubuntu on old notebook. I will report back when I move it to my Raspberry pi :smile:

Raspberry install took about 20min (maybe less)

New Raspberry, installed raspbian on card from image
insert card and boot
ssh in and re-partition so remaining card space can be utilized
java8 already installed, nice !
git already installed…nice !
git clone my echo hue emulator server
configure server (I modified the code to be more configurable)
start java process and attach devices according to instructions
tell alexa to discover devices

response time is same as when I had it on my MacBook Pro or my ubuntu notebook.

About 1 second to turn the light on/off and same for my AC units !

So now tiny headless box is driving the server, mission accomplished !

2 Likes

Thanks for doing the heavy lifting @Ron!

It’s a testament to the wonders of Linux and Java, of course, that this emulator is easy to port from one machine to another … and to run on a tiny machine. I wonder what the cheapest / smallest Linux compatible box would work?

Regardless, it’s a shame the emulator is slightly illicit, otherwise we could promote this more aggressively. The joys of Echo integration with SmartThings are so fun to share! :smile:

We do owe the original coder (for Vera?) some thanks!


The real potential now gets to be explored. How many “binary actions” (on / off) can be reasonably translated into SmartThings end-points? Hello Home Action phrases for sure … Deciding on the best way to name things is important for streamlining interactions.

1 Like

And it continues to respond to you, able to control the ST devices you’ve defined for it, etc? Why does mine work for a bit, then is unable to connect to devices? Maybe something wrong with my endpoint smartapp?

Is there logging I can enable to see what the Echo is complaining of when it says it can’t reach the device named etc.?

Thanks for any direction anyone can give here!

The only time I had Alexa say it could not connect to the device I had to reload the java app. This was only once and just after I had loaded a new device. Maybe check your Java version? I am running mine on OS X.

Yes mine has been running for days.

What OS are you running on ?
are you leaving the server running ?
Does the computer go to sleep when not in use ?

There is output when it is running so you should be seeing that output.

When I had mine on my MacBook Pro if I closed the lid it would stop working of course because the computer goes to sleep mode. That is why I moved it to a headless Raspberry device.

1 Like

John,

I’m curious how you may have changed the POST command to allow dimming. Right now it’s treated like a switch using the following syntax:

{
“name” : “Entry Dimmer”,
“deviceType” : “switch”,
“onUrl” : “https://graph.api.smartthings.com/api/smartapps/installations/########”,
“offUrl” : “http://graph.api.smartthings.com/api/smartapps/installations/#########
}

Thanks @Ron.

OS - I’m trying to get it running on both a RPi B+ with an updated Raspbian image and Java 1.8.0, and also on an old Windows Vista box.
I leave the java app running for the little while that it’s working right.
Neither device is ‘sleeping’ during the time I’m trying to work on this
I see output during both the few times that the commands are recognized and also when the Echo reports that she can’t reach the group or device named ‘kitchen’, or whatever.

Of those of you who have this running successfully, what endpoint smartapp are you using?

Need to modify the End Point SmartApp with additional mappings with arguments for dimming.
I’m going to try it from scratch to force myself to learn it… But perhaps not over the weekend.

@terryhonn strange that it works and then just stops working that has me stumped.
You say when you say “Alexa turn on Kitchen” you see it hitting the sever (output in logs) but then Alexa responds "I can’t find the group or device named “Kitchen”…

Have you tried a different name ? I had an issue when I called on of my lights “Main” I changed it to “Dining Room” and it worked 100% With Main it would always say “Did you say you want me to turn on Main” and I would have to say yes. It was annoying.

If it never worked I would ask if you let Alexa discover your devices.

Did you try forgetting all devices and re-discovering on the Echo ?

I use my own copy of the SmartApp but that is because I modifed my copy of the server so I it loads the device automatically. I didn’t like the post method.

1 Like

Hmm. I did try that, but I wasn’t sure what the right syntax was for the POST command. Rather than an on/off, you are passing a value for a dimmer request.

I should mention that I tried mapping via the latest ActION Dashboard.

Hey Ron,

Any chance you could provide step by step instructions once you get caught up? I’d like to purchase the exact same Raspberry pi hardware and follow your install instructions to get this running at home with my Echo.

Which echo hue emulator code are you cloning from github?

Thanks for your help!
Derek

[quote=“JAMike, post:130, topic:14887”]
I’m curious how you may have changed the POST command to allow dimming.
[/quote]I am not using the code here, but my own node.js version that talks to my own oauth/web api smartapp - my version supports setting the level (which is the dimming level of the switch/light.)

1 Like

@Ron, that’s nearly correct. The logs show that the java app found the device name and seems to act upon it, but then the Echo spins for a few seconds and replies that she can’t CONNECT to the group or device named kitchen, or bar light, or hallway, etc. I’ve used many different names for several different devices. I’ve had the Echo forget all the settings, rediscovered, removed from the emulator, re-added, etc., all several times, always with the same result… i start the java app and Alexa can control my lights for a few commands, then starts reporting that she can’t connect to them.

Thanks for your help, if you think of anything else, I’m game to try them.

Terry

Do you have anything else on your network that might be using the ports used by the emulator 8080 and 50000 by default ?

Strange, don’t know why this would happen.

That explains it. Even the crew on the casaverde forum hasn’t gotten to that point.

Might be a little lighter weight than the Java version…?

The Java version crashed a while ago on my Beagle Bone … ran out of memory. Didn’t run a lot of commands or devices and it worked fine for quite a while. Memory leak?

A pure Node.js version seems simpler. PM to share? :wink:

Interesting…How much memory on Beagle Bone ?

The java version is built on Spring which does seem a little heavy handed for the task at hand. I would have used Node also if from scratch.