Cancel delayed actions

Hi, I've reduced the CDA to 15 seconds to speed things up. However, when my motion sensor becomes inactive, if I create motion straight away the dashboard tile displays motion but my lights still turn off after 15 seconds. Can anyone help please, I can't understand why the motion isn't cancelling the CDA?

need to see the trigger. maybe put cancel delayed before the turn on..

looks the same as mine though what do the logs show.

also 15 seconds may not be enough depending on how quick your sensor changes state.

The biggest possible issue here looks like the fact that the IF THEN... half of your conditional depends on more than just motion becoming active to run the "Cancel Delayed Actions." For example, even in your screenshot above, you can see that motion is/was currently active, but those actions still won't run because the illuminance sensor is reporting a value outside your specified range. Perhaps you intend to restrict just the "On" action to that condition, maybe something like:

IF (Mode in X, Y, Z AND Motion active) THEN
  IF (Lux sensor < 30) THEN
    On: Lights
  END-IF
  Cancel Delayed Actions
ELSE-IF (Mode in X, Y, Z) THEN
  Off: Lights --> delayed 0:05:00 (cancelable)
END-IF

There is also a new-ish paradigm staff have been suggesting for this kind of automation, if you're interested, which both frees you from needing to cancel delays ("Wait"s work differently) and from checking the sensor state (due to the different trigger). Doesn't really make this rule much simpler to write, but for the sake of demonstration:

Trigger: Motion active

Actions:

IF (Mode in Away, Day, Evening, Holiday) THEN
  IF (Lux sensor < 30) THEN
    On: Lights
  END-IF
  Wait for event: Motion inactive
  Wait for event: elapsed time --> 0:05:00
  Off: Lights
END-IF

Note that neither of these automations will turn off the lights if the lights were turned on in one of the specified modes but then the mode changes (to something besides the one you specify) and motion becomes inactive. This is not necessarily a problem and is how a lot of apps work, but I personally don't restrict the "off" half of most of my automations because I want to avoid leaving things on by this kind of accident. Your preferences, of course, may vary.

I don't see how the wait solution works.

So the lights get turned on and you wait for inactive motion which could happen in seconds. Then you wait 5 min. But during that time you have motion again so you start a new wait for inactive motion but isn't your 5 minute timer from the first occurrence still running so it would shut off sooner than desired?

Just saw in another post that triggers cancel waits so that explains that. Disregard my last post. :smiley:

2 Likes

@bertabcd1234 thanks for your help with this. I've managed to get it working as expected. I added a final IF at the end as the 2 waits wouldn't work without.