Local End Point and retriggers before turning light off

I setup Blue Iris to send a local end point to hubitat to turn on a light and this works as expected. But then I need the light to turn off after X minutes which also works as expected. But how do I keep the light on if motion keeps happening? It doesn't see the additional triggers and start the counter over. I'm using RM.

What you're running into is how "Delay" works in Rule Machine. It is not cancelled unless you do so explicitly, usually by marking the "cancel?" option on it and running a "Cancel Delayed Actions" action somewhere (here I'd do it it either right before or after the "On" action--shouldn't matter too much either way). Alternatively, you could use a "Wait for events: elapsed time --> 00:01:00" before the "Off" instead of a "delay" on (or before) the "Off." Waits are cancelled any time a rule re-triggers, so that's usually less clicking.

But something else to consider: does Blue Iris hit this endpoint over and over as long as motion stays active? If so, it should work as you expect. But if not, what you'd really want is to know when motion goes inactive and start the countdown then. If your only option is hitting an endpoint, you'd probably need a separate rule for "on" vs "off" (and a delay, which, unlike a wait, there is a way to cancel from another rule, or some other way to handle this situation).


Got it working thank you! Blue Iris can send out on motion activated and motion ended seperatley. So i set up 2 rules, 1 turns lights on. The other Waits for event elapsed time 15 mins and then turns the light off. This works perfect. I lf i go out there within that 15 mins it resets the timer again. So thanks again, you rock!

Glad you got something working! Did you find a way to make the "active" event cancel the "inactive" event actions? A different rule (re)triggering won't affect anything in the other rule unless you do something yourself.

Here's what I did and it worked the first time I tried it. I made 2 separate rules with 2 separate local end points. Blue Iris sends one end point to trigger lights on and a different end point to turn them off.

Ah, then I still think you're missing a piece. Consider what happens if the "inactive" endpoint is hit, then motion starts again and the "active" endpoint is hit: nothing stops the "Wait" in that second rule from ticking down and eventually turning off the light (unless motion becomes inactive again during that time period, which starts this over, but what you really want is for activity to erase this countdown).

My suggestion would be to rewrite the first rule like this:

IF (Time between sunset-30 and sunrise) THEN
  Cancel Timed Actions: Patio Lights BI Off
  On: Patio Lights

Here, "Cancel timed actions" (formerly "Cancel rule timers" if you see that anywhere) lets you choose a different rule and unschedule pretty much everything there. In most cases, it's a bit overkill, but since your "Wait" is the only timed thing in the other rule, it should be fine (it would also get delays--regardless of whether they're marked as cancelable--and periodic triggers, among other things the UI warns you about when you use it).

I also added an "END-IF" because it's good form, but in this case RM will infer everything fine anyway. :slight_smile:

1 Like

I see what your saying. My test worked but there were only 2 active /inactive periods. If motion had been constant for 15 mins it would have shut off. Ill play with this some more when i get a chance. Thanks again

Another wait to achieve this would be to use a virtual motion sensor with a switch (available on Github) which would then enable you to use the built in apps such a Motion Lighting Apps or the Motion Lighting Apps Plus which is community based and, in fact, way better. I use MLAP for all my lighting automation, it gives you the option to 'Dim to warn then turn off' which is perfect.