How to convert RGB to HSB and vice versa?

How about this:

Add the following import:

import java.util.List
rule "RED DIMMER"
  when
    Item WIFI_RGB_RED received command
  then
	var int percent = 0
	if(WIFI_RGB_RED.state instanceof DecimalType) percent = (WIFI_RGB_RED.state as DecimalType).intValue 
	if(receivedCommand==INCREASE) percent = percent + 1
	if(receivedCommand==DECREASE) percent = percent - 1
	if(percent<0)   percent = 0
	if(percent>100) percent = 100
	var int red=percent
	var int green= 75
	var int blue= 55

	val List<Float> hsb = Color.RGBtoHSB(red,green,blue,null)
	val String hsbString = hsb.get(0) + "," + hsb.get(1) + "," + hsb.get(2)

	var HSBType hsbValue = new HSBType(hsbString)
        sendCommand(WIFI_RGB,hsbValue)
        postUpdate(WIFI_RGB_RED, red);
end

The Color.RGBtoHSB() method is a static method of the Color class. It returns an array of type float. The problem is that the DSL used by openHAB apparently does not handle arrays. However, it does support to automatically convert them to a List so that’s why this val List<Float> hsb = Color.RGBtoHSB(red,green,blue,null) actually works.
Next a String is created as indicated by @namraccr.
I don’t have any color lights so I can’t test, but when executing the rule and printing out the hsbString it looked ok to me.