How can I access a local API using Amazon Alexa

Viewed 11905

I intend to build a set of skills for Amazon Alexa that will integrate with a custom software suite that runs on a RaspberryPi in my home.

I am struggling to figure out how I can make the Echo / Dot itself make an API call to the raspberry pi directly - without going through the internet, as the target device will have nothing more then an intranet connection - it will be able to receive commands from devices on the local network, but is not accessible via the world.

From what I have read, the typical workflow is as follows

Echo -> Alexa Service -> Lambda

Where a Lambda function will return a blob of data to the Smart Home device; using this return value

Is it possible, and how can I make the Alexa device itself make an API request to a device on the local network, after receiving a response from lambda?

7 Answers

One possibility is to install node-red on your rPi. Node-red has plugins (https://flows.nodered.org/node/node-red-contrib-alexa-local) to simulate Philips hue and makes Alexa talk to it directly. It's an instant response. The downside is that it only works for 3 commands: on , off, set to x %. Works great for software/devices that control lights, shades and air-con.

Just open an SSH tunnel into your rPi with a service like https://ngrok.com/ and then communicate with that as either your endpoint or from the lambda.

Related