Turn on wemo light on if dark out when arrive home

1460 views
Skip to first unread message

cghall

unread,
Oct 31, 2016, 10:22:18 PM10/31/16
to Apilio
Hello, new to this whole home automation and have staryed out with a bunch of wemo light switches piper security camera.

I have geo location setup using Life360 to turn on and off the camera when I enter or leave home.

I now want to setup my porch light that is on a wemo switch, to turn on when i arrive home but only if the hour of day is between sunset and sunrise.

Ia this possible?

pebneter

unread,
Nov 1, 2016, 11:27:00 AM11/1/16
to Apilio
Hi,
sure, that's no problem.

There is a step-by-step guide for a very similar setup: http://www.apilio.io/notification-on-arrival.html
The mechanics are exactly the same with the only differences that
- You will want your recipe to be "active" every night
- Instead of a message you want your light to be turned on

Check out the guide linked above and let me know if that helped.

regards
Philipp

cghall

unread,
Nov 12, 2016, 12:59:50 PM11/12/16
to Apilio
Finally had time this morning to try this out. No luck.

Here are my steps

Apilio
Created boolean variable "Night_Time"

Created condition "It'Night Time"


IFTTT
Created app with weather. If Sunrise make web request (url where "Night_Time" set to false)

Created app with weather. If Sunset make web request (url where "Night_Time" set to true)

Created app with Life360. When person arrives home, turn on wemo light switch


I think this is where I am getting lost and spinning myself further into confusion.

pebneter

unread,
Nov 14, 2016, 11:04:10 AM11/14/16
to Apilio
Hi,
that's not so far away from a successful completion.

What you have accomplished so far is that you have a condition in Apilio which tells you whether it's dark or not - this is the precondition to be fulfilled when deciding if you want to switch on the lights or not.

To finish it off, you need to do the following:

Create a logicblock in Apilio:
- Condition "It'Night Time"
- Action Setting: Define an event name for the positive result (the event name will match an IFTTT Maker Channel recipe). Let's name it "switch_on_porchlight"
- Leave everything else empty
- Copy the "Evaluate"-URL you see after saving the logicblock

Then create a IFTTT Maker Channel Applet:
- The "this" is a "recieve a web request" Maker Channel event
- The event name is "switch_on_porchlight"
- The "that" should put on your porchlight (wemo switch channel)

Last step: Modify / re-create the applet "Created app with Life360. When person arrives home, turn on wemo light switch". Instead of switching on the light directly, this must be a call to apilio:
- "This" = Life 360 geo location trigger
- "That" = Maker-Web-Request to the "evalute"-URL you copied in the earlier step

And you are finished!
Everytime you enter the geo location, you will make a call to Apilio. Apilio will then check if it's night time and - if yes - will ask IFTTT to put on your porch light.
 



Create a third recipe in IFTTT:
The “if” is a Maker Channel event (name it "send_notification")
The “then” is a notification or text to your phone
In Apilio, create a new logicblock:
Give it the name “arrival_at_home”
Check the box next to “It's weekend”
Action Settings:
Set the IFTTT Maker Channel Event Name for the positive case to "send_notification"
Leave the other fields empty or unchecked
Save the logicblock and copy the "evaluate"-URL
Go to IFTTT and make a new recipe:
The “if” is the Android or iOS Location Channel and should fire every time a person with the app enters the expected area
The “then” is a Maker Channel action which calls the logicblock-URL created in step 6
 Picture

relaxe...@gmail.com

unread,
Feb 5, 2017, 7:48:26 AM2/5/17
to Apilio

Hello, I am new to all of this as well, Many thanks to cghall and pebneter for the information so far. Being a newbie, it took me a while to work through the steps above and my setup does not work so I deleted all of the Applets, Aplio commands etc and started new. I thought I would write out the steps I took to. Maybe someone will be able to point out where I went wrong.

 

I have a Wemo Insight switch connected to my garden_lights. They work fine on the Wemo app and/or with a simple IFTTT recipe.

 

I know the Life360 geofence is running as I set up IFTTT recipes to SMS my phone when I arrive/leave.

I know the Weather Underground is working and identifying sunset as I get the notification that the Applet has run.

Lastly, I also get a notification that the ‘Maker event maker_wemo_on, then turn on garden lights’ applet is running as well.

 

So here’s the steps I took:

 

 

1. Log into Apilio

 

2. Follow the link on the Apilio page to the Maker channel key page https://ifttt.com/services/maker/settings

 

3. Click on Connect. This updates your Account Info and gives you an URL address, something similar to https://maker.ifttt.com/use/a12BCDEfg45hi67JKl89

Copy this URL and paste it into a Word/text document.

 

4. In Apilio, create a Boolean Variable called “night_time”, leave the Value as True, click Save. You will be presented with three URLs under the headings Set true, Set false and Toggle. Copy these URLs to Word.

 

5. In Apilio, click Conditions, Click create a New Condition for Boolean Variable, name it “it_night-time”, the Variable box will already contain “night_time”, I left the Required state as True and left the Unmodified since and Modified within boxes empty, click save.

 

6. In IFTTT, click the down arrow in the top right corner, click New Applet. Click This and then search for “Weather Underground”, click on Sunrise, click on that, search “Maker” and click on the Maker logo, click on “Make a web request”. In the URL field paste the URL from under the Set False heading in step 4., Click Create Action, Click Finish.

 

I did not know what to in this step with all the options in Maker. I did not click + Ingredient, the Method was left as the default GET and I left the Content Type and Body field as they were.

 

6. In IFTTT, click the down arrow in the top right corner, click New Applet. Click This and then searched for “Weather Underground” again, click on Sunset, click on that, search Maker and click on the Maker logo, click on “Make a web request”. In the URL field paste the URL under the Set True heading in step 4., Click Create Action, Click Finish.

 

7. Create an account on Life360.com and set up a Place. I made an area covering about a mile radius from my house. I called it Home. I also added the Life360 app to my phone.

 

8. In IFTTT, click the down arrow in the top right corner, click New Applet. Click This and then searched for Life360 and clicked on the logo, click on “You arrive at a specific place”, it loaded my place called Family-Home in the drop down box and I clicked Create trigger. Click on that, searched for Wemo and clicked on Wemo Insight Switch, click on Turn on, in the drop down box selected “Garden Lights”, click Create Action, click Finish.

 

9. In Apilio, click Logicblocks, click New Logicblock. In the Name field I wrote wemo_on_dark. I checked the Conditions box next to it_night_time. Under the heading IFTTT Maker Channel Event Name heading, in the IFTTT Maker Channel Event Name I entered “maker_wemo_on”. Left everything else the same and clicked Save. I received a message that said Logicblock was successfully created and Note: Your Logcblock can not trigger any actions until you save your IFTTT Maker Channel API Key

 

10. I clicked on the link to create an IFTTT Maker Channel API Key, paste the URL from step 3. Click update, click save.

 

11. Click Logicblock, click on edit next to wemo_on_dark, click save and then copied the URL under the heading “Evaluate”.

https://apilio.herokuapp.com/logicblocks/wemo_on_dark/evaluate/with_key/123435466[edited]

 

12. In IFTTT,  New Applet, this, search maker, click on Maker Logo, Click on Receive a web request, Event Name “maker_wemo_on” as in step 9, click create trigger. Click that, search Wemo, click Wemo Insight Switch, garden Lights, create Action. Click Finish

 

13. In IFTTT, click on My applets, click on Life360 applet I created earlier (If you arrive at Family – Home, then turn on Garden Lights). Click gear icon at top right and deleted this Applet.

 

14. In IFTTT created a new Life360 Applet, click this, search Life360 and click on logo, click “You arrive at a specific Place”, let Life360 load my Family – Home, click Create Trigger, click that, search Maker, click on logo, click on Make a web request, in the URL I paste the URL from step 11, click Create, Click Finish.

 

 

 

 

 

 

ojchase

unread,
Feb 5, 2017, 9:51:51 AM2/5/17
to Apilio
That looks right to me.  My only concern is in step 10, and only because I haven't done it before.  (Apilio used to work differently here, and I haven't needed to use the new way yet.)  It might only be asking for your maker key, not the entire URL.  i.e. just a12BCDEfg45hi67JKl89.  I'm honestly not sure, but check the wording there to see if it's asking for the URL or key.

If that's right, I don't see the problem either.  Check for typos.  Another thing you could try to debug is the step 14 final applet. Try pointing it to changing the night_time variable, with one of the three URLs from step four.  That will help you debug whether you're getting messages from Maker to Apilio successfully, as you can reload the variable page to see if it changed.

One other question: You said that you're getting notifications when maker_wemo_on runs.  When does that happen?  Are you testing it by hand, or is it as a result of the overall configuration?  If it's being done automatically, that would suggest a problem within IFTTT talking to the lights.  That's the only way that applet should be running (unless manually tested).

ojchase

unread,
Feb 5, 2017, 10:01:50 AM2/5/17
to Apilio
A couple more questions/debug tips:

Also to debug communication, you know that the weather applet is running because you're getting notifications.  Are you seeing it also change your variable's state in Apilio?

Have you tried running maker maker_wemo_on manually, i.e. in a web browser?  It should turn on the actual lights whenever you run it, whether that came from complex apilio logic or a manual trigger.
https://maker.ifttt.com/trigger/maker_wemo_on/with/key/<YourKeyHere>

And a really dumb question: You are testing this after dark, right? :)  Or when you've otherwise edited night_time to be true. 

relaxe...@gmail.com

unread,
Feb 6, 2017, 5:56:29 AM2/6/17
to Apilio
Thank you very much for the detailed reply ojchase. You should have asked the really dumb question first. Not knowing what I was doing, I did all of the above steps during daylight and waited for sunset before physically testing. 

As you've guessed, I set the Boolean Variable to True, telling Apilio that it was night time when I saved the variable. Becuase of this, when the Weather Underground applet triggered at sunset, the variable switched to false. Apilio then thinks it's daytime so all following steps don't run.

In summary, all of the steps above work perfectly well IF you create them at night time. If you create them during the day, set the Boolean Variable in step 4. to false. It's so simple... now.

Thanks again to all of you that have helped me. I'm looking forward to the next project already.    

bennyshe...@gmail.com

unread,
May 25, 2018, 5:58:58 PM5/25/18
to Apilio
Can this configuration be done without using life360? I'm trying to attempting having a wemo light switch turn on at night when I'm almost home. I'd rather keep the setup as simple as possible

pebneter

unread,
May 28, 2018, 11:32:00 AM5/28/18
to Apilio
You will need a source that tells Apilio "I'm almost home". But you are of course free to choose whatever source can deliver that. You can use the geofencing functionality of the IFTTT app for instance.

relaxe...@gmail.com

unread,
Aug 2, 2019, 8:22:41 AM8/2/19
to Apilio
For the life of me, I can not get this to work now Maker has become Webhooks. I would really apprciate it if someone can point me in the right direction.

My old Wemo setup no longer works!

Philipp

unread,
Aug 8, 2019, 8:57:38 AM8/8/19
to Apilio
Hi there,
the name has changed a while ago, but the functionality is still the same as far as I know.
What's the issue with your setup?
Message has been deleted

relaxe...@gmail.com

unread,
Aug 11, 2019, 6:10:19 AM8/11/19
to Apilio
Here's is what I have done. Hopefully, this is correct? I was most confused in trying to work out the Action Chains section of the Logicblock.

I've had Life 360 running for ages with a geo-fence around my home. The idea is that if I enter the area, and the Condition that it is between sunset and sunrise is true, then the Wemo switch will turn on. 

Hopefully, this is correct?

1.    Apilio - Create a Boolean Variable: 


I named mine “night_time".

This is a true/false scenario. If it is after sunset when you create the setup, set the value as ‘True’. Alternatively, if it is before sunset, set the value as ‘False’

Save the Boolean Variable and you will be provided with Once three URLs, one for each; ‘Set true:’, ‘Set false:’ and ‘Toggle:’

Copy the three URLs to a text document. You will need these details later.

2.    Apilio - Create a Condition:

I named mine 
“It_night_time”


The Variable is the one you created in step one, in my case “night_time”


The Required state is "true"


Leave the Timestamp restriction fields blank.

 

3.   IFTTT  - click on  ‘Get More’, then ‘IfThisThenThat’ to create a new applet.

Click ‘This’ and search for ‘Weather Underground’ and choose the ‘Sunset’. Change the location to your area and click ‘Create trigger’

Click ‘That’ and search for “Webhooks’. Click on ‘Make a web request’. In the URL field, enter the details of the ‘Set True’ URL you were provided in step 1.

The Method is "GET"


Leave the other options empty. Click ‘Create action’ and then ‘Finish’

 

4.    IFTTT  - click on  ‘Get More’, then ‘IfThisThenThat’ to create a new applet.

Click ‘This’ and search for ‘Weather Underground’ and choose the ‘Sunrise’. Change the location to your area and click ‘Create trigger’

Click ‘That’ and search for “Webhooks’. Click on ‘Make a web request’. In the URL field, enter the details of the ‘Set False’ URL you were provided in step 1.

The Method is "GET"


Leave the other options empty. Click ‘Create action’ and then ‘Finish’

 

5.    IFTTT - click on  ‘Get More’, then ‘IfThisThenThat’ to create a new applet.

Click ‘This’ and search for ‘Webhooks’ and choose ‘Receive a web request’

As an Event Name I entered ‘webhook_wemo_on’

Click ‘Create trigger’.

Click ‘That’ and search for Wemo. Select your device type and the action to turn the device on.

 

6.   Apilio - Create a Logicblock

I named mine ‘arrival_at_home’

I checked the condition ‘It_night-time’ (created in step 2)

In the ‘Actions for a positive result’, ‘IFTTT webhooks service name’ field I entered ‘webhook_wemo_on’ (created in step 5)

Click save

Apilio produces a URL similar to https://maker.ifttt.com/trigger/webhook_wemo_on/with/key###

Copy this URL

 

7.    IFTTT - click on ‘Get More’, then ‘IfThisThenThat’ to create a new applet.

Click ‘This’ and search for ‘Life 360’ and choose “You arrive at a specific place’. Select the area you have set up in Life 360 and click ‘Create Trigger’

Click ‘That’ and search for “Webhooks’. Click on ‘Make a web request’. In the URL field, enter the URL from step 6.

Philipp

unread,
Aug 12, 2019, 10:21:10 AM8/12/19
to Apilio
Looks perfect to me!

relaxe...@gmail.com

unread,
Aug 12, 2019, 11:14:09 AM8/12/19
to Apilio
I can confirm, the set up does work, sort of.

My IFTTT activity log for tonight shows the Weather Underground 'sunset' applet ran at 5:37 pm, I entered the home area at 6:48 pm and the Life 360 Applet ran. I was settled in and watching television at 8:44 pm when the Webhooks applet ran and turned on the lights. 

For whatever reason, there is a two-hour delay. I am guessing this is an IFTTT issue. I can't think of a way of speeding up the actions.

pebneter

unread,
Aug 12, 2019, 11:21:53 AM8/12/19
to Apilio
Check out this help article. Probably an issue with the API key. https://help.apilio.io/en/articles/3029932-how-to-fix-unwanted-delays-when-triggering-ifttt

relaxe...@gmail.com

unread,
Aug 22, 2019, 7:35:11 PM8/22/19
to Apilio
Thanks for the advice people. I've followed all of the suggestions and have reached the point to confirm this is not an Apilio issue.

Previously, the Webhooks to turn the switch on was running at 8:44pm everyday (when the conditions have been met), regardless of what time the sunset or what time I arrived home. I reset everything, deleted all the applets and services and started again. Now, my lights come on everyday at 10:34pm.

It has to be an issue with IFTTT. My other applets are running in batches. When I check 'my activity', I can see the delay and where different services are all running in the same minute - hours after the event.

The problem solving continues:

Philipp

unread,
Aug 23, 2019, 7:44:36 AM8/23/19
to Apilio
You made sure that the IFTTT Webhook key in Apilio is up to date?
Since IFTTT rolled out the new user interface, we have many reports of delayed actions - often caused by old authentication keys.

relaxe...@gmail.com

unread,
Aug 31, 2019, 9:30:39 AM8/31/19
to Apilio


Yes - I am pretty sure I have updated API keys in Webhook and Apilio.


Still no joy. They run according to time, not event.


API Webhooks APpilio.png

API IFTTT Webhooks API.png


Reply all
Reply to author
Forward
0 new messages