Is there a way to see the return value of the Wait for Expression? I would assume true if the expression is met and false if the duration timeout is met. I'd like to include this in an if statement if possible.
device variable is normally set to the name of the triggering device, but if a timeout expires, it will be set to "timeout" (no quotes):
Typically, you would assign this to a "real" variable, which you can then use in conditions/expressions as needed. Here is one example: Rule to close garage door - #2 by bertabcd1234
I appreciate the quick response. This honestly feels like a workaround instead of a defined return value, hopefully the device value remains as "timeout" in future releases. Either way I'll give it a shot. Thanks again!
There are no "return values" in Rule Machine actions (or elsewhere); it's not code, just a GUI-based editor for creating custom automations whose actions are essentially ordered scripts (the contents of which display in a sort of pseudo-code, but that is entirely arbitrary--just, presumably, the author's preference that this is the most concise way to summarize your selections from the editor).
If you are comfortable dealing with return values, perhaps you'd also be comfortable writing your own apps for Hubitat. These are written in Groovy, and you can indeed do that there. If that is more your style, this may help you get started: Building a Simple App | Hubitat Documentation.
Otherwise, this Rule Machine feature was added for the exact reason you're asking about, so it should work. If that ever changes, I'd expect a Rule version change with a documented difference (it actually sort of did once a few platform releases ago; that was a bug and was addressed in a hotfix). As an alternative, if your wait involves a device, you could consider checking the resulting device state some time after the wait, which would effectively tell you if the resulting condition was met at that time. This is generally less desirable (possibly because you may run into a rare timing issue where the event happened but the app won't quite see the resulting state yet; also regarding events in particular, you wouldn't be able to tell whether the event happened or the device was just already in that state).
Understood. Thanks for the additional details. I do have some programming experience hence the ask for return vales. May drive into groovy someday.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.