Amazon Alexa Skill with Remote (Away-From-Home) Control


#1

Hey, all. Wanted to let everybody know that I've made good progress getting my new Amazon Echo Dot to control my OctoPrint printer. It was a pain at first trying to understand how Amazon does things but I think I've got it now.

There are about 22 intents for anything from starting a print to checking on the status. Additionally, I've installed two TP-Link power switches so that I can power on/off either the printer itself or the proxy that was required for all this.

I wrote a server called octo-proxy which basically allows the printer to be proxied to the Internet in a safe manner. It runs on a headless Raspberry Pi Zero W single board computer. Inbound requests/commands from Amazon then are proxied to the printer and the responses returned back to be interpreted. It could be used with something other than Amazon to control it and I intend to create an external website concept later for this.

For an overview, it sort of looks like this (ASK = Skill, Lambda, FW = firewall, etc):

  ┌──────┐   ┌─────┐   ┌───┐   ┌────┐   ┌─────┐   ┌─────────┐
  │ Echo │ ⇄ │ ASK │ ⇄ │ ƛ │ ⇄ │ FW │ ⇄ │ o-p │ ⇄ │ printer │
  └──────┘   └─────┘   └───┘   └────┘   └─────┘   └─────────┘

It works quite well at the moment but I'll end up tweaking it a bit when I get more time. I gave a talk early this month and was able to remotely control the printer and stream the video as well.

More info


#2

So... you can talk to your O'Printer ?

That's very cool :smile:


#3

Yeah... it's like the movie Iron Man, hence the J.A.R.V.I.S. theme. I did a talk at the San Diego JS meetup in front of about 120 people and they thought it was pretty awesome.


#4

Hmm. I have a JARVIS apk somewhere.

Apks should be able to run on google chrome, which should run on linux. I haven't tried running X on my Octopi server yet tho

Begin testing phase...


#5

Adding the desktop with X11 is a challenge... noting that there's an active thread here in which someone has added some promising information and it seems to work with Raspbian Stretch as well. But it's do-able.

I'd recommend making a copy of your microSD before beginning. You can always rollback and make another attempt.


#6

I have my Zeta specifically for testing, with a backup

Just need to find Jarvis and transfer him over...


#7

Okay. It was a little more complicated than just "transfer him over", and, it doesn't seem to work :frowning:

I decided to try it on Raspbian first, thinking that it would run better than on the X in Octopi, but, no joy there. It looks like it's running, but, does absolutely nothing. The screen comes up, but it won't talk or light up when I click on it. It should at least say something when it starts

Octopi 15 is out today, maybe I'll give that a shot


#8

Just to clarify: the first Release Candidate of OctoPi 0.15 is out today, not the final release.


#9

Yes. Thank you. I see that it's just an RC, but, I've got an extra Pi and a plus Pi (neither currently hooked up to a printer, but I could do that easy enough), so, there's nothing that could be really hurt


#10

Here's a video link if you're interested how it works.

M4V link (500MB in size)


#11

New to forum, what is the status of your progress on this? I was thinking to build a very simple Alexa skill for purely giving print status reports, "Alexa, how's my print going?". Architecture at high level would be a Octoprint plugin that periodically pushes out status info to some data store on the web, then when I ask Alexa for my print status some lambda goes and checks that data store, reads me the status. If I can figure out some uid scheme to use this is something I could share with the community.

Seems a lot different from your project, but maybe there's some notes to share? I am professional developer (mostly c# & .js/.ts lately) and eager to use this project to force me to learn/use some python. I've built alexa skills before but it's been a while...


#12

It works brilliantly on my printer with 31 different intents, almost anything you could imagine. I considered trying to somehow "productize" or otherwise try to get others to use it. Spyder on here was nice enough to give it a try and he ultimately now has his own printer working in the same way.

With no negative thoughts whatsoever to him, it's just too much support on my part. It's the way that Amazon's infrastructure works; it's overly complicated. It doesn't support a server-based npm init mentality for lambda functions, for example. Their entire business model is based upon something that this isn't. They expect that I will publish this globally using this name and that I will incur all the lambda costs from my own wallet and that I will somehow pass this cost onto you. I can't do that so I can't be hosting the lambda function on my account. I've actually spoken to Amazon about this so they have this as feedback.

All this means that I would need to support the scaffolding of everything in three fronts for each person: the ASK side, the lambda side and the creation of an internal proxy server on top of all this.

From a pricing standpoint if someone were begging me I'd have to either say "no" or begrudgingly have to charge them something outrageous for the support.

Believe it or not, Robo 3D worked on this for a year internally and never got it going. It's complicated but possible.

Believe it or not, there's no Python to this. The lambda function is NodeJS. The ASK functions are created within a GUI and then stored as json. I wrote the proxy in NodeJS as well.

This is all I'm going to publish on the topic (apologies in advance):

Basic information
San Diego JS talk
Blog post 1
Blog post 2

Be inspired that it's possible.


#13

Yes, Amazon has a really poor strategy for growing the Alexa skillspace, charging devs for trivial lambda calls for non-monetizing apps. You'd think they could give away the lambda calls, just add Alexa adds after the call, "Would you like to buy some Amazon PLA?" They do give away a certain # of lambda calls, but still...

My project I have in mind is far less ambitious, just a print status update. Frankly I would not (yet) trust Alexa/AWS to run my printer (and I work with AWS every day, all day...). But your comments gave me food for thought, i.e. maybe avoid the lambda and piggy back off of some other free Alexa service. For example, she can read notifications received by other apps...so maybe I have octoprint send a notification to one of those services, let them foot the bill.

Anyway, thanks again.


#14

I disagree. I think it was YOU who were nice enough to put all the effort into this project

A great huge THANK YOU for that !

The thing is, and I understand the problem first hand, is that there doesn't seem to be a way to "package" it for mass download because each one has to be individually set up manually, and then support for even minor tweaks unless you're a programmer

On the other hand, now that it's up and running (perfectly, I might add) I haven't had a problem with it other than when Spectrum randomly occasionally changes my IP address, which isn't actually hard to solve, but, they don't send you a notice when they do it, (hey, we just changed your IP address, you'll need to adjust any programs that require static) so Alexa just tells me that she can't find my printer, which leaves me hunting and pecking wondering what the heck went wrong until I notice the IP change.

And if you ask Alexa, she says "your public IP address could not be determined", which is exceedingly unhelpful

And then, of course, there's WiFi issues, router settings, etc


#15

I have published an Alexa skill that lets you enter your API key and IP address and control your printer. Your printer IP does need to be public to the world which is a bit of a drawback...


#16

Yes. That's an issue with using Alexa or Google Assistant in that any commands need to go outside your house, to their server, be computed, then routed back to your house again

It's too bad that SNIPS isn't as user friendly. It doesn't need any outside help. It's all internal


#17

I was happy with Snips and got a hello world sort of program running on that. The computerized voice isn't as nice as Alexa but it's all local, as you said.


#18

Yea, I had Snips working (sort of. I still have the SD card in my library), but, it wasn't extremely user friendly to somebody like me who isn't as skilled as somebody like you in programming

Now, I forgot to mention Mycroft. Which seems, on the surface, much more user friendly, if not very intelligent. When I ask for the weather, I have to remember to tell it for WHICH town I want the weather FOR

I actually plan to keep using that one, but, I took it down (for now) cuz I needed another Pi for another project, cuz, yaknow, I ran out of them


#19

Snips is what powers the voice control part of my home automation. Quite happy with it. The only issue I'm still fighting is the false positives on the hotword detection (especially when talking to the phone). Wiring it up with nodered through mqtt to control various things in my home assistant instance was fairly straight forward.