Wled Auto Effect Random

Hi, I am using Nodemcu Esp8266 card. I want the wled effects to change automatically. What should I do?

Save the combinations you like into presets, start the preset cycle with the range and timing you like, in the LED config page choose the use current preset cycle.

And if you want more random than that, you could make a Python or shell/cron script to cycle through effects and palettes every so often. That would run on your computer.

If it were me, I would decide that random is in the eye of the person looking at the LEDs, and not a strictly academic point of view.

I say that because the proposed solution of setting up combinations of presets that cycle automatically according to each preset is a good one.

You can schedule actions according to the day of week, time of day, and preset to start with.

With that combination, and having presets end with calling another preset, you can get some pretty random looking effect orders - from the persons point of view.

From the WLED instance’s point of view, it’s performing a repetitive task over and over again, not a random one.

If you want true random from an academic perspective, I recommend modifying an existing usermod to change the effects / palettes / speeds / intensity as you constrain them.

The random function in the C language used in WLED needs a ‘seed’ value to start randomizing things. If you use sometime to relate the seed value to time of day and current temperature or some other “noisy” data value, you can get closer to random. This in my mind is purely an academic exercise and a waste of time (unless you like that sort of thing!).

The scheduling and preset configurations in combination will probably give you something that works well enough to make you happy and pleasantly surprised often enough.

If you mate that with a home automation server or PC running random effect changes, you get a simple relatively random system that mostly feels random - except when that PC or home automation server (like a raspPI) is offline.

1 Like

Friends, I am grateful to you for your quick answers. Huggy-d1 friend, can you give me a sample application to do the operations you mentioned? Which codes will I enter where?

Please follow the steps below to have auto random effect every time the Wled boots and auto change for every 30secs.

  • Add a preset with ‘fx’ set to ‘r’ value.
  • Add a playlist with the above preset and add duration 30sec, transition 3s and repeat forever configuration.
  • Set the playlist ID to the ‘Apply preset __ at boot’ in LED preferences Defaults configuration.

You can also merge the following preset json to your existing preset json content as follows.

  • Go to Settings → Security & Update setup → Backup & Restore → Backup Preset (Click)
  • Download your existing preset json configuration and open in your computer notepad editor.
  • Merge the following preset configuration.
    { “0”: {},
    “1”: {“bri”: 125, “mainseg”: 0, “n”: “AllRandomPreset”, “on”: true, “seg”: [
    { “bri”: 255, “c1”: 128, “c2”: 128, “c3”: 16, “cct”: 127, “col”: [
    [ 255, 160, 0 ],
    [ 0, 0, 0 ],
    [ 0, 0, 0 ]
    ],
    “frz”: false, “fx”: “r”, “grp”: 1, “id”: 0, “ix”: 128, “m12”: 1,
    “mi”: false, “o1”: false, “o2”: false, “o3”: false, “of”: 0,
    “on”: true, “pal”: 0, “rev”: false, “sel”: true, “set”: 0,
    “si”: 0, “spc”: 0, “start”: 0, “stop”: 598, “sx”: 128
    }
    ],
    “transition”: 7
    },
    “2”: { “n”: “AllRandomPlaylist”, “on”: true, “playlist”: {
    “dur”: [ 300 ],
    “end”: 0,
    “ps”: [ 1 ],
    “r”: 0,
    “repeat”: 0,
    “transition”: [ 30 ]
    }
    }
    }
  • Upload the newly saved json file @ Settings → Security & Update setup → Backup & Restore → Restore presets