Segment fade-on / fade-off

I’m struggling with what I imagine is a fairly simple issue to solve, but just can’t figure out an elegant solution…

My WLED setup has two segments and I’m controlling it remotely via the JSON API. When I turn each segment On or Off, I’d like the LEDs to fade to / from black, like you get when toggling the UI Power button for the whole system. Unfortunately, turning an individual segment On or Off doesn’t use a fade. Changing the segment brightness results in a clean fade, but not if you change the brightness to 0.

Has anyone found an elegant method of getting individual segments to fade On / Off?

Have you tried setting the brightness to 1 first and then the target value?

Thanks @Carnifex. Yes, that’s what I’ve been trying. It just seems like a fairly intelligent solution having to queue up multiple JSON calls. I also wasn’t sure how WLED handled multiple API calls coming in quick succession (e.g. when the second one arrives while the transition for the first one is still active).