It's dark, I'm arriving home, turn lights on....Please

This smart automation was suggested by one of our users and since sharing is caring, here you have all the details to replicate this at your own home.

Imagine that you want to turn on your foyer lights on when it’s dark at night, but only as you get close to your home. You could use this to quietly let your partner know that you are almost there, or for creating anticipation for your waiting-for-their-night-walk pets :dog:. And, of course, to light your way in so you don’t step on anything you should not be stepping on!

For this setup, we are going to use IFTTT’s location service to determine that we are close to home and also any smart plug where a lamp is connected to, so we can turn it on and off.

You could also replicate this checking if your phone connected to your home WiFi for example (as this lets you know you are close enough to connect to your router) and any smart light bulb that you have available, following the same steps.

Quick start template (New!!)

If you are already on Apilio, this is the Apilio template that sets up everything you need:

https://app.apilio.com/quick-start/6

Manually setting up the complete routine

One Logicblock that combines:

  • One Condition: check that it’s nighttime
  • One external trigger: check that I’m close to home
  • Two Actions: one to turn on the light and one to turn it off.

Over in IFTTT, you will be connecting 3 applets: one is the trigger and two are the actions.

1. Creating my Condition

At nighttime

This is a native Time Condition in Apilio: we will setup a time frame that goes from the sun setting to the sun rising.

2. Setting up the Logicblock

Your new Logicblock, ‘control_foyer_lights’, uses the condition we just created, plus an external IFTTT trigger we will setup later. Remember both conditions must be true: when the trigger happens, we check if the nighttime Condition is also true. Only in this situation we will run the actions.

Setup two IFTTT Actions with two event names such as: “foyer_light_on” and “foyer_light_off”. We will connect these later in IFTTT with an applet and your snart plug of choice.

3. Setting up my Actions in IFTTT

Our Logicblock has only two actions, both of them are in the positive actions chain. To turn on and off the light, we are controlling this with a smart plug. Apilio takes care of the 30 minutes delay, so that the IFTTT setup is easy-peasy. You will need the following two applets setup, just follow the steps:

To turn on my the foyer light on:

The applet we’ll enable is If IFTTT receives the event ‘foyer_light_on’ from Apilio, then turn on my LIFX smart light bulb. Here’s the applet you need to enable:

To turn my outside lights off:

  1. The applet I want to create will be: “If IFTTT receives the event ‘foyer_light_off’ from Apilio, then turn off my LIFX light bulb. Here’s the applet you need to enable:

4. Setting up the external trigger

This is the applet that you need to enable: when you enter a specific area (getting closer to home), run the Logicblock you have created for this automation:

And we are done! Now you have a light that will only turn on at night, when you are getting home.

Can you think of other situations where this might come in handy for you? Let us know how you have tweaked this example to suit your smart home needs below.

November 2020 update: If you don’t have a LIFX light bulb, we have a handy list of ready-made applets with many other light bulb brands.

1 Like

Hi I m tring to use this logicblock

But I don’t understand this last step:

In IFTTT, I created a Webhooks applet : If Maker Event “lights_on_dark”, then activate a scene in Smartlife app (my lights).

Can You please make me a step-by-step guide

1 Like

Hey Edoardo,

  1. After a Logicblock is evaluated it may, or may not, run an action - depending upon the result of the Logicblock evaluation
  2. The action described above is to trigger a Webhooks call to IFTTT - this Webhooks call runs a specific IFTTT Maker Event called “lights_on_dark” in IFTTT
  3. The Maker Event is the “IF This” side of the IFTTT Applet and will receive the Webhooks call from Apilio. You’ll see you need a name for the Maker Event in IFTTT as you setup the Webhooks call side of the Applet and that name must be identical in both IFTTT and Apilio for the correct Applet to be triggered. The field in Apilio is called “IFTTT Webhooks Service Event Name”.
  4. The “Then That” side of the IFTTT Applet is activating a scene in Smartlife.

Hope that makes sense.

My problem is that the Webhooks call from Apilio don’t work. there could be a problem on the trigger of Webhooks call? also If I try to test the action from the “show” page of Logicblock it don’t work.

Solved My problem was in the configuration of IFTTT Key.

sorry for disturb

No worries, we’re glad you got it fixed!

Very well described example.
Even though i’m quite familiar with Apilio I always learn more from examples like this from expert like you.
Thank you.

1 Like

Thanks for posting this example. Very helpful to see the actual example. I utilized your framework to build a setup with August Lock and TP-Link switch to switch on certain outdoor lights when the August Lock automatically unlocked based upon the August Lock’s bluetooth geo-location of my phone being within bluetooth range of the lock. The lights stay on for enough time to get out of car and inside house, etc. and then turn off automatically. Also, created a similar one where the August Lock is locked which triggers the same outdoor lights turning off a minute or so late after locking the door to leave.

I was glad to find a solution of multiple conditionals allowing things to work how I wanted. Thank you. It did illustrate to me that we have much more to go to make it easier for Smart Devices to be ubiquitous in a sophisticated way in our lives.

2 Likes

Thanks Chris, great feedback. Might be worth you entering this example in our very simple holiday competition!

Hey Dan, just wanted to say thanks for this (it helped me heaps)

Also thought I would share my customisation based off of your above solution.

First off, I have wifi light switches as well as a couple fans connected to a smart plugs installed through out my apartment here in Cape Town, South Africa.

Just thought Id share my solution.

Using your example above I was able to set up that when I get home after sunset and tell Alexa “Alexa, Im home” she turns off Alexa Guard > Turns on my hallway and lounge lights > Turns on my media centre and Starts playing my Spotify Playlist.

I Also managed to set up Boolean variable/Condition/Logicblock/IFTTT that should the temperature be above 23 degrees on Weather Underground at the time of me telling Alexa “Im home” my fans would also be activated.

I love the future :slight_smile:

Cheers,

1 Like

That are some awesome automations you built!! :heart_eyes:
Thanks for sharing :bowing_man:

Thanks Dylan, awesome feedback. We LOVE it. DanT

Hi everyone! We’ve updated this example to use the new native time conditions, so you can now setup Conditions that use Sunset/Sunrise to control your routines:

:star_struck:

1 Like

And another update, this use case is now available as a quick start template, so maybe give it a go this weekend? :wink:

:point_right:t3: https://app.apilio.com/quick-start/6

1 Like

Hi there, is there any way to get this to work with a Wemo smart plug? I think my logicblock is okay but I’m just trying to figure out how to trigger an action

2 Likes

Hello @akemi12! Yes you can turn your Wemo plug on/off with the Logicblock.

You’ll need to connect these applets:

  1. To turn on the light when you get home, you’ll enable an applet that when it receives an event (could be something like “wemo_plug_on”), then it turns on your Wemo smart plug. Here’s the applet you need to enable, select the event name you setup in your Logicblock:

Turn WeMo Smart Plug ON when Apilio triggers an action

  1. To turn the light off, the applet is similar. If IFTTT receives the event “wemo_plug_off”, then turn off your Wemo smart plug. Here’s the applet you need to enable:

Turn WeMo Smart Plug OFF when Apilio triggers an action

2 Likes

Thank you very much! :blush:

3 Likes

Hi, can you help me?, I already have some routines with IFTTT geofence/wifi location trigger some thinks like light, play music in alexa, etc. But I don’t know how to configurate that te air conditioner turn on due the temperature?, I can no find some applet that send the actual temperature degree for the logiblook evalute if turn on the AC or not. Thanks.

1 Like

Hey thanks for this. Any chance of sharing a bit more info? How are you getting the temperature into Apilio? Is it a Tuya/Smartlife AC product or something different?

Hi Dan, sorry I not explain my self very good, I don’t have (yet) any product that can sense the temeperature, so i want to use any service of weather like google for example to know the outside temperature.

My first think was that with IFTTT for sure I would find something but is not like that.