Help with Hue colour Rule

Whenever BULB6LRMAIN1_Color changes state

if the brightness value of BULB6LRMAIN1_Color’s HSB value is 0 sendCommand OFF to Main1_LR_Trigger.

It works thanks for that Rich

i was having the same problem but in reverse if someone turns on the light from app or GH the button doesent light expected again but would be nice to fix

is it as simple as using the same code but using => 0 then send Command ON (this just run my rule thinking about it and set the light to the value in the rule )

thats what is confusing me i dont understand where you just pulled this fiqure/command from


I know that the Item is a Color Item. Looking at I see that Color Items can accept commands as a bunch of different types but HSB is the only one that can represent Color. So the state of a Color must be HSBType.

Further down the page I find the section that describes HSBType.

This same page also has a table showing what state each Item stores.

I don’t know if “as” is explained anywhere in the OH docs because it’s is a standard language commands that lets you tell there languages what type (each object can be multiple types) you want to use an object as. By default when you call .state you just get a State typed object. But we know it is a Color Item and we want to use data and methods that are specific to HSBType so we cast it to HSBType using as.

More examples are here:

1 Like