Omega2 and IFTTT

I’ve been playing a bit more with the Onion Omega2, and have created this little project to demonstrate the control of connected devices, using the IFTTT service. Even though I’m only controlling a light bulb in this project, it could easily be reconfigured to tweet, send notifications, control another SBC, etc … using the many other channels available in IFTTT.

This post builds further upon the basic setup performed in my previous post: Getting Started with Onion Omega2



The hardware for this project is basic:

  • Omega2 with Expansion Dock
  • 4 arcade buttons with integrated LED
  • 4 resistors (10k) for pull-up/pull-down
  • some jumper wires

The buttons and LEDs are connected to the Onion’s GPIO using the Expansion Dock. The GPIO pins can be chosen as desired, the code in the next paragraph shows which ones I’ve used.

Do make sure to use a pull-up or pull-down resistor with the inputs. Otherwise the input will have a floating state, which could trigger your code even when no buttons are pressed. I’ve used 10k pull-ups connected to the 3.3V pin, which worked out fine.


A custom box fitting the four buttons has been designed in Fusion 360 for 3D printing. The box consists of two parts that snap together into something resembling a LEGO brick 🙂

The box model is available for download on Thingiverse:


The software for this projects consists, just like the box, of two parts.

The first part is the code running on the Omega2 itself. It is a python script waiting for button presses in order to trigger IFTTT events. Each button is linked to a different event. When a button is pressed, the matching LED is lit up as well.

The full code can be found below and modified to suit your needs, but don’t forget to use your own IFTTT key:


With the Omega2 capable of sending events, the IFTTT service needs to be configured to listen for those and trigger the desired action. This is done by defining “applets“.

The “THIS” should make use of the Maker channel, with the events used in the python script (“onion_1”, “onion_2”, …). The “THAT” part of the applet can be anything you want 🙂

And that’s about it! You can now control all the things, have fun!

© Frederick Vandenbosch, 2014-2021. Unauthorised use and/or duplication of this material without express and written permission from this blog’s author and owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Frederick Vandenbosch with appropriate and specific direction to the original content.