Macros

Info

Also see Presets for 0.11.0+.

You are able to set custom actions ("Macros") in Time & Macro settings for the following events:

  • Specific time of day
  • Button short/long/double press
  • HTTP API call executing a macro with "&M="
  • Alexa On/Off
  • Countdown over
  • Timed light duration over
  • Device (re)boot (up to 0.10.2, use LED settings Boot preset in 0.11)

Each macro has the format of a standard HTTP API call without the IP. Optionally, the "win&" may be omitted. For example, the macro "A=255" sets the brightness to maximum. "R=255&G=160&B=0" sets the color to orange. You can specify up to 16 macros. (up to 250 in WLED 0.11 since the Macro functionality has been merged into the Presets feature)

Examples of how to use API-calls and define macros can be found in this issue and in this one.

The simplest macro example is getting a button to do your bidding. The default pin to which a button can be connected is GPIO 0 (D3 on NodeMCU, D1 Mini and others). This pin is ideally pulled high to 3.3V with a 10k resistor and the configured macro executes when the pin is pulled low (grounded). The desired macro is entered on the Time/Macros configuration page and then assigned to a short, long or double press. Like this: how to wire a button to D3 and set up a macro

The "T=2" macro toggles power to the LEDs (in this case long press). The "FX=~" macro steps through the effects (in this case short press).

You can set a preset to "win&P1=1&P2=3&PL=~", enter the preset number for your button, and this will step through presets 1 and 3. Change the "3" to whatever your highest preset is that you want to include.

The default (built-in) actions for Button 0 are short-press: toggle on/off and long-press: select random color.

Back to top