Switch power outlets on and off with home automation tools
If This Then That
A serious disadvantage of the device is obviously that it defines its own proprietary communication protocol. Unfortunately, this is the norm among home automation products. As a result, they only work with the individual manufacturer's not particularly original apps, and the open source community has either reverse-engineered the protocols used, had to dive into the details of a another quirky API, or been left out in the cold entirely.
However, fortunately, the trendy Internet company IFTTT [5] has set out to provide a convenient abstraction layer around this protocol confusion. Using the "If This Then That" paradigm, it lets you create logical connections between events. Integrating these events using an API would require a lot of brainpower and developer hours in the real world. Instead, the service generates rules from conditions (This), which in turn trigger actions (That). With just a few mouse clicks, you can permanently establish these rules.
The This clause defines an input channel, such as "At this time" or "When it rains" or "When this YouTube video goes viral." That refers to initiated actions such as "Send me an email" or "Post this tweet" or "Turn on this device." The example in Figure 5 illustrates how IFTTT sends email if it's going to rain tomorrow.
IFTTT has all sorts of ready-made channels that trigger an event: Weather Channel events like sunrise, rain, or sunshine are triggered as those natural phenomena occur at the user's location; various security components also trigger an alarm if a sensor in the house reports a break-in. Falling or rising stock prices can also trigger events.
People wanting to use a channel on access-controlled servers like GitHub or Gmail don't need to store a password on IFTTT.com; instead, you are guided properly through the OAuth web flow of these applications. The applications then prompt you to confirm that IFTTT.com may now perform selected actions under your user ID on the specific service. As usual with OAuth, you can withdraw permission at any time. The password never leaves the original service, and IFTTT.com works with tokens of limited validity.
Because programmers are often recruited from the open source scene to code the nitty gritty of the interface between IFTTT and a service (which the end user subsequently just has to select), the channels are consistently very good and implemented with the latest security guidelines in mind.
The arsenal of output actions triggered by events includes email and text messages, push notifications, on/off switches like WeMo, and more. The possible combinations of inputs and outputs, called "recipes," therefore appear to be almost unlimited, and the contributing developers imagination assumes astounding levels.
Setting Rules with a Mouse Click
Communication between the smartphone app and the Belkin server can only be achieved by use of an SDK, but the WeMo app already has built-in integration with IFTTT.com. If you want to switch the WeMo on and off using IFTTT, simply subscribe to the WeMo Switch channel and provide a PIN to IFTTT.com, which the WeMo app generates on request in the Settings menu (Figures 6 and 7 ).
Now, IFTTT has the keys to the kingdom of remotely controlling the WeMo switch. In conjunction with a triggering input channel, it can now switch on local electrical devices when predefined events occur, as well as with uncommon events, such as rising share prices, or the arrival of tweets.
Alarm for GitHub Issue
If you have a project on GitHub, you can now simply create a new IFTTT recipe to switch on a light or siren each time a new GitHub issue is created in your project. To do so, you need to subscribe to the GitHub channel and the WeMo Switch channel and then link the New Issue section of the GitHub channel as an input to the WeMo Switch channel as an output action (Figure 8).
The IFTTT server needs to continuously check many such recipes, so once the input is initiated, it might take a while for the output to be activated. In my tests, the delay between creating a GitHub issue and the switching action was about two minutes. Nevertheless, it is fascinating to see how easy this kind of link can be made and how many possibilities for home automation are opened this way.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.