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
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
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