Questions about connecting to Alexa?

Posted on
  • I've been looking at the Amazon Alexa devices and wondering if they could be used with a WiFi enabled Espruino device.
    The Alexa works with AC switch devices but uses a offsite server as part of the link.
    Is there a way to have Alexa send a message to an Espruino device though my local router?

    A different idea uses the speech to text available in Android to send the message.

    I've used online service to find the IP address of my router, but how do you get a message to a specific device connected to the router (a sub-address)?

  • I don't have code for doing this on an Espruino, but what I do at my place is have a Raspberry Pi running this code:­/master/

    The clock call is (as you might be able to guess) a call that goes straight to an Espruino based device without much of an API. The hardware is so twitchy on that thing that I'm afraid to dig around in there to connect to board and upload new code.

    Note that the pong part of it (used to control my pingpong lights, and set them to one of 100 specific scenes, telling it the scene number as if it was the brightness of a Hue lightbulb) doesn't quite work currently.

    Whole thing generally works well.

  • Thanks DrAzzy. It looks like it uses a local router based address. Is that correct?

    I've done some digging and came up with this possible solution;

    A javascript project that connects Amazon Echo to a coffee pot

    It makes use of Google IFTTT and a local tunnel

    IFTTT is used to connect the Echo (Google IFTTT) it’s a Google product and goes beyond Amazon products

    To expose the server code to the Internet they used a tunnel­l

    The code for tunnel­el

  • It looks like @DrAzzy's hub uses the fauxmo library to fake WeMo devices. Looking at the code, it uses UDP so would be tricky to emulate on an Espruino (at the moment) - but having a Pi as a server is what I do too, and works pretty well.

    I'm not sure IFTTT is actually a Google thing? Anyway it looks like IFTTT has good support on Alexa and Assistant, and you can use the 'maker' endpoint to send an HTTP request.

    The issue is getting that in to your house - hence the tunnel. Often you IP address will change every so often (mine does), so it gets even more painful. If you have access to a server where you can put up some code to act as a relay between Alexa and your home, that'd really be the way forward...

  • I think the local tunnel and IFTTT approach is madness; in fact avoiding the use of anything that required an outside service other than Alexa itself (which doesn't require a hole in the firewall, since it initiates the connections) was a key design requirement for me...

    You're communicating between a device in your house, the Echo, and another device in your house.... And you're going to go outside the house, then make a call back in from the outside internet through a hole you've poked in your firewall?!

    1. This adds points of failure (whatever means you use to get through the firewall, external service that could be shut down or made a pay-for service in the future at the whim of an external organization) which are out of your control.
    2. This adds a tunnel from the outside internet to your Espruino. This strikes me as very dangerous; I have no confidence that the Espruino HTTP server will hold up to an aggressive attack - I operate under the assumption that there exists an unknown vulnerability (probably several) by which a malformed request could execute arbitrary JS, and hence no Espruino should be exposed to incoming connections.
    3. Your IP address changes occasionally, meaning you need to either set up a domain name and have it autoupdate (which is often finicky) or keep changing the IP address every time it changes.
  • Thanks @DrAzzy @Gordon. It looks like the PI is the way to go.

    One question remains about the URL or IP address that Echo uses to touch the PI.

    will get your router's web IP address.
    How to you get the router to send an Echo message on to the PI?
    Do you use the DNS to do this when the PI boots?

  • Hi,

    Use a service like this:

    This runs as a unix daemon, and updates your chosen dns name with the current up address of your pi. You choose a sub-domain off the main domains they offer, and they is what you register with other services.

  • Hi.

    Without any critics to anyone... but, why are you putting such a complex architecture with servers and what-else peaces for a such simple task as Alexa speaking to your smart device?

    If Espruino get UDP support (I am testing it now) Espruino can be emulating Belkin Smart-device protocol and Alexa will discover your Erpruino as a smart-device (on/off switch).

    After that Alexa will execute/send your voice command directly to Espruino board and it will on/off relais or do other things.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Questions about connecting to Alexa?

Posted by Avatar for ClearMemory041063 @ClearMemory041063