-
1Step 1
Background Info
IFTTT stands for "if this, then that", which is a web service that allows users to create custom tasks or "recipes" (e.g. if I receive a new email on my gmail account, then forward it to another account). The conditional statement could be as simple as if a button is pressed, or as complex as you want. There is also "DO button" app in APPstore or Google Play store, which allows the recipe to be triggered by pressing a button on the app.
When an event is triggered, a request is sent to the Onion Cloud via the Maker Channel. The Onion Cloud will then send a command to your local Omega to execute a ubus function.
The recipes are created through "channels", such as Gmail. We are in theprocess of creating an Onion channel, but in the meantime, we can
still use IFTTT through the DIY "Maker" Channel.
-
2Step 2
Setting Up The Omega With The Cloud
If you haven't already, you will need to create an Onion Account on the Onion Website. If you are completely new to the Onion Cloud, click the button on the bottom left to take a tour of the Cloud. Use the Device Manager to register your Omega with the Cloud. Again, use the tour button if you're unsure how anything works!
Now that you have a Cloud connected Omega, make a note of it's Device ID since we will be using it later. Next we will need to get an API Key. -
3Step 3
Get Your API Key
API Keys are authentication credentials that are tied to your account and allow other programs to use the Onion Cloud APIs. Click on the Key Manager App on the Cloud to create a API Key to use with IFTTT. Make note of the Key since we will be using it later. -
4Step 4
Setting Up IFTTT
Go to the IFTTT site and make an account. In the next step we will be making the recipe.
Download and open the DO Button App by IFTTT on your phone. Navigate to the My Recipes section and click the add button. I have included a series of screen shots to guide you through the steps on your phone.
Once you have selected the Maker Channel, you will be prompted to connect to the maker channel. Once you have reached the final screen, choose a title for the recipe. I have made mine "omega test".
For the URL field, just put google.com for now and choose the POST for the Method. For "Content type" select "applications/JSON", scroll to the bottom and click add.
We will now continue to modify the recipe on the desktop.
-
5Step 5
Creating an IFTTT Recipe.
In this step you will need to log back into the IFTTT website and open up the Onion Cloud. In this step you will modify the URL you entered in step 2 with one that is generated by the onion cloud and that points to your device and tells it to do something. Click on My Recipes, click on DO tab and then on the recipe you created on your phone and you will be able to modify the recipe. -
6Step 6
Get URL and Body Info From the Onion Cloud
Login into the Onion Cloud, then click on the Device Explorer App on the dashboard:
Your Device should have a Device ID and be connected to the cloud:
Click on the device and then the following tabs on the left i2c_exp and then oled-exp. You should reach the following screen:
-
7Step 7
Converting Omega Command to URL Request
In the command field enter:
set
In the option field enter:i
In the params field enter:params field enter:{"write":""}
The section under the curl command is what you will use to fill in the URL and body fields in the IFTTT recipe. The link at the end will be the URL to the Onion API and the JSON text before it is the body.The URL will have the following form:
https://api.onion.io/v1/devices//i2c_exp/oled-exp?key=
You will need to replace and with your device ID and API key which you took note of earlier. Enter this into the URL Field.
-
8Step 8
Editing IFTTT Body Request
Next, simply copy the JSON text inside the single quotes as is into the body field. Now let's add some ingredients, ie date and GPS coordinates. To do this place the cursor in between the empty quotation marks following"write":
And click on the button beside the field. Select "OccuredAt" from the dropdown menu and click "Add Ingredient". Repeat the process selecting latitude and longtitude. You will also need to add a space between the last two curly closed brackets.
Once you are done, your screen should look something like this and you can hit Update.
-
9Step 9
Try It Out!
First make sure the GPS on your on phone is turned on. Open up the DO app, press the button and watch the OLED Display.Using this project, you can use the Onion Cloud to control your remote Omega very easily. Using IFTTT, you can trigger commands either automatically or from your smartphone via the DO button App.
The Onion Cloud can send commands to any connected Omega to execute ubus functions. Therefore, this tutorial can be used as a framework to do other things remotely on your Omega; maybe control a door lock or light switch from your phone, or automatically start an action when you enter a specific area of your city. The world is your playground with the Omega and IFTTT.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Great project, but I can't seem to find the "DO" button app. I'm assuming this is only available if you've been provided a Maker invite.
Are you sure? yes | no