Author Topic: Random timer  (Read 112 times)

Offline nickman2025

  • Full Member
  • ***
  • Posts: 116
  • Karma: +2/-3
Random timer
« on: September 08, 2017, 11:28:17 am »
For Halloween, I have a Thunderstorm strobe light. The annoying thing is it is constant and doesn't simulate a storm very well. I was hoping somebody could help me as I have a Z-wave outlet that I would like to plug it into and make it randomly stay on from 1-4 seconds and randomly stay off for 6-10 seconds or so.

TIA

Offline sebby

  • Full Member
  • ***
  • Posts: 176
  • Karma: +5/-3
Re: Random timer
« Reply #1 on: September 08, 2017, 02:41:54 pm »
i use the fantastic plugin "countdown timer" and give it a random duration.  Something like this:

Code: [Select]
luup.call_action("urn:futzle-com:serviceId:CountdownTimer1", "SetTimerDuration", { newDuration = math.random(120,500) }, TIMER_DEV)

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9563
  • Karma: +728/-135
    • RTS Services Plugins
Re: Random timer
« Reply #2 on: September 09, 2017, 12:09:26 pm »
You could do this with PLEG

A schedule name Lightning with Interval On  1 sec + random 3 secs, Off Interval 6 Sec + ran 4 sec.
A schedule for NightDisplay    (On Sunset + 30 minutes,  Off at 22:00:00)

Then a condition:
LightOn   Lightning and NightDisplay
LightOff   !LightOn

Action for LightOn  - Turn on the light
Action for LightOff - Turn off the light