[SOLVED] Trigger for Motion Sensor

Hi,

I’m using the HUE motion sensor for switch on/off my lights in the kitchen.
Therefore I have written the following rule, which works fine.

Number hueMotionSensorLight "Lichtstärke [%.0f]" <blinds> (gSchlafzimmer) { http="<[http://192.168.178.22/api/UV-1U1A-5Ko0/sensors/14:300000:JS(getHueLight.js)]" }
rule "Motion Sensor Kitchen ON"
when
    Item KMotionPresence changed to ON
then
    if(KMotionSensorLight.state <= 4){
        logInfo("RULE", "Motion Sensor Kitchen ON")
        LightRoofKueche.sendCommand(ON)
    }
end

rule "Motion Sensor Kitchen OFF"
when
    Item KMotionPresence changed to OFF or
    Item LightRoofKueche changed to ON
then
if(LightRoofKueche.state == ON){
    logInfo("RULE", "Motion Sensor is waiting")
        Thread::sleep(60000)
        if(KMotionPresence.state == OFF){
            Thread::sleep(30000)
            if(KMotionPresence.state == OFF){
                 logInfo("RULE", "Motion Sensor Kitchen OFF")
                 LightRoofKueche.sendCommand(OFF)
            }        
        }
}
end

I’m measuring the light level every 5 minutes, my Problem is within my rule I’m asking,
if the light level is less then 4. What I would like to do, is sending a “tigger” to the motion sensor once the light switches off, so that the light level is getting refreshed. Because in “worth case” I have to wait 5 minutes for the light before it will be switched ON again :slight_smile:

Hope you understand what I mean :slight_smile:

Thanks

Solved! I found the answerer with in an tutorial from @cweitkamp

Please mark as solved.

Great that you find a solution, could you share it, or put a link to it?