I seem to get two notifications

When my mudroom is unlocked, I have code here that checks to see if a V-switch is set called "autolock" , if its on, I want it to lock the door, otherwise, I would like to get a notification .

but for some reason, I get two notifications that are the (could be more) not sure why.

Can anyone see why. I have several ELSE-IF's , am I supposed to end each one some how?

The biggest thing that stands out to me in your rule is this: nothing really makes these notifications happen if the lock stays unlocked for 10 minutes. Rather, all of these actions happen 10 minutes after the door unlocks, each and every time, regardless of whether you lock it in the meantime. Additionally, even if you unlock multiple times within 10 minutes, you'll get a notification for each, not just the one from the most recent event. Could this explain what you see? (You didn't mention how fast the "duplicate" notifications are coming in or what notifications these are. Those could be clues to help.)

Structurally, your rule looks fine. To specifically answer your question on ELSE-IF, that structure is indeed correct. To address the above concern, this classic paradigm would work:

Trigger events: Mudroom lock *changed*

Actions:

IF (Mudroom Lock is locked) THEN
  Cancel Delayed Actions
ELSE
  Delay 0:10:00 (cancelable)
  IF (Front Door Auto Lock is on AND Mudroom Sensor open) THEN
    Notify "Door is open and will not lock"
  ELSE-IF (Front Door Auto Lock is on) THEN
    Lock: Mudroom Lock
  ELSE
    Notify "Autolock is off. Mudroom door will not be locked.
  END-IF
END-IF

The last half of the actions is basically what you already have, but it's all encased in another IF THEN to test the lock state, and both lock events trigger this rule (changed = locked or unlocked). If it's locked, the delay (and all actions after it) are cancelled--the "Cancel Delayed Actions" action. The other piece is checking "cancel?" (or "cancelable") on this delay so the "Cancel..." action actually applies to it.

2 Likes

I think that might be in. I was thinking that myself,, (I really do not know how often the second or more messages game in) I actually did not know how to cancel it. this was happening as I went in and out of the house into the shop.. so I will test this out. thank you.