Turn lights on at sunset, off at 23:00hrs

Turn lights on at sunset, off at 23:00hrs


Here’s a simple example to illustrate how to turn on your lights at sunset and then turn them off at 23:00 each night

I’m going to use a Weather Underground Applet in IFTTT to Trigger my outside lights on at sunset. I’m then going to use an IFTTT time Applet to Trigger my outside lights off at 23:00 each night.

So the first thing I am going to do is set up a new Boolean Variable in Apilio called is-it-light-time. I want this Variable to be set to TRUE at sunset and FALSE at 23:00 by IFTTT. Here’s what this variable setup looks like - it’s FALSE now as it’s not sunset yet!

I then add a Condition in Apilio, which will change when my Boolean Variable has changed. Remember, although IFTTT is used to change Variables in Apilio, it is the Condition - or a combination of Conditions - that your Logicblocks depend upon to generate an action so the Condition step is super-important to get right!

I am calling the Condition “outside_lights_on” and using the Variable “is-it-light-time” to determine the state of the Condition: i.e. if “is-it-light-time” is TRUE, the Condition “outside_lights_on” will be TRUE.

Please be aware that before the next step you must first have setup your Maker Channel in IFTTT!

I will then add two Applets to create my two Triggers in IFTTT, one Trigger to set the Variable “is-it-light-time” to TRUE at sunset and one Trigger to set it FALSE at 23:00 BUT just before I will revisit Apilio.io to find out the Apilio URL required to set the Variable “is-it-light-time” to TRUE. You can find this information by showing the Variable details, as below:

So here’s the first IFTTT Applet setup, using Weather Underground - THANKS WEATHER UNDERGROUND - and my location to determine an accurate sunset time and I have pasted in the appropriate Apilio URL to make the Variable TRUE.

Here’s the process to create the second Applet:

  1. First I choose the “Every day at” time trigger

  1. Then I configure it to run at 23:00.

  1. Then I choose Webhooks and Make a Web Request

  1. And I paste in the Set False URL from Apilio into the IFTTT web request configuration to turn the Variable “is-it-light-time” to FALSE at 23:00.

We’re nearly there now…just the most exciting bit left - creating your Logicblock!

As shown below I’m going to call the Logicblock “control_outside_lights”

And it will evaluate the Condition “outside-lights-on”. If TRUE (Positive Action) I will set it to turn my outside LIFX lights on, if FALSE (Negative Action) then turn off my outside LIFX lights.

I am also going to set the Logicblock to Automatic evaluation so that any time a connected Variable changes, the Logicblock outcome will be determined.

In order to complete the Logicblock setup, I need to setup the IFTTT Actions I am going to call from Apilio to turn the lights on and off. Back to IFTTT…

First I will setup a new Webhooks “Receive a Web Request” Applet. The Event name I set in IFTTT will be “outside_lights_on” and this exact same name is what must be pasted into the Actions for Positive Result section above in the IFTTT Webhooks Service Event Name box. One of the most common setup errors we hear about is people changing names in Apilio and forgetting to update the name in IFTTT - so please don’t call us in that case (not cool).

I then make another Web Request Applet, called “outside_lights_off” to dim the lights off over 15 seconds.

And hey presto! Should turn your outside lights on at sunset and off at 23:00hrs.

Hope you find this useful. We realise all the terminology is a bit confusing at first but just give it a go and see how you get on - we’re around most days during CET business hours if you have any comments or questions.


So, this is what I am looking for except for one small modification. I want to turn the lights on 1/2 hour before sunset. Is that possible? Thank you in advance.