Hue Ambientlight Sensor

binding
items
Tags: #<Tag:0x00007fe05d8c6ac8> #<Tag:0x00007fe05d8c66b8>

(Roland Mayr) #1

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


(Vincent Regaud) #2

Please edit your post with code fences. Thanks


(Christoph Weitkamp) #3

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) {
...

(Roland Mayr) #4

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


(Christoph Weitkamp) #5

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


(Roland Mayr) #6

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


(Vincent Regaud) #7

Please tick the solution mark under the relevant post, thanks