Matrix Theme for HABPanel

I create a rule that calculates the rgb values and sets them:


rule "TV Light"
when 
	Item gHue received update
then

	var HSBType hsb 

	gHue.members.forEach [ item | 
		hsb = item.state as HSBType
		var red = Math::round(hsb.red.intValue * 2.55)
		var green = Math::round(hsb.green.intValue * 2.55)
		var blue = Math::round(hsb.blue.intValue * 2.55)
		postUpdate(item.name + "_rgb",red.toString + "," + green.toString + "," + blue.toString)  
		logInfo("Hue","Updating Hue Colors (" + item.name + "_rgb)")
	]	

end

And corresponding item:

Color light_hue_tv "TV Strip" (gHue) {channel = "hue:0210:xxx:9:color"}
String light_hue_tv_rgb
3 Likes