Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best Way to Handle Triggers that get Reset
I have a motion detector outside that when triggered, turns on two TV's inside and shows the video stream. I then put in a pause() command in the event for 4 minutes, which after that time turns the TV off. What would be the best way to make sure another movement in front of the motion detector doesn't trigger the TV on/off again. Would I need to set a GVAR or use the Variables driver and have it show a variable that there is an active trigger until it finishes the pause()?

I figure there has to be a better way to do this, but could not figure it out.
The simpler way (Though I don't like it), is to use the timer driver. When it gets to 0 turn off the TV. When there is motion, reset the timer to 4 minutes.

The way I would do this ...(and I think it should be a more built-in feature myself)...

I created time variables for all of my motion sensors in the variable driver. Then, every time motion is sensed, they can the current time stamp.

Finally, run a script every 5 minutes (or execute it some other way) that says...

If "time since last motion outside < 4 minutes" and "tv is ON".
Then... turn TV off and play sirens.

Time since last motion would be a comparison of NOW minus the timestamp of the motion detector.

Another idea might be to use the logic server, but I don't have experience with that.
--Kill all the serial ports--
Some options:

Scenario 1:
- When the event is triggered, set a global variable with the off time. If that variable already exists, do nothing.
- Have a scheduled event that runs every few minutes which looks for this variable being set. If so, it sees if it's at or beyond the time. If so, it deletes the variable and turns the stuff off.

Scenario 2:
- Create a variables driver boolean field. Put a trigger on it to send out an event trigger any time it changes value.
- When you get motion start (ignore motion end), do a timed field change on the field, writing true to it and queuing up a false value for some minutes in the future. If you get more motion and do another timed field write, you'd just end up resetting the off time but that's it. The field wouldn't change value so nothing would happen other than pushing out the off time.
- Set up a triggered event to react to that change. When the field goes true turn the stuff on, when it goes false turn the stuff off.
Dean Roddey
Explorans limites defectum
I would probably use a timer (countdown) and if there is motion do a check to see if the timer is zero. If it is turn the TV on, if not don't do anything.

This should reduce the number of triggers and events running.

Alternatively, set a bit in the variable driver when you turn the TV on and then when you send the command to turn the TV off, also turn the bit off.

Use this bit as your check instead of checking for a zero countdown time.

Mykel Koblenz
Illawarra Smart Home

Possibly Related Threads…
Thread Author Replies Views Last Post
  RadioRA2 Triggers gReatAutomation 3 729 03-25-2020, 05:11 PM
Last Post: Dean Roddey
  Reconfig of Driver Causes Built In Triggers to Fire gReatAutomation 2 834 03-25-2020, 04:09 PM
Last Post: gReatAutomation
  More than 4 triggers simplextech 4 1,311 01-09-2020, 10:02 AM
Last Post: simplextech
  Triggered Event and Standard Triggers gReatAutomation 5 1,565 08-23-2019, 12:38 PM
Last Post: Dean Roddey
  reset driver statistics? rbroders 9 3,222 09-11-2018, 07:50 PM
Last Post: Dean Roddey
  Triggered event w/ multiple triggers lleo 16 6,033 06-06-2018, 06:21 PM
Last Post: lleo
  High Level Triggers and Action rules admin screen kfly 1 1,837 11-01-2017, 05:21 PM
Last Post: Dean Roddey
  are triggers reliable? indygreg 4 2,704 06-29-2017, 11:52 AM
Last Post: Dean Roddey
  COuld not update triggers znelbok 11 5,389 06-08-2017, 03:55 PM
Last Post: znelbok
  Problem with Triggers pjgregory 11 5,942 05-11-2017, 11:36 PM
Last Post: pjgregory

Forum Jump:

Users browsing this thread: 1 Guest(s)