No announcement yet.

Looking for Event Example(s) of Randomized Lighting

  • Filter
  • Time
  • Show
Clear All
new posts

    Looking for Event Example(s) of Randomized Lighting

    What I want...and at least on an initial search I didn't find a good one...

    Randomly turn on and off individual lights in a group of lights to varying dim levels. I do have Easytrigger for defining groups if the right approach. If there were 10 lights in that group, a random number of them would be on at the same time, but all for different lengths of time and dim levels. Is there anyway for this to work in a single event (much preferred)?

    Without obligation test SceneMaster : see what you come up with.
    • I also have Easy trigger but that one eats lights for dinner

    TinkerLand : Life's Choices,"No One Size Fits All"


      I'm guessing you do not want to use a script. That would allow you to do it with one event (and one script), but it would take some effort - and probably considerable trial and error.
      Mike____________________________________________________________ __________________
      HS3 Pro Edition, NUC i3

      HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti


        Eman - Thanks! Will give that a go soon!

        Uncle Michael - I keep trying to avoid that, but will likely have break down and do it since things like creating 5 different events to accomplish something is just too confusing to come back to a year later and work on when something changes. Thanks! I'll try to be nice and not soapbox my desire too much for more switches like else if/for/while in events .


          There is a free plugin you may want to look at: The BLOccupied Plugin for HS3 will allow you to randomly simulate house occupancy by turning on lights and appliances.
          Karl S
          HS4Pro on Windows 10
          242 Devices
          56 Z-Wave Nodes
          37 Events
          HSTouch Clients: 3 Android, 1 iOS
          Google Home: 3 Mini units 1 display


            Here's another way to do it:

            Create a virtual device and trigger a recurring event every second or so that generates random numbers within your desired dim range
            (This can be duplicated to multiple VD and reused for various ranges/use cases)

            Sub Main(ByVal Parms As Object)
            ' Initialize the random-number generator. The Rnd function returns a random number. The number is always less than 1 but greater or equal to 0.
            Dim Z As Integer = Int((130 * Rnd()) + 1) ' Generate random value between 1 and 130.
            ' Dim Z As Integer = Int((101 * Rnd()) ) ' Generate random value between 0 and 100.
            hs.SetDeviceValueByRef(4466, Z, True)
            'hs.writelog ("Random","Value = " & Z )
            End Sub
            Once completed, simply use Easytrigger to fire random events, add schedule conditions and use your virtual devices to define ON/OFF and/or DIM (control a device using an expression; replacement variable; or another device value); just keep every action at least 1sec apart so that your random VDs changes values.

            Here I use a random number between 1 and 130, where 1-100 is a dim level and any value over 100 turns the light Off, you can obviously change the VD range and random triggers to increase/decrease the ON/OFF periods)

            Click image for larger version

Name:	efwewe.PNG
Views:	128
Size:	207.2 KB
ID:	1432637

            Spud provided another scheduling approach here, you can combine it with the random values:

            Also keep in mind that Easytrigger "group" concept is intended to replicate the same action to multiple devices so it wouldn't make sense to use a "group" to trigger different individual actions...

            Another feature I tend to forget:
            "Security random offset", which can be enabled/disabled via simple scripting.


            hope this helps,


              ksum - Thanks...sounds pretty much like exactly what I'm looking for and will certainly load it...

              123qweasd - I've done my best to avoid things that need scripting but it's become clear I need to start. Thanks for the info above. It's a great base example!


                ksum...just an fyi ...BLOccupied appears to do exactly what I wanted thanks.