Presence Simulation with Lights


For years I have been looking for a way to have an comfortable presence simulation (based on lights at home turned on and off) that fulfils the following requirements:

  • Automated: The presence simulation shall kick in without any manual interaction - automagically
  • Has some randomness for switching on / off lights independently multiple times
  • Supports multiple clues whether someone is home: Heating system state, geolocation, motion sensor, etc.
  • Only runs when it’s actually dark based on sunset times
  • Supports lights or smart plugs of many brands

With the recent addition of random delays I finally find Apilio to be exactly the system I always needed. :star_struck:

The setup I describe in this article ticks of all of the requirements above! To make the article easy to understand and implement I keep it simple. But once you have an example running you can tweak it to your liking (of course - it’s Apilio after all :sunglasses: )!

  • The clue of whether someone is at home is done through geofencing a single person
  • The simulation will run from sunset until an example typical bedtime at 23:15


Presence information

  • To store the presence state, I use a single Boolean Variable named “philipp-home”
  • On top of that, I have a condition called “nobody-at-home” that requires that “philipp-home” is FALSE. Check the “Trigger Logicblocks when this condition changes” option
  • I use the Locative app on iOS to update the Boolean Variable with a geofence. Check out this article about using the app.

This is what the variable looks like:

And this is the condition:

Timespan for presence simulation

  • Create a time frame condition called “typical-time-for-lights” that will be valid from “sunset to 23:15”.
  • Check the “Trigger Logicblocks using this Condition at the start and end of the time frame” box.


  • Create a Logicblock called “simulate-livingroom-presence”
  • Check both conditions created before
  • Actions:
    • For the positive result, create the first action to turn on the light(s) on with a random delay. You may add more actions with random delays if you want the light to go on / off multiple times during the presence simulation. Of course you can define your own delays between on / off as you like and what makes sense in your household
    • For the negative result, create one action to switch the lights(s) off without a delay.
  • Check the option “Only trigger the actions if the result differs from the last evaluation” => This is important because otherwise Apilio might switch off the lights at 23:15 even if the presence simulation never kicked-in!
  • Make sure the Logicblock is always active

An overview of all elements

How to use and improve it

Make sure that the mains for the lights to use for simulation is never switched off, or make sure it’s on when you leave the house. But other than that, you don’t have to do anything else.

When it’s dark and nobody at home, the presence simulation will run automagically and as soon as you return home, it will be turned off. In this case, all simulated lights will go off immediately, so you can switch on only the lights you actually want to use.

You can create multiple Logicblocks with the same conditions for multiple rooms or mix multiple lamps in one Logicblock. Just do as you like!

:bulb: These related articles could also be of interest:


Very interesting.

I have around 50 logicblocks and never found a use case for the “Only trigger the actions if the result differs from the last evaluation” option, but this is clearly a case where it is needed.


I have to confess my parents have been requesting presence simulation for months now!! This is going to make them super happy :smiley:

1 Like