Mqtt rgb led string

Wow. Homeassistant is the thing I’ve been ad-hoc developing for a few years and I’ve been pleased to find HA does almost everything I want. So thank you!

I have my own USB powered Wifi sensors and controls that I’ve built and they use MQTT… One of my things is a Wifi Night-Light. I’ve managed to configure HA to turn the nightlight on/off but I would like to send RGB values. The topic accepted by my nite-lites is as such:

XXRRGGBB where “XX” is the number of LEDs in the string (because it supports arbitrary numbers of WS2812b LED’s). RR/GG/BB are in the format “%02x”.

I’m having trouble understanding how to setup the value template. Can someone lend a hand?

In case anyone is interested, here’s a photo of one:

platform: mqtt
name: “Backdoor nitelite”
command_topic: “nitelite3/out/led”
rgb_command_topic: “nitelite3/out/led”
rgb_value_template: “{{ “02%02x%02x%02x” | value }}”
qos: 0
payload_on: “02ffffff”
payload_off: “02000000”
optimistic: true