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

This example shows you how you can automate your home so that your outside lights are turned on every day at sunset, and then turned off at 23h. This is a great idea for automating your porch or your garage lights so they are turned on to welcome all family members when they are arriving home, but then saving energy automatically turning them off at an appropriate time at night

For this example, I will be using a LIFX smart lightbulb, that can be easily controlled through IFTTT.

Let’s have a look at the different pieces of this smart home logic and how to set them up.

1. Create your condition

This Condition will be true between sunset and 23h.

When the time condition is true at Sunset, this means that my outside lights must be turned on, and later when the Condition turns false at 23h, this means that the lights can now be switched off.

We don’t need an external trigger as our condition will also be our trigger in this situation :sunglasses:

2. How to create the logicblock

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’.

It will evaluate the condition ‘outside-lights-on’:

  • If is true (positive action), this means the lights should be turned on, so I will set my action to turn my outside LIFX lights on. This will be done with an IFTTT applet that receives the event “outside_lights_on” from Apilio.
  • If it is false (negative action), this means it is time to turn the lights off, so I will set my action to turn off my outside LIFX lights. This will be achieved with an IFTTT applet that receives the event “outside_lights_off” from Apilio.

3. Setting up my actions with IFTTT

Now, to complete my automation, I will setup IFTTT applets that will take care of my actions when the logicblock tells them to. For this, I am going to use Apilio and LIFX on IFTTT, and we have already created the applets you need:

To turn on my outside lights on: enable this applet on IFTTT. Choose the foyer_light_on as your event.

To turn my outside lights off: enable this second applet on IFTTT. Choose the foyer_light_off as your event.

And hey… presto! My outside lights will turn on at sunset and off at 23:00hrs.

Any comments or questions? Leave us a message below or open a new topic in the help section of this forum. Thanks!

1 Like

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.

Yes, change the location in the underground weather to match your schedule definitions, meaning, half an hour early.

2 Likes

We’ve updated this example to use the new native time triggers in Apilio :smile:

And also added the direct links to the applets you need to enable, so you can setup this logic in minutes :running_woman:

1 Like

Oooh and I have now explanded this to include a new Logicblock to work between 23:00 and sunrise (using the new time window - woo hoo!) that gets triggered via IFTTT if anyone from my family connects to our wifi network. This event normally means someone is back LATE so the first action turns on lights to help them stumble into the house and a second action turns the lights off 3 minutes later so the local wildlife :chipmunk: :owl: :rabbit: :cow: :deer: can get back to what it was ahem doing beforehand. Works great #veryHappy!

1 Like

New triggers are great, though even better would be if you could set an offset, e.g. 30 minutes before sunrise :slight_smile:

1 Like

Hi @mcm! We love this idea, of course! :star_struck: In the meantime, a few users have achieved this setup by choosing as their location a place where the sun sets a little bit earlier.