I want to extract Brightness from a HSB Type and vice-versa.
This rule works:
rule "Adjust sideboard brightness from HSB"
when
Item TV_sideboard_Color changed
then
val TV_sideboard_bri = (TV_sideboard_Color.state as HSBType).getBrightness()
if(TV_sideboard_bri != TV_sideboard_Dimm.state)
{
TV_sideboard_Dimm.postUpdate(TV_sideboard_bri)
}
end
But:
Changing only the third value of a HSB won’t work.
This was my approach:
rule "Adjust sideboard HSB from brightness"
when
Item TV_sideboard_Dimm changed
then
val TV_sideboard_hue = (TV_sideboard_Color.state as HSBType).getHue()
val TV_sideboard_sat = (TV_sideboard_Color.state as HSBType).getSaturation()
val TV_sideboard_bri = (TV_sideboard_Color.state as HSBType).getBrightness()
if(TV_sideboard_bri != TV_sideboard_Dimm.state)
{
TV_sideboard_Color.postUpdate(TV_sideboard_hue,TV_sideboard_sat,TV_sideboard_bri)
}
end
Why am i doing this?
Using the brightness value of the DMX Binding won’t work for me.
It only fades from white to black.
So the color is lost (H/S Value of HSB)
Many Thanks