Scripting variable PIR (extend time when triggered)
Posted: Friday 10 July 2020 23:24
Dear Domoticz users,
I am using Domoticz for several years now, and i'm very satisfied.
Currently i have a dusk sensor that turns several lights on automatically.
There are also some lights in the back of the livingroom that are only switched on when a PIR detects movement.
What i currently have is this blockly script:
Explanation:
BM (=BewegingsMelder) is my PIR
VL (=VerLichting) is a lamp
The script checks if the lamp at the TV cabinet is on (which is always on when it's dark outside).
If that's the case and the PIR detects movement, it will turn on the light at the dining table (VL-Eettafel) and the other one in the back of the living room.
During the time we will possibly have dinner, the light at the dining table stays on for a longer period.
This is to be sure that the light stays on as long as we have dinner and we don't have to 'wave' to the PIR.
After 8.00pm we usually don't sit at that table anymore, so the light can be turned off much earlier.
That's why i set different delays in the script.
Well, after this very long introduction, i want the script to be a little smarter. But i think i'm not smart enough to achieve that. Maybe someone here can help me out?
(doesn't have to be Blockly. If it can be done another way, that'd be fine with me. But i'm not so good at scripting)
What i want is this:
If one of us walks by occasionally, i want it to turn on the light for - say - 1 minute and then turn off again.
If the PIR gets triggered again within that minute (or shortly after that minute) it's possible that one of us is working at the table.
So i want it to stay on for a longer period. Maybe prolong the time to 3 minutes and if the next trigger is within or short after 3 minutes, prolong it to 6.
Not sure if my explanation is clear and if it is possible to do something like this?
I hope someone can help me with it
I am using Domoticz for several years now, and i'm very satisfied.
Currently i have a dusk sensor that turns several lights on automatically.
There are also some lights in the back of the livingroom that are only switched on when a PIR detects movement.
What i currently have is this blockly script:
Explanation:
BM (=BewegingsMelder) is my PIR
VL (=VerLichting) is a lamp
The script checks if the lamp at the TV cabinet is on (which is always on when it's dark outside).
If that's the case and the PIR detects movement, it will turn on the light at the dining table (VL-Eettafel) and the other one in the back of the living room.
During the time we will possibly have dinner, the light at the dining table stays on for a longer period.
This is to be sure that the light stays on as long as we have dinner and we don't have to 'wave' to the PIR.
After 8.00pm we usually don't sit at that table anymore, so the light can be turned off much earlier.
That's why i set different delays in the script.
Well, after this very long introduction, i want the script to be a little smarter. But i think i'm not smart enough to achieve that. Maybe someone here can help me out?
(doesn't have to be Blockly. If it can be done another way, that'd be fine with me. But i'm not so good at scripting)
What i want is this:
If one of us walks by occasionally, i want it to turn on the light for - say - 1 minute and then turn off again.
If the PIR gets triggered again within that minute (or shortly after that minute) it's possible that one of us is working at the table.
So i want it to stay on for a longer period. Maybe prolong the time to 3 minutes and if the next trigger is within or short after 3 minutes, prolong it to 6.
Not sure if my explanation is clear and if it is possible to do something like this?
I hope someone can help me with it