Microsoft Flow Smart Light Automation with IFTTT
We all know Microsoft Flow is a beast of a tool for business process automation. One of the few things it can’t do natively is integration with smart home devices such as WEMO and Phillips Hue lights. So what’s a girl to do if she wants to control her smart lights using Flow? We can team up with Flow’s sista from another mista, IFTTT to handle it!
What is IFTTT?
IFTTT stands for If This Then That (clever huh?). It is another automation tool, similar to Flow but more focused on the consumer side. IFTTT is free and has many native connectors to various smart home devices including: NEST, WEMO, Phillips Hue, Ring, and others.
IFTTT has numerous templates for you to use. In addition, you can create your own custom template which they call an “Applet”. One of the things you can do with these Applets is utilize a custom Web Hook. A web hook gives you a unique HTTP End point which you can call from another application (In our case Flow) to execute an IFTTT action.
Our Mission
Before we get into the details on how to execute an IFTTT applet from Flow, let’s talk about what we are trying to accomplish. When I receive an email that is Flagged with a “High” Importance, I want my WEMO smart lights to turn on and off to let me know that I have an important email.
Since Flow can’t call WEMO directly, we will utilize IFTTT to connect to WEMO. We will create an IFTTT applet which has a Web Hook Trigger so when a request is received, it calls WEMO and cycles the lights on and off. From the Flow side, we will have a Trigger for “When an Email is Received” filtered to look for emails with high importance. We will then use an HTTP action to call the IFTTT Web Hook which. Simple enough right?
Creating the IFTTT Applet
The first step is to sign up for your Free IFTTT account on their website: https://ifttt.com/.
After you sign up for a free account, scroll down to the bottom of the page past all of the templates and click on the text that says “Build your own services and applets”.
You will be prompted to sign up for a free applet maker account. Once you sign up and confirm your email, the first step is to create a Service. In order to create an Applet you have to have a Service to assign it to. Just give your service a name and ID and press Create.
Now that we have our service, we need to create the Applet which our Flow will call. The Trigger for our IFTTT Applet will be a Webhook – “when a request is received”. The action will be to call WEMO and turn our lights on and off. The config for the IFTTT Applet is below:
Now that we have our Applet created, we need to get the HTTP endpoint to use in our Flow. To do this, click on your applet where it tells you what connections the applet uses. Select the “Webhook” link.
This will take you to the landing page for the Webhook trigger. Select the “Documentation” link in the upper right hand corner
You will be taken to the details for your Webhook. At the top of the screen you’ll see your HTTP endpoint as seen in the screenshot below. I’ve hidden my unique ID but you will have a multi digit unique ID that you need to include in there.
The only thing that you will need to change in the URL is what is in the {event} bracket. You will replace that text with the default value for the event trigger you specified above. See the screenshot below:
We are good from the IFTTT standpoint now so let’s take a look at the Flow Configuration.
Configuring the Flow
Create a blank Flow and insert an “On new email” Trigger. The only thing we need to modify with the Trigger is to change the Important dropdown to “High” so that it only executes on emails sent with a High importance.
Next step is to insert an HTTP action. The Method for this HTTP action will be a POST. The URI will be the HTTP endpoint we got in the previous step: https://maker.ifttt.com/trigger/email_received/with/key/yourkeyhere
TJust save the Flow and you are good to go! The Flow will look for incoming emails marked with High Importance then call your IFTTT Applet via the HTTP action and the IFTTT Applet will turn on and off your WEMO light! This same process can be used for powering other smart home devices such as Phillips Hue, just change your action in IFTTT to call those other services.
Thanks April, this really helped me to create a VoIP call on IFTTT when a calendar event in my O365 account is about to start. Great way to integrate both automation tools!
That’s awesome Miguel!