How to configure motion sensors (PIR's)

Hi,
your rule turns LED on with every change of the motion sensor. This means, the LED is switched on by detection of movement AND is switched on by detection of no movement.
You need your rule to differentiate between turning on and off.

rule "Motion detected, turn LED on"
when
  Item MotionSensor changed from OFF to ON
then
  RaspiLED.sendCommand(ON)
end

rule "no Motion detected, turn LED off"
when
  Item MotionSensor changed from ON to OFF
then
  RaspiLED.sendCommand(OFF)
end

Sometimes you get in trouble with using sendCommand action, so it is advised to use the method of your item. (see sendCommand() Documentation)

Andreas

1 Like