Node-Red JSON help - converting HSV/CLR Temp to RGB Values

Hey hive,

I have recently started moving to a system called Loxone, tho I am keeping HA just in the back end to keep all my zigbee/wifi devices in play (easy for me and dont wanna stuff around with moving to another platorm for zigbee).

I have pretty much all the sensor data i need passing through HA into loxone and some data going out. Mostly my HUE bulbs. Out of Loxones lighting controller if you pick a colour in the app it spits out a HSV value. When you pick a CLR Temp in the app it spits out a Kelvin and brightness value.

I was hoping I could get some help writing a script passing this data on (if HA supports it) or converting it to RGB values for HA. Bonus points for being able to get node red to choose between if its a HSV value or RGB value.

Thanks!
Screenshot 2024-12-02 at 9.08.40 pm
Screenshot 2024-12-02 at 9.09.13 pm