In the latest version (2021.8) the wled set preset service is being deprecated. Its been replaced with a more flexible “select” entity and service. I use presets with my WLED devices quite a lot - and particularly through Node Red - set them to a variety of states depending on events. I couldn’t immediately see a clear example of how to quickly make the change …so here it is.
Old Service example…
service: wled.preset
target:
entity_id: light.wled_server2
data:
preset: 3
New Service example…
service: select.select_option
target:
entity_id: select.wled_server2_preset
data:
option: Preset 3
Note the option is the name of the Preset - so could be “Blue” etc if thats how you’ve named the presets.
I actually used the fact the original preset service used an integer in Node Red to quickly select a random preset based on a generated random integer. As the select entity has the preset names in a list already, you can use this to template a random selection in HA…
{{ state_attr('select.wled_server2_preset','options') | random }}
In Node Red I can use a current state node to extract the same “options” attribute and pass that through a random-item node (add “node-red-contrib-random-item” to the palette). For that node use “msg.data.attributes.options” as the input and output the (randomly) selected preset name to the payload.
A standard service node can use that as normal by using the payload as the text for the option under Data for the service.
Hope the above helps someone else looking to make the transition.