If you check how long a contact has been open for it's an exact number. That creates some complicated logic issues if you trying to perform some code that it's been open for X time. It would be really helpful if the condition could be for greater/less than X time a contact has been open.
This doesn't make sense. It's not the case that the hub is in a polling loop looking at how long has gone by. Everything the hub does is event driven. The only way to tell that X time has gone by is to schedule checking the state X time in the future, while remembering to cancel this should the state change before X time.
What would be any different between stays open for X minutes, and stays open for more than X minutes? One second? One minute? Pick a time, that's the only way this can work.
As for less than X minutes, what does that mean? Do something if it's been open for less than 5 minutes. When exactly should that be?
There is a condition called Time Since Event that you can use, and could negate for testing if its been less than X time since something happened:
Here is the rule I setup. If the door was open before Sunset it won't work. The trigger is for exactly 5 minutes. We need something like 5 or greater minutes to make it easy.
I will look into the Time Since Event that sounds like a good solution.
The rule I detailed using a boolean on your other thread regarding this should work fine - I revised it, maybe you missed that? It checks the door at sunset, but also will trigger if it is left open during your time period. Sometimes it just makes more sense to break it into two rules (I fought against that for a long time).
First go to Settings > Hub Variables and create a new hub variable of type boolean and set the initial value to false. Then:
Rule 1 - runs all of the time going true when the door is open for 5 minutes and stays that way until it closes. We have it running all of the time so that the main rule will trigger if the door is already open (and has been for 5 minutes or more) at sunset:
Rule 2 - can only trigger between sunset and 11PM. Importantly at sunset exactly it checks the boolean and will trigger your announcement immediately if the door is already open at that time (and has been for more than 5 minutes). If it is closed, nothing will happen unless the boolean changes to true (when the door is opened and left open for 5 minutes or more)
@bravenel I don't see that option (Time since event exceeds) when selecting my device (contact, Window sensor).
It's a condition, not a trigger.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.