Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openhab.core.library.types.*
- rule "Set RGB value RGBLed"
- when
- Item RGBLed changed
- then
- val hsbValue = RGBLed.state as HSBType
- val brightness = hsbValue.brightness.intValue
- val redValue = ((((hsbValue.red.intValue * 255) / 100) *brightness) /100).toString
- val greenValue = ((((hsbValue.green.intValue * 255) / 100) *brightness) /100).toString
- val blueValue = ((((hsbValue.blue.intValue * 255) / 100) *brightness) /100).toString
- val color = redValue + "," + greenValue + "," + blueValue
- sendCommand( RGBLedColor, color)
- end
Advertisement
Add Comment
Please, Sign In to add comment