JSON API issue with random selection in range

Hey all,

Thought this would be an easy task but it’s stumped me.

Want to have a preset (tied to a physical button) that selects a random preset. According to the docs, this should do it:

{"ps": "4~10~r"}

The documentation claims this will select a random preset between presets 4-10, but the behavior I see is simple incrementing, from 4 up to 10 in order. Has anyone gotten this “random within range” behavior to work correctly?

Justin

Not sure where did you see that but like you I see incrementing only with
{“ps”:“4~10~r”}

But what worked for me is HTTP format same as below ( did not try with button though)
PL=r&P1=4&P2=10

1 Like

Should have worked a bit longer with the HTTP format before getting frustrated.

This worked! Thanks so much!

For reference, this is the text from the documentation I was having the issues with:

https://kno.wled.ge/interfaces/json-api/

Overview of values

State object

ps:

“ID of currently set preset. 1~17~ can be used to iterate through presets 1-17, or 4~10~r to select random preset between presets 4 and 10 (inclusive).”

Yeah that is not correct even if it is in kb