How to control your JustBoom Player with Amazon Alexa

This tutorial is a simple way of controlling your JustBoom audio boards using the JustBoom OS REST API and Amazon Alexa. This method does not require any complicated coding from Amazon AWS or JustBoom plugins but rather uses the cloud service IFTTT and the built-in REST APIs from JustBoom OS to make calls.

What you will need

  • Raspberry Pi & Power supply
  • JustBoom HAT or pHAT
  • JustBoom Player & 8GB micro SD card (minimum requirement)
  • Amazon Alexa device

Setting up your JustBoom board

If you haven’t done so already, you will need to head over to our JustBoom website and follow the guide to setting up your JustBoom board and downloading and installing our JustBoom Player.

Remotely connect to the JustBoom Player

Step 1 – Access your routers home page by opening up your web browser and going to your routers web URL i.e. my router is located at IP address 192.168.0.1 therefore my router web URL is http://192.168.0.1 .

Note: You can find your gateway IP address on the reverse side of your router

Step 2 – Enter your username and password if prompted and then navigate to “Port Forwarding” in your menu.

 

Step 3– In the Port Forwarding menu, create a new rule. In this rule add the following settings to forward port 80 to the JustBoom player, replacing the IP address with your JustBoom IP address:

  • Local IP: 192.168.X.X
  • Local Port: 80
  • External Port: 80
  • Protocol: Both

When finished click “Add Rule” or “Enable” to add the Port forwarding for the JustBoom Player.

Step 4 – Open up your web browser and go to the following URL: http://www.whatsmyip.org . At the top of the web page will be displayed your external IP address, which you will need to connect to your JustBoom player from anywhere on the internet that is not your local Wi-Fi.

Step 5 – From an external computer or mobile phone (Wi-Fi switched off) open a browser and navigate to http://yourip/ replacing “yourip” with your external IP address. You should now see the JustBoom home page and have successfully connected remotely.

Setting up IFTTT

IFTTT is a web service that allows users to connect and control devices across multiple different platforms. It uses the terminology “If This Then That” to create actions based on input information from a service. In this tutorial we are going to use it to connect Amazon Alexa Service to a Webhooks service. The action here will be our voice command from the Alexa device and the result is calling a URL.

Step 1 – In your browser go to http://www.ifttt.com and create and account or login if you have an account already.

Step 2 – Click on My Applets on the top left hand side of the IFTTT home page.

Step 3 – Click on “New Applet” then click the “this” in the title “if this then that”.

Search for “Amazon Alexa” and click on the service.

Step 4 – Now here we need to choose a trigger, something that will activate the call we send to the JustBoom player. Here we want to use a specific phase such as “Alexa trigger music on”. Select the trigger “Say a specific phrase” and enter “music on” in the text box.

Step 5 – Now let’s configure “that”, which is what we want to call when the trigger has been activated. In this case we want to call a URL to the JustBoom player.

In the search box now type in “web” and you will see the service “Webhooks” which will allow us to call the JustBoom URL.

Step 5 – Choose the action “Make a web request” and in the URL field add the following with your external IP address:

http://yourip/api/v1/commands/?cmd=play

This is the URL used to play the music. Click “Add ingredient” and then “Create action”.

Step 6 – Finally review the applet and click finish, taking note of the trigger words in the text box.

Call Alexa command

Now you can test your IFTTT applet by going to your Alexa device and saying the following phrase:

Alexa trigger music on

And your JustBoom player should start playing your music.

JustBoom REST API

Now that you have added the “music on” command you can add as many applets as you wish to IFTTT and there are a hole bunch of playback commands that you can call for the JustBoom player like the following:

You can find more information about the REST API command on our GitHub page – https://github.com/PiSupply/JustBoom/tree/master/REST%20API

First published at 8:23pm on August 28, 2018
Last updated at 8:23pm on August 28, 2018