# Lights on/off randomly in different zones

**URL:** <https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717>\
**Category:** Flows\
**Tags:** flow, homey-pro\
**Created:** [October 1, 2023, 8:39pm UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717 "2023-10-01T20:39:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrPilloft](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mrpilloft/32/87781_2.png) [@mrPilloft](https://community.homey.app/u/mrPilloft)\
**Post date:** [October 1, 2023, 8:39pm UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/1 "2023-10-01T20:39:30Z")

</div>

Hi. I know there are many topics on lights on/off randomly, but I haven’t come across any that I can build off of to achieve what I would like and I would like your take on the task. Here’s what I want:

I want all lights in a zone to turn on within 45 min after sunset (a). One light should turn on within 5 min of the sunset (b), the rest may or may not turn on at the latest 45 min later (c). This means that different lights tun on at different times within 45 min after sunset. Some might not turn on. At least 1 should turn on (d). The number of lights may warry, so the programming should be dynamic (adress all available lights in the zone at any time).

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/a/ca73d5a5eeb1c858de5a7b2a941ca1ac1a4b9e05.jpeg)  
(This is sadly not my house, but it has got some light automation…)

It should be possible to turn this automation on and off for zones and each zone could have configurable values for a, b, c and d.

Anyone got anything similar or have an idea of how to achieve this?

---

<div class="post-metadata">

**Author:** ![Marco\_Dijkstra](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marco_dijkstra/32/16541_2.png) [@Marco\_Dijkstra](https://community.homey.app/u/Marco_Dijkstra)\
**Post date:** [October 2, 2023, 4:03am UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/2 "2023-10-02T04:03:55Z")

</div>

Maybe u could use the logic function “chance”. You can find/search things about this at the forum.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 2, 2023, 5:07am UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/3 "2023-10-02T05:07:36Z")

</div>

> [@mrPilloft](#):
>
> (This is sadly not my house…)

Be glad, it’ll get burgled (or at least _attempts_ will be made).

---

<div class="post-metadata">

**Author:** ![mrPilloft](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mrpilloft/32/87781_2.png) [@mrPilloft](https://community.homey.app/u/mrPilloft)\
**Post date:** [October 2, 2023, 7:37am UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/4 "2023-10-02T07:37:16Z")

</div>

> [@Marco\_Dijkstra](#):
>
> Maybe u could use the logic function “chance”. You can find/search things about this at the forum.

Yes, that could be part of it, but how to per zone to address all lights, at least one on and so on?

---

<div class="post-metadata">

**Author:** ![mrPilloft](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mrpilloft/32/87781_2.png) [@mrPilloft](https://community.homey.app/u/mrPilloft)\
**Post date:** [October 2, 2023, 7:50am UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/5 "2023-10-02T07:50:46Z")

</div>

My first attempt on pseudo code would be something like this:

```auto
a) for each zone to automate
  b) Put all available lights in an array/collection
     Randomize if each light should turn on
     Randomize individual delays between 5 - 45 min
     Loop over and identify
     c) The one which turns on first, randomize a new "on" time between 0 - 5min
        If none is randomized to turn on, randomize one to turn on, randomize when between 0 - 5min
        Schedule to turn on the lights according to delays

```

Is anyone capable to writing such a script?

---

<div class="post-metadata">

**Author:** ![Torch1969](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/torch1969/32/33305_2.png) [@Torch1969](https://community.homey.app/u/Torch1969)\
**Post date:** [October 3, 2023, 10:43am UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/6 "2023-10-03T10:43:40Z")

</div>

Maybe an app like this can help you out?

> [@\[APP\]\[Pro\] Party Lights for Homey](https://community.homey.app/t/app-pro-party-lights-for-homey/90160):
>
> [forum\_banner] Party Lights for Homey Party Lights is a Homey app that allows you to control your smart lights with ease. With this app, you can toggle the lights, change their colors, and create dynamic lighting effects. Currently has support for: bulb Blink light with automatic color change feature lets you turn on your lights with a specific color and brightness. You can choose from a wide range of colors to create the perfect lighting atmospherebulb Blink light and set color featur…

Or maybe the developer (@LRvdLinden who is very productive with new apps) is willing to help you with specific needs in this app, or a spin-off from this app in a new app (Security lights app…??).

---

<div class="post-metadata">

**Author:** ![LRvdLinden](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lrvdlinden/32/80786_2.png) [@LRvdLinden](https://community.homey.app/u/LRvdLinden)\
**Post date:** [October 3, 2023, 11:17am UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/7 "2023-10-03T11:17:11Z")

</div>

@mrPilloft As @Torch1969 mentioned, you can try [Party Lights](https://homey.app/en-us/app/nl.lrvdlinden.party-lights/Party-Lights/). If this is not close to your needs, let me know. Maybe I’ll build it in or in a separate app.

---

<div class="post-metadata">

**Author:** ![frosse](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/frosse/32/114332_2.png) [@frosse](https://community.homey.app/u/frosse)\
**Post date:** [October 16, 2024, 6:14am UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/8 "2024-10-16T06:14:16Z")

</div>

Did you happen to create an app for this @LRvdLinden ? I too am interested in a “random lights” app to simulate being home when away 🙂

---

<div class="post-metadata">

**Author:** ![dsdevries](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dsdevries/32/80220_2.png) [@dsdevries](https://community.homey.app/u/dsdevries)\
**Post date:** [October 21, 2024, 4:20pm UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/9 "2024-10-21T16:20:49Z")

</div>

Programming your lights to randomly turn on and off, even with some scheduled idea behind it to scare away burglars is a dumb idea imho. Many people program stuff that just doesn’t make sense at al. Like turning on the lights after sunset and leaving them on all night. Who in the world leaves their lights on at night when you are home and sleeping? If where a burglar and come across a house where the lights go on randomly some time after sunset and then stay on the entire night, i definitely pick that house as a target!

What I instead suggest is to just record the light conditions of all the lights for the week before you leave, and then use that schedule for the duration of the holiday.

---

<div class="post-metadata">

**Author:** ![dsdevries](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dsdevries/32/80220_2.png) [@dsdevries](https://community.homey.app/u/dsdevries)\
**Post date:** [October 21, 2024, 4:27pm UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/10 "2024-10-21T16:27:55Z")

</div>

Btw, that shot from home alone displays perfectly how idiotic these ideas are anyway. If you’ve seen the movie, you know perfectly well that burglars just post out the neighborhood for a while, and if they see anything that just isn’t making sense to them, they’ll go in anyway!

---

<div class="post-metadata">

**Author:** ![Satoer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/satoer/32/38113_2.png) [@Satoer](https://community.homey.app/u/Satoer)\
**Post date:** [October 22, 2024, 12:59pm UTC](https://community.homey.app/t/lights-on-off-randomly-in-different-zones/90717/11 "2024-10-22T12:59:18Z")

</div>

I use a simple, inexpensive TV simulator light connected to a smart plug, which is integrated with Homey.  
[https://nl.aliexpress.com/item/1005005218821844.html](https://nl.aliexpress.com/item/1005005218821844.html)

When no one’s home, it turns on automatically after dark, creating a realistic light pattern that mimics someone watching TV. And yes, I leave it on all night. I’m confident no burglar will think, ‘Hey, that’s a fake TV because it’s 4 AM.’ Instead, they’ll probably assume someone has insomnia or works night shifts.

Most burglars are just opportunistic thieves.
