Motion? Turn lights on for x minutes

Onze verontschuldigingen, dit bericht is alleen beschikbaar in het Amerikaans Engels en Frans. Voor het gemak van de kijker, is de inhoud hieronder weergegeven in de standaard taal van deze site. Je kunt op een van de koppelingen klikken om de taal van de site naar een andere beschikbare taal te veranderen.

Below you can find a basic example of my rule for automatically controlling the lights.
I have a Fibaro motion sensor and a Fibaro Wall Plug (both can be found in our store).

Main idea: if it’s dark outside and motion is detected, I want to turn on my lights for 20 minutes.
If during these 20 minutes new motion is detected, reset the timer and keep it active for another 20 minutes.

Additional rule: if it’s after midnight, I do not want to turn the light on for 20 minutes, but only for 3 minutes.

PulseStation_-Blocky-motion

 

First I’m checking whether it’s dark already, the lights do not need to go on during the day.
For this I use the yahoo weather device, to get the sunset and sunrise.
During sunset and sunrise (dark), I verify if motion is detected in the last purple block.
If it’s both dark and motion is detected, I do following:
1) I turn the light on
2) I put a timer to turn the light off again in a few minutes (if no new motion is detected).

In 2 I added an additional if to make the time shorter if it’s after midnight.
Chances are slim that I will still be working so late, probably I just need to take something out of that room.
So the lights go out after 3 minutes already instead of 20 minutes.

Note: I have one more condition in the first IF, I also verify whether the light is not already turned on.
This way less checks need to be done, because it will not execute all the additional checks if the light is already on.
It’s not required, just me trying to save a millisecond of processing time