Increment/decrement presets via API?

I’m building a hardware control surface for a WLED installation, and I want to be able to use it to increment/decrement presets. Seems straightforward, but for some reason it isn’t.

The controller will be an ESP32 on the same network, connected to buttons/potentiometers/etc. It will send commands to WLED via API. It’s too far to run wires. WLED will have a static IP so it’s OK to hard-code the IP in the ESP32 code.

I can activate a specific preset just fine:
curl -X POST “http://192.168.4.56/json/state” -H “Content-Type: application/json” -d “{"ps":2}”

But incrementing has no effect (returns true, but does nothing)
curl -X POST “http://192.168.4.56/json/state” -H “Content-Type: application/json” -d "{"ps":"~-"}

HTTP api works, but only loops between presets 1-5 for some reason (there are more).
curl “http://192.168.4.56/win&PL=~

I’ve experimented trying to manually query the current preset and then setting explicitly, but that is slower and inconsistent. I’d like to just increment/decrement from whatever the current preset is, regardless of how many presets there are, and automatically loop around when you hit the start or end of the preset list.

This may be easier if I put the presets in a playlist, but I don’t want the presets to change automatically, only when triggered.

Worst case, I could install WLED on the remote control ESP32, and use the built-in button controls and use the sync functionality to drive the remote unit. But that limits me to the four buttons exposed in the UI.

Is there a way to do this reliably via API?

" ID of currently set preset. 1~17~ can be used to iterate through presets 1-17"

and yes, this works as I am using it all the time.