Need help with door announcement RM4

New here so excuse me if I set this up wrong. I am wanting to set up a notification for when a door is opened. However, I want there to be a 3-minute window where it won't fire if the door is opened again. I have it announcing through the chrome cast integration app to a google home mini.

I have the announcement working fine, however, I am unsure on how to set up the delay portion. Thanks so much for the help!

I can't post pictures so the way I have it set up is as follows:

Trigger Events: Kitchen Door, Living Room Door any open

Actions:
If (Kitchen door, Living room door, any open (F) AND Mode in Day, Night
THEN Speak on Bedroom speaker. '%device% Opened'

Welcome to Hubitat! What you're asking for requires something to keep track of the fact that the announcement has happened. Now, the first question I have, is the announcement blackout period specific just to one of the doors? For example, if the kitchen door is opened and a minute later the living room door is opened, would you want the announcement to play?

For the purposes of this example, I will assume that you do not want it to replay. So, the rule would be like this:

Trigger:  Doors opening

Action:
If Private Boolean True  Then:
     Set Private Boolean False 
     Set Private Boolean True after a delay of 3 minutes
     Send notification that "%device% has been opened".
End-IF

Private Boolean is just a variable that is available in the structure of Rule Machine for every rule. It can be changed from other rules but can only be read by the rule itself. This allows any triggers that occur during the 3 minute blackout to be ignored.

1 Like

Ryan, that is helpful! The Private Boolean confused me a bit but after seeing this example I think I have a better grasp on it. The rule works as you have shown it.

If I did want it to trigger for the living room door if it was open within the 3 minute time frame, what would I need to change on the rule provided to allow that?

Thanks again!

I think you want to set PB true outside of the IF. Also, the OP wants to limit the rule by mode. Maybe this:

Trigger:
  Kitchen Door, Living Room Door either open

Action:
  IF (NOT in Mode Day, Night) Exit Rule
  Set Private Boolean True --> delayed 0:03:00
  IF Private Boolean True THEN
    Send notification
    Set Private Boolean False
  END-IF

If you want to cancel the notification if the door is closed, then you'd want to used changed for your condition, and after the 3-minute delate check to see if a door is open before setting the PB to true.

ETA, actually, you really only need the PB if you want to cancel depending on the door state. If you always want the notification if the door opens, you could use a simple delay.

No, you only want to set it true right after it is set false. This will not work the way you intended. This will set it true early if it is set false because you can have multiple delayed actions. Doing it this way will result in it becoming true early if there are multiple messages.

Example

Time 0 Door opened --- Announcement made & True schedule for minute 3 & set False
Time 2 Door Opened -- No announcement but true scheduled for minute 5
Time 3 min - True Set
Time 3:30 Door Opened -- Announcement made & True scheduled for 6min 30 sec. & False set
Time 5 - TRUE SET (this is occurring 90 seconds early.
Time 5:30 - ANNOUNCEMENT MADE WHEN IT SHOULDN'T.

Trust me. If you want there to be a static 3 min delay no matter what, schedule it when you perform the action setting it false.

OK. I read the OP again, and for some reason I had thought that the OP wanted the announcement delayed 3 minutes. DUH I now see that the announcement should be immediate, but not again for 3 minutes. Got it.

But in playing around with your very excellent example, I ran into a scenario where I'm not sure about it. I set up a test rule using switches instead of doors.

Scenario:

  • Switch 1 on
  • 1 minute later Switch 2 on
  • 1 minute later Switch 1 off

The announcement was made for door 1. But, after the 3 minute pause, Switch 2 is on, but no announcement is made because it was turned on during the pause.

Here's my rule:

And here's the log:

If the desire was to have the announcement made for each door, do you think the best solution would be to set up a separate rule for each?

Yes, that's why I say here:

If you do want it to door specific, the easiest thing to do would be to have one rule per door.

1 Like