<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Philipp Ebneter on Medium]]></title>
        <description><![CDATA[Stories by Philipp Ebneter on Medium]]></description>
        <link>https://medium.com/@pebneter?source=rss-21bb32b1ca68------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bn8l-R7OTrj4gBCmO_u-Tg.jpeg</url>
            <title>Stories by Philipp Ebneter on Medium</title>
            <link>https://medium.com/@pebneter?source=rss-21bb32b1ca68------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 20:50:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pebneter/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A simple way to make your Azure IoT Edge device act as a HTTP proxy]]></title>
            <link>https://medium.com/@pebneter/a-simple-way-to-make-your-azure-iot-edge-device-act-as-a-http-proxy-cb38b6fb05?source=rss-21bb32b1ca68------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb38b6fb05</guid>
            <category><![CDATA[azure-iot-edge]]></category>
            <category><![CDATA[proxy]]></category>
            <dc:creator><![CDATA[Philipp Ebneter]]></dc:creator>
            <pubDate>Fri, 14 Apr 2023 13:19:46 GMT</pubDate>
            <atom:updated>2023-04-14T13:24:24.887Z</atom:updated>
            <content:encoded><![CDATA[<h3>Problem</h3><p>In a typical layered network architecture for Azure IoT, the IoT devices or downstream edge devices usually don’t have direct internet access. They us use an Azure IoT Edge device as a gateway to the Azure cloud.<br>This works out-of-the-box for messages between the device and the IoT hub that use the edgeHub of the IoT runtime. But it does not work for other communications (e.g. DPS enrolment, certificate renewal, blob uploads etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*rBo0B1a42CZGR-bVPzLUNw.png" /></figure><h3>Solution</h3><p>To enable HTTPS communication to the cloud without enabling internet access for machines, we can deploy a <a href="http://www.squid-cache.org/">Squid proxy</a> module to the edge device. With this module, the edge device will serve as tunnel proxy for downstream devices.</p><p><em>There is also a module offered by </em><a href="https://learn.microsoft.com/en-us/azure/iot-edge/how-to-configure-api-proxy-module"><em>Microsoft </em></a><em>that is built on top of nginx, but it seems to be more complicated to setup. This is because the Mircrosoft approach terminates the connection, while the solution here acts as a tunnel.</em></p><h3>Instructions</h3><h4><strong>Prerequisites</strong></h4><ul><li>Azure IoT Hub</li><li>Connected Azure IoT Edge device based on Ubuntu Linux</li><li>Shell access to the edge device</li><li>Firefox browser for testing</li></ul><h4><strong>Steps to implement the HTTP proxy</strong></h4><ol><li>Prepare the edge device</li><li>Deploy the module to the IoT Edge device</li><li>Review that the module is running on the edge device</li><li>Test with Firefox</li></ol><p><strong>Step 1: Prepare the edge device</strong></p><p>The Squid proxy expects a configuration file to be present at /etc/squid/squid.conf. This configuration file must be tailored to the environment to allow the correct IP adresses. One option would be to create a custom docker image including the configuration file, but this is not practical because you&#39;d have to create and deploy a new image for every change.</p><p>What we will do instead is to to map the file /etc/squid/squid.conf from the container to a file on the host system at the same location. This way we can change the configuration later without changing the docker image.</p><p>Create a directory /etc/squid and save the following content as squid.conf.</p><pre>http_port 3128<br><br>acl proxyclient src xxx.xxx.xxx.xxx<br>acl ssl_port port 443<br><br>http_access deny !ssl_port<br><br>http_access allow proxyclient<br>http_access deny all</pre><p>This Squid configuration is very simplistic and taylored to this demo. Improve and replace it for use outside of development. It</p><ul><li>Tells Squid proxy to listen on port 3128 (the Squid default)</li><li>Allows the expected client (replace <a href="http://xxx.xxx.xxx.xxx/">xxx.xxx.xxx.xxx</a> with the actual IP address) to connect on port 443</li><li>Denys all other access</li></ul><p><strong>Step 2: Deploy the module to the IoT Edge device</strong></p><p>On IoT Hub, open you edge device detail page and click on “Set modules”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0nSv6ZfZRhzuwDL3TDrqAg.png" /></figure><p>Now click on “Add” → “IoT Edge Module” to configure a new module.</p><p>Enter a name (i.e. “squidproxy”) and the URI for the docker image. The docker image can be found at <a href="http://registry.hub.docker.com/ubuntu/squid:latest">http://registry.hub.docker.com/ubuntu/squid:latest</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*PPbipdabXn9qkK26t1rZBA.png" /></figure><p>Click on the tab “Container Create Options” and paste the following configuration:</p><pre>{<br>    &quot;HostConfig&quot;: {<br>        &quot;PortBindings&quot;: {<br>            &quot;3128/tcp&quot;: [<br>                {<br>                    &quot;HostPort&quot;: &quot;8080&quot;<br>                }<br>            ]<br>        },<br>        &quot;Mounts&quot;: [<br>            {<br>                &quot;Target&quot;: &quot;/etc/squid/squid.conf&quot;,<br>                &quot;Source&quot;: &quot;/etc/squid/squid.conf&quot;,<br>                &quot;Type&quot;: &quot;bind&quot;<br>            }<br>        ]<br>    }<br>}</pre><p><em>Note that I am mapping the host port 8080 to the container port 3128. This is because we had issues using port 3128 on the host.</em></p><p>Click on “Apply” and then “Review + create” do start the deployment. When the deployment is done, your edge device should offer the proxy functionality on port 8080.</p><p><strong>Step 3: Review that the module is running on the edge device</strong></p><p>Open a shell session on the edge device and check if the new module is running with iotedge list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*WCOf7l7t_HGE_sajThbFNA.png" /></figure><p>For more details, run sudo docker ps</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLjCDh48i6KZ7VaA9vehvA.png" /></figure><p>With iotedge logs -f squidproxy you can follow the log files.</p><p>Run sudo docker exec -it CONTAINER-ID /bin/bash to gain access to the shell of the docker image (replace the CONTAINER-ID with the start of id of the container, e.g. “1a”. Inside the container, you can see the logfiles in /var/log/squid.</p><p>If you need to change the configuration, edit /etc/squid/squid.conf on the host system and run iotedge restart squidproxy.</p><p><strong>Step 4: Test with Firefox</strong></p><p>I used Firefox to test the proxy from my computer. Go to the proxy settings of Firefox and add your new proxy to the configuration like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*RkHStiKJECB0A5hRFZYfNQ.png" /></figure><p>Firefox will now use the proxy to connect to any website.</p><p>Congratulations! You have added the proxy functionality to your Azure IoT Edge device.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb38b6fb05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 years of smarter home automation thanks to Apilio.]]></title>
            <link>https://medium.com/@pebneter/4-years-of-smarter-home-automation-thanks-to-apilio-33a148409a37?source=rss-21bb32b1ca68------2</link>
            <guid isPermaLink="false">https://medium.com/p/33a148409a37</guid>
            <category><![CDATA[smart-home-automation]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[smart-home]]></category>
            <category><![CDATA[ifttt]]></category>
            <dc:creator><![CDATA[Philipp Ebneter]]></dc:creator>
            <pubDate>Wed, 03 Jun 2020 11:33:09 GMT</pubDate>
            <atom:updated>2020-06-03T11:33:09.332Z</atom:updated>
            <content:encoded><![CDATA[<h3>4 Years of smarter home automation</h3><h4><strong>Achieving smarter home automation with the devices you already have and love.</strong></h4><figure><img alt="Apilio works with over 600 brands" src="https://cdn-images-1.medium.com/max/1024/1*jXOQVJexA7tsGL20V0sDjA.png" /><figcaption>Everything?</figcaption></figure><p>Are you surprised how difficult it is even in 2020 to transform your home into a smart home? We are too — well actually more frustrated than surprised!</p><p>It’s 2020, and upgrading your traditional home to a smart home with some automation to increase comfort or save energy is still a tricky topic. Talk to a couple of random people on the subject and you will get responses ranging from complete disinterest, concerns, frustration to curiosity, enthusiasm and love.</p><h4><strong>Why are we still waiting for the promised Smart Home future?</strong></h4><p>When looking around, it seems that Smart Homes are not as omnipresent as foreseen. Why is that? To me a mix of reasons is still standing in the way: mistakes in marketing, complicated distribution channels, company tactics, product complexity, lack of standards, and many more reasons. There is not one single aspect to blame, but a combination of them.</p><p>If you are interested in entering the Smart Home world, there are roughly three options to get you there:</p><ul><li>“Do-it-yourself”: Pick a smart home hub and hardware parts from various brands to have full control and flexibility. While having a lot of choice and flexibility, the risk is that you will give up the project frustrated by the time you need to fix compatibility issues.</li><li>“All-in-one solution”: There are nice systems where you buy into a closed ecosystem and pick everything from one brand. These usually work nicely and with no fuss, but it requires replacing hardware, offers limited flexibility and there is serious lock-in effect.</li><li>“Problem focused shiny products”: The third option is to buy some sleek and focused consumer products. While they offer a great user experience and joy at the beginning, they are not built for flexibility and don’t play nice with others.</li></ul><p>We at Apilio think that smart home automation should neither be difficult, expensive nor limited. Therefore we are on a mission to remove the constraints that come with the third option above, because we like nice products but don’t like being limited. That was the spirit in the early days of Apilio and it is still the spirit that drives us today.</p><h4>Updating the building blocks to make a smarter home</h4><p>There is so much nice hardware already installed around, now let’s just let everyone use it to their liking! If it improves your comfort — awesome! If it saves energy — even better!<br>One of my favourite examples: I had to install a new central-heating boiler and I did a lot of research to find the most energy efficient model. An investment of over 15&#39;000 € and at least the double amount of that in fuel costs for the expected lifetime. When freshly installed, the system was relying on a single outside thermometer, while I had already around 10 digital high quality indoor temperature sensors around the house in various gadgets— none of them helping to optimize the engery consumption. What a missed opportunity!</p><h4>Keep the hardware, update the brain</h4><p>Since I published the <a href="https://medium.com/@pebneter/when-if-is-not-enough-55b6e57d8742">first article about Apilio</a> four years ago, <a href="https://www.apilio.com/">Apilio</a> has matured from a private hobby project into a professional service, taken care of by an <a href="https://www.apilio.com/about/meet-the-team">enthusiastic team</a>.</p><p>Interestingly, the ingredients that set it apart from other solutions are still the same today:</p><ul><li>An event “memory” and the ability to define your own rules — both essential to building <strong>automation rules that go beyond the basics</strong>.</li><li>The goal to let you <strong>use the hardware you already have</strong>, accomplished by a neat integration with IFTTT (with its 600 connections) and additional connection channels built by us.</li><li>The drive to stay lean, to <strong>achieve more with less</strong>. “Reduce to the max” in every aspect.</li></ul><h4>The journey behind and ahead</h4><p>If you have come across Apilio in the past and liked it, the good news is that <strong>it is still the same</strong>! And if you didn’t like it, the good news is that <strong>it is completely different</strong>!</p><figure><img alt="Comparison of an earlier version of the Apilio UI with the current looks." src="https://cdn-images-1.medium.com/max/1024/1*N9zTJQumAn8NWM4lvFkK7g.png" /><figcaption>How our user interface developed over the years.</figcaption></figure><p>We kept the original idea of giving our user the tools to build the automation logic of their dreams with a point-and-click interface. But we have made great strides in making it <a href="https://www.apilio.com/blog/get-started-easier-with-apilio-smart-home-automation">easier to set it up</a>, making it <a href="https://www.apilio.com/blog/monitor-apilios-activity-with-our-new-event-logs">more transparent and informative</a>, giving our <a href="https://community.apilio.com/">community and documentation</a> a decent home, <a href="https://community.apilio.com/t/introducing-apilio-subscriptions/475">developing a revenue stream</a> to enable Apilio to be around in the long term and many more.</p><p>We are looking forward to the coming weeks, months and years of developing Apilio. <a href="https://community.apilio.com/c/feature-requests/11">Listening</a>, learning and innovating in small steps.</p><h4>Go for your smarter home</h4><p>If you have some connected gadgets at home that need a little help to become smarter, <a href="https://www.apilio.com/why-apilio/how-apilio-works">check out Apilio</a> and <a href="https://app.apilio.com/">create your account today</a>! It’s mainly an investment in reading and thinking than money.</p><p>If you find this article as Apilio newbie, head over to our <a href="https://www.apilio.com/">website</a> to learn more about how it works and what it does. If you are an Apilio oldie and haven’t checked it out since a while, go and experience <a href="https://community.apilio.com/c/feedback/12">all the changes</a> since then (Rejoice, I stopped doing interface design 😄).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33a148409a37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Home Automation and the Exception to the Rule]]></title>
            <link>https://medium.com/@pebneter/home-automation-and-the-exception-to-the-rule-2a192a774218?source=rss-21bb32b1ca68------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a192a774218</guid>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[home-automation]]></category>
            <dc:creator><![CDATA[Philipp Ebneter]]></dc:creator>
            <pubDate>Fri, 30 Mar 2018 05:13:53 GMT</pubDate>
            <atom:updated>2018-04-20T04:17:24.260Z</atom:updated>
            <content:encoded><![CDATA[<h4>Today’s home automation systems are lacking the ability to handle exceptions to the rule.</h4><p><em>I have observed that most (read: all that I know, except Apilio) of the current home automation systems have no means to deal with exceptions to the rule. But exceptions are common, and home automation systems should be able to handle them. I describe the problem in part I and possible solutions in part II.</em></p><h3>When home automation is getting it wrong</h3><p>To illustrate the problem let me describe two situations:</p><h4>The garden party</h4><p>Julia’s garden party with the whole neighbourhood is in full swing. But then, everyone is getting soaked by Julias “smart” lawn sprinklers. The lawn sprinkler controller noticed that there was no rainfall in the last couple of days and temperatures are high. According to the rule, that’s a clear sign to irrigate the lawn. What a surprise!</p><h4>The pub tour</h4><p>Martin has setup a rule to light up the home when he returns home after dawn. So one day when arriving late after a long pub tour, he is greeted by his home with a nicely lit entry – and his wife and the kids who were peacefully sleeping until that moment…</p><h3>More rules won’t help</h3><p>In both cases, the home automation system worked very well and did exactly as instructed. But they would have needed more information (e.g. “people present on the lawn” and “family is already asleep“) and more elaborate rules to make better decisions.</p><p>But some information is just almost impossible to get (e.g. to know if the family is asleep you‘d have to put a sleep monitor under everybody’s mattress) and the effort to setup and maintain the rules would be significantly higher while still not being perfect. Even a system with artificial intelligence (which in the end just also results in rules) cannot cover every spontaneous idea of humans – at least as long as our brains are not wired.</p><h3>The home automation trade-off</h3><p>We have to face the fact that home automation systems will always relay on an abstraction of the real world and therefore will make wrong decisions. Moreover, there are situations where the system works perfectly, but because of some undetectable, spontaneous idea of a human mind, it should do something else (this would be the exception to the rule).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*55TWLtL0PlmRwg3Z8xOAMg@2x.jpeg" /><figcaption>The comfort gain but also the probability of negative impact due to wrong decision are positively correlated. But the smaller the negative impact, the bigger the net comfort gain.</figcaption></figure><h3>How can we decrease the impact of wrong decisions?</h3><p>Home automation systems need to offer users an easy way to step in and make temporary adjustments. Doing so consists of two steps: Becoming aware and giving deviant instructions.</p><p>So what do home automation systems need to offer in order to cover both steps? I will write about generic patterns and the implementation on Apilio in part II of this series.</p><p><strong>Update on 20 April 2018: I will not finish and publish part II of the article because not many reeders seem to be interested. Instead, I recommend the </strong><a href="http://www.apilio.io/execution-modes.html"><strong>blog post on the Apilio website</strong></a><strong> if you are interested to read on.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a192a774218" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fast and simple rate limiting with Ruby on Rails and Redis]]></title>
            <link>https://medium.com/@pebneter/fast-and-simple-rate-limiting-with-ruby-on-rails-and-redis-68e76ba38ca4?source=rss-21bb32b1ca68------2</link>
            <guid isPermaLink="false">https://medium.com/p/68e76ba38ca4</guid>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Philipp Ebneter]]></dc:creator>
            <pubDate>Wed, 23 Aug 2017 06:23:32 GMT</pubDate>
            <atom:updated>2017-08-23T06:23:32.731Z</atom:updated>
            <content:encoded><![CDATA[<p>In one of my side projects, I needed user-specific rate limiting in order to protect the web service from over-use by individual members. By leveraging the EXPIRE feature of <a href="https://redis.io/">Redis</a>, I was able to create a simple, user-individual rate limiting function with just a few lines of code.</p><h3>My Requirements</h3><p>My requirements to the rate-limiting were:</p><ul><li>User specific (don’t stop the web service for everyone but just for the individual)</li><li>Short “bursts” of rapidly received requests are OK</li><li>Stop the request early in the call stack</li><li>Let the user know he was over the limit</li><li>Keep the impact on overall performance as low as possible</li></ul><h3>The Concept</h3><p>At the time I was looking at Redis for other stuff and learned about the built-in <a href="https://redis.io/commands/expire">EXPIRE</a> functionality. It lets you set a time to life for stored data. That concept sparked the idea for my rate limiting function:</p><ul><li>Count the requests of individual users over a defined time-span (in my case, 60 seconds)</li><li>Set the counter to zero after the time-span is over</li><li>If the user excesses the limit of 30 requests within the time-span, block any subsequent requests</li><li>Accept requests again after a cool-down period of 5 minutes</li></ul><h3>The Implementation</h3><p>Thanks to Redis’ EXPIRE functionality, this concept can be implemented without having to handle all the timing stuff in your code. And hence the coding needed shrinks to a few lines of code.</p><p>The installation of Redis is not complicated. If you run your app on <a href="https://www.heroku.com/">Heroku</a> as I do, you can just <a href="https://elements.heroku.com/addons/heroku-redis">activate the add-on</a>.</p><p>I included the function “track_api_usage” described below into the application controller in my Rails app. You can also put it somewhere else — just make sure that it is called very early in the call stack.</p><p>The code snippets below are simplified for better readability.</p><h4>track_api_usage</h4><ol><li>Set configuration parameters</li></ol><pre># time-span to count the requests (in seconds)<br>watching_timespan=60<br># maximum request allowed within the time-span<br>allowed_requests=30<br># &quot;cool-down&quot; period in seconds<br>blocking_timespan=300</pre><p>2. Compute an individual key for each user (needed for identifying the right data in Redis)</p><pre>#compose key for counting requests<br>user_key=&quot;counting_#{user.id}&quot;</pre><pre>#compose key for identifying blocked users<br>blocked_user_key=&quot;locked_#{user.id}&quot;</pre><p>3. Stop request if user shall be blocked</p><pre>#check if there is a &quot;blocked&quot; entry in Redis<br>if $redis.get(blocked_user_key)<br>      # block user<br>      render :status =&gt; 429, :json =&gt; {:message =&gt; &quot;You have fired too many requests. Please wait for a couple of minutes.&quot;}<br>      return false<br>end</pre><p>4. If the request is accepted, set or increment the individual counter</p><pre># check if the user already has a counter<br>    if $redis.get(user_key)<br>      # main action: increment counter<br>      number_of_requests=$redis.incr(user_key)<br><br>      # check limit<br>      if number_of_requests &gt; allowed_requests<br>        # write something into the log file for alerting<br>        Rails.logger.warn &quot;Overheat: User with id #{user.id} is over usage limit.&quot;<br>        # mark the user as &quot;blocked&quot;<br>        $redis.set(blocked_user_key,1)<br>        # make the blocking expiring itself after the defined cool-down period<br>        $redis.expire(blocked_user_key,blocking_timespan)<br>      end<br><br>    else<br>      # no key for counting exists yet - so set a new one with ttl<br>      $redis.set(user_key,1)<br>      $redis.expire(user_key,watching_timespan)<br>    end<br>  end</pre><h3>Statistics and Alerts</h3><p>As an interesting byproduct, you can visualize the Redis activity (e.g. with <a href="https://www.redsmin.com/">Redsmin</a>) and get simple statistics about the usage of your service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*-uC2Nv2o6yJaheWuXL-pSQ.png" /><figcaption>Number of keys stored in Redis</figcaption></figure><p>Additionally, you can setup a log file analyzer (e.g. <a href="https://papertrailapp.com/">Paptertrail</a>) to watch for entries created by the rate limiter and be informed about over-usage.</p><h3>Impact on overall Performance</h3><p>Lastly, an analysis of the app performance with <a href="https://newrelic.com/">New Relic</a> shows that the impact of the Redis read/write times are minimal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*47EnWH4Jq3C3fMAcANC6wA.png" /><figcaption>The inclusion of Redis in every transaction adds just minimal delay for answering a request.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68e76ba38ca4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When “if” is not enough: Superpowers for IFTTT]]></title>
            <link>https://medium.com/@pebneter/when-if-is-not-enough-55b6e57d8742?source=rss-21bb32b1ca68------2</link>
            <guid isPermaLink="false">https://medium.com/p/55b6e57d8742</guid>
            <category><![CDATA[logic]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[ifttt]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[smart-home]]></category>
            <dc:creator><![CDATA[Philipp Ebneter]]></dc:creator>
            <pubDate>Fri, 03 Jun 2016 08:11:02 GMT</pubDate>
            <atom:updated>2020-06-19T06:37:10.401Z</atom:updated>
            <content:encoded><![CDATA[<h4>Doing advanced home automation with IFTTT</h4><p><a href="https://ifttt.com/">IFTTT</a> is a wonderful tool and for those who understand how to use it, it quickly becomes an essential helper. The massive number of integrations with services (currently over 300) has turned it into an unique communication middleware for the cloud (also known as “glue” or “duct tape”).</p><p>But powerusers who are used to push the envelope and optimize their recipes might soon run into a limitation that is not obvious in the beginning: <strong>You cannot combine the information from multiple channels to make smarter recipes.</strong></p><p>Let’s say you want to switch on the lights in your house if it gets dark and you are not home (for the purpose of keeping burglars away). Or you want to save energy and skip heating up your room early in the morning if the weather forecast expects a warm afternoon anyway.<br>There is no way to make these kind of recipies on IFTTT today and many posted a feature request for this — because it can’t be so difficult to implement, right?</p><p>Wrong. What looks like an easy task at first turns out to be a bit complicated when you look closer. Here’s the thing: By nature, events on two IFTTT channels practically never occur at the same time. And since data on IFTTT is very short lived (it vanishes right after a recipe is finished) each recipe is isolated from the rest and has no clue what happened in the past.<br>In short, IFTTT is missing two elementary concepts of programming languages in order to be able to combine multiple channels:<br>1. Persistence<br>2. Conditional statements with multiple conditions</p><h4>The Idea</h4><p>When experimenting with some IoT-hardware I heard about the <a href="https://ifttt.com/maker_webhooks">IFTTT Webhooks Service</a> (originally called “Maker Channel” back in the days) and started using it. Webhooks can be used in IFTTT applets like any other service. What makes it different from the rest is that it’s not tied to a specific cloud service but offers a generic webservice interface that can recieve and make HTTP requests.<br><strong>Soon after, I had the idea to use the Webhooks to loop in not a device, but a web application which offers persistence and advanced conditional statements</strong>— exactly what’s missing in IFTTT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*UxawNCWN9WTNTkg4rZJFBA.png" /><figcaption>How Apilio integrates with IFTTT</figcaption></figure><h4>The Result</h4><p>So I started a project and set out to create <a href="http://apilio.io/">apilio.io</a>, which is online since a few months and has served me very well and reliably. I’m not sure which technical term describes it best, so I like to call it “Logic as a Service”.</p><p><em>Editors note: A lot has happened since I wrote this article! To find out how the “project” developed since then, read the follow-up article </em><a href="https://medium.com/@pebneter/4-years-of-smarter-home-automation-thanks-to-apilio-33a148409a37"><em>4 years of smarter home automation thanks to Apilio</em></a><em>.</em></p><p>The usage pattern of Apilio is twofold:</p><ul><li>Setup phase: Use the apilio.io web interface to setup variables and conditional statemenets.</li><li>Usage phase: Set variable values and trigger evaluations of the conditional statements via the web API.</li></ul><p>In the <strong>setup phase</strong> you use the web interface to build and test the conditional statements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*4i0xxfdmhZX1gNimNE5uug.png" /><figcaption>The building blocks in Apilio to define conditional statements</figcaption></figure><p>In the <strong>usage phase</strong>, Apilio interacts a lot with the IFTTT Webhooks Service and can therefore interact with anything that connects to IFTTT. Thanks to this, you can now combine input from devices and services (that would not speak to each other otherwise), make smart decisions and trigger actions.</p><p>Apilio does for instance give me a hint in the morning when it is <a href="http://www.apilio.io/umbrella-butler.html">wise to pick up the umbrella</a>. I used it to build an simple <a href="http://www.apilio.io/simple-home-security-system.html">home security system with my Netatmo Weather Station</a> (and I can activate it on my Apple Watch!). And most importantly: It helped me gaining the <a href="https://www.swarmapp.com/">Swarm</a> mayorship in my office be reminding me every workday if I forgot to check in :-).</p><h4>Your Turn</h4><p>The possibilities are endless, since Apilio is a toolbox — like a very simple programming language. Many users use Apilio to automate the lights, to control the air conditioning or to close the garage door at night if it was left open.<br>The downside of the flexibiliy: Apilio is not optimized for the non tech-savy users (but that will hopefully change sometime). Give <a href="http://apilio.io/">apilio.io</a> a try and send me your feedback. I’m looking forward to hear about your ideas!</p><p><em>Updated January 5th 2018 to reflect the renaming of the “Maker Channel” to “Webhooks Service”.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55b6e57d8742" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>