Hue Ambientlight Sensor

Hi All,
I just discovered that my Rule with the Hue Ambientlight Sensor is not working if the Item linked to the Channel is not configured right.
My Rule

var Number counter = 0
var Number lastCheck = 0
    
rule "eingangOn"
         when   
                 Item HueMotionSensor1_Bewegung changed from OFF to ON
         then   
                 counter = counter + 1
                 if(HueAmbientLightSensor1_Beleuchtungsstaerke.state < 40 && Early_Close.state == OFF) {
                         sendCommand(SonoffLED_LichtEingangLED, ON)
                 }
 end 

The Type of my Item was Number:Illuminance
It took a while to find out that the Type of the Item should be Number only.

To display the Illuminance on the Sitemap i use the Number:Illuminance Item in order to get the lx ending.

Hope that helps others
Roli

Please edit your post with code fences. Thanks

Hi Roland,

May I ask why you do not check against an “lx” value instead of switching back to pure Number item?

...
    if(HueAmbientLightSensor1_Beleuchtungsstaerke.state < 40|"lx" && Early_Close.state == OFF) {
...

Hi Christoph
Actualy im not that experienced in coding, and i didn´t know that this is possible.
All i know about OH2 i learned from the Community.

Thanks for broading my horizon. :hugs:

Roli

Alright. Then you might want to give it a try. :smile:

Already done, and it works like ist should. :+1:

Please tick the solution mark under the relevant post, thanks