Detecting whether "wait for" timed out or was triggered by an event

I have a rule where I'm waiting up to 60 minutes for a motion sensor to be triggered. The actions I take next would be different depending upon whether I dropped through the "wait for" due to a trigger event or a timeout. Is there a way I can detect that? Or is there a different way of writing it that doesn't use the "wait for event"?

Here is the pseudologic for what I'm trying to do:

Turn on notification device (signal on Inovelli switch).
Turn on "mail received" virtual switch.
Turn off notification device by 60 minutes or 1st motion detected.
Turn off "mail received" virtual switch when 1st motion detected (no timeout).

Yes, the value of the built-in device variable will be set to "timeout" if your timeout expired, as opposed to the event happening (either the wait event or another trigger). See: Rule 5.1 | Hubitat Documentation

To use it, you'll have to assign it to a "real" string variable first, then you can use it as part of expressions to test its value like you can with any variable.

There could be another way to write this, too, but it would be eaiser to say with a screenshot or text of your entire rule, plus a description of exactly what you want to happen (not unlike the above, but I'm not sure what starts it all).

Here's the current rule. The mail carrier opens then closes the mailbox, triggering the initial part of the rule. The private Boolean ensures the rule gets triggered a maximum of once per day.

Opening and closing the mailbox indicates the mail has arrived. When I open the mailbox next, that should stop the notification and turn off the hub variable "Mail Arrived". However, the notification on the light switch annoys my spouse, so I want that to turn off within 1 hour even if I haven't gone to the mailbox to retrieve the mail, leaving just the hub variable "Mail Arrived" true until I finally get the mail. As it currently works, the hub variable gets switched to false after 1 hour even if I don't retrieve the mail within that time period.

I think this should work. The ELSE will catch when the Wait was ended by the timeout.

Wait for event: YoLink MotionSensor - Motioin Sensor motion active --> timeout: 1:00:00
IF (motion active) THEN
   Do stuff...
ELSE
   Do other stuff...
END-IF
1 Like

This shows my attempt to use the built-in variable, as suggested by @bertabcd1234 . Required and triggered event not shown but unchanged from prior screenshot (didn't fit on one screen). Please check my logic--I think this is accomplishing what I intended:

This is the exact technique I am using left and right in many of my rm rules.

I use the notification app for a much simpler rule but it will not turn on a light.

So that is to say that if I had -

Wait for events: Temperature of Motion - Greenhouse (53.70) is < 85.0 and stays that way for: 0:05:00 OR When time is Sunset-15 minutes(17:21) OR Illuminance of Lumin - Greenhouse(1660) is < 200 and stays that way for: 0:15:00 --> timeout: 10:00:00

that sending this following message via NOTIFY

fans OFF - Greenhouse - %value% %time% triggered by %device%

%device% would indicate which of those OR device triggers (or the "timeout") ?

Irrespective of using/setting up a variable vTimeout as you discussed.

No, it is impossibile to say what it would do without seeing the whole rule, including trigger events. It will be one of those (trigger devices) or "timeout," but neither is inherently related to any device names you may have in a wait.

OK, thanks.