motion sensor triggers script to often

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
AriePiet
Posts: 9
Joined: Saturday 30 March 2024 12:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

motion sensor triggers script to often

Post by AriePiet »

Hi guys,

I have a motion sensor (pir) connected to a wemos, it sends t's dat to Domoticz, works perfect. On Domoticz i havesetup a switc (motion sensor) and when activated it should run a script.
The script start a camera record for 5 minutes. So far so good!

But when during this 5 minutes the switch is activated again, the scripts runs again after the first run.

Is there a way to surpress this? Thus after the inital trigger the motion sensor should be ignored for a predfined time?
User avatar
jvdz
Posts: 2359
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: motion sensor triggers script to often

Post by jvdz »

What is the script that you use?
You could test in the script for the time passed since the last change and when that is less than 5 minutes you skip the recording.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
waltervl
Posts: 6014
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: motion sensor triggers script to often

Post by waltervl »

And you can do that for example with code example:

Code: Select all

if (domoticz.devices('My PIR').lastUpdate.minutesAgo > 5) then
      -- your code to record camera for 5 minutes
end
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest