Is If-Then-Else in Macros possible?

Hi Guys,

i’m stumbled to WLED a Day ago and it realy hooked me!

Now I need to work on the Weekend to get my spent Time back :wink:

Anyway, I have a question - or I need a Advice, we’ll see.

WLED will control some Background-Lights in the Livingroom. There is a Shelly-Switch that sends HTTP-Requests and I like to archive the Following:

Pressing the Switch shut Toogle LED Power. I can do that by sending &T=2, easy so far. But now it’s get tricky. I like to give it specific Preset, but only when its off.


When I have some other cool effect running I the Switch must just power off on one press. But when the Lights are off and I’m pressing it, then it needs to set the preset and power on!

My Idea is to set up a macro containing something like (pseudo)


I’m sure my problem is solvable, hoping for some help :slight_smile:


Not possible.
But it is also not really needed since preset can store complete WLED state.

Thanks for the Answer!

I see that I can store Power State, but I don’t know how to Toggle that?
My goal is like “set a preset when state is off and another preset (off) when it’s on”.
I only have one Button, one command available.

Seems not possibly, or do I miss somethink?
Any Ideas or strategies are very welcome :hugs:

The API gives very good control of segments and WLED operations, you can check it out in the docs: JSON API - WLED Project.

Also a similar question was just answered: Push button for each segment

1 Like