# Macro to power toggle and load a preset

**URL:** <https://wled.discourse.group/t/macro-to-power-toggle-and-load-a-preset/2873>\
**Category:** Questions\
**Created:** [May 13, 2021, 3:09am UTC](https://wled.discourse.group/t/macro-to-power-toggle-and-load-a-preset/2873 "2021-05-13T03:09:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![docmattman](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/docmattman/32/1521_2.png) [@docmattman](https://wled.discourse.group/u/docmattman)\
**Post date:** [May 13, 2021, 3:09am UTC](https://wled.discourse.group/t/macro-to-power-toggle-and-load-a-preset/2873/1 "2021-05-13T03:09:52Z")

</div>

I have a preset with the `T=2` API command set to toggle the power. I’m using a button with a long press assigned to this preset. I have the short button press set to cycle through some of my presets for different lighting effects.

Ideally, I’d like the long button press to load a specific preset when the power turns on. I have tried `T=2&PL=1`, but that doesn’t work. Nothing happens when I press the button. I have also tried `PL=1&T=2` which also doesn’t work.

Anyone know if it’s possible to apply a specific preset in combination with the power toggle command?

---

<div class="post-metadata">

**Author:** ![dgk](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dgk/32/1852_2.png) [@dgk](https://wled.discourse.group/u/dgk)\
**Post date:** [August 16, 2021, 4:24pm UTC](https://wled.discourse.group/t/macro-to-power-toggle-and-load-a-preset/2873/2 "2021-08-16T16:24:59Z")

</div>

The issue is I can’t really find any documentation on API string commands just one off stuff here and there.

Anyway I’m trying to do the exact same thing.

I’ve tried

`T=2&P=1` where 1 is my max white preset. This doesn’t work since obviously I’m stabbing in the dark with P for preset.

So someone please help us some help here but better yet a link to full documentation of the API string commands.

I’m wondering if this can only be done with JSON?

---

<div class="post-metadata">

**Author:** ![dgk](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dgk/32/1852_2.png) [@dgk](https://wled.discourse.group/u/dgk)\
**Post date:** [August 16, 2021, 4:38pm UTC](https://wled.discourse.group/t/macro-to-power-toggle-and-load-a-preset/2873/3 "2021-08-16T16:38:00Z")

</div>

setting the state fully works but i’d like to know how to use a preset here.

`T=2&R=0&G=0&B=0&W=255&A=255`

---

<div class="post-metadata">

**Author:** ![dgk](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dgk/32/1852_2.png) [@dgk](https://wled.discourse.group/u/dgk)\
**Post date:** [August 16, 2021, 6:12pm UTC](https://wled.discourse.group/t/macro-to-power-toggle-and-load-a-preset/2873/4 "2021-08-16T18:12:05Z")

</div>

I came up with a better solution for this using short and long press and a couple single color presets.

> [@Looking for help with button actions](https://wled.discourse.group/t/looking-for-help-with-button-actions/2863/9):
>
> Well I found the solution in an issue. The syntax is close. put win&P1=1&P2=4&PL=~ in a preset (in your case in 51), then set that id to short and id for preset that has T=2 to long press. Really this issue is there is no documenation for the API and its syntax.
