I have a motion sensor in my entrance hall way as well as a couple of lamps on a table so I connected the lamps to a
relay with a
wireless switch and then wrote a rule to switch the lamps on between 9pm and 7am when motion is detected. Now when I walk in the passage way at night the lamps come on, and then switch off when there has been no motion for 10 minutes.
Switch the lamps on:
IF Sensor open AND
Hour of day is between 20 AND 7 AND
Sensor = Hall Motion Detector
Then RF Relay On
Switch the lamp off:
IF Sensor closed for x minutes where x equals 10 AND
Sensor = Hall Motion Detector
Then RF Relay OFF