I have my door left open rules split into 2 rules.
Door changes to open
Door changes to closed
Door is open
Set $isDoorOpen true
Set $isDoorOpen False
Your triggers will be
$isDoorOpen stays True for 10 mins
$isDoorOpen is True (triggered from Rule 1)
Set $isDoorOpen False
Set $isDoorOpen True. (this triggers the rule to run again. It will check if the variable is still true and go to the THEN, if the variable is false it will move to the ELSE)
You can put my above example in 1 rule by combining the triggers and using 2 separate IF statements but I’ve found it’s easier to trouble shoot when I set the variable by a separate rule. Plus I can also use them in other rules.
Sorry again for the rewrite.
I’m not quite getting this. I guess I’m still committed to WebCoRe logic. Does the first rule just get “burred” in the rules list? It looks like the second separate rule does the work. I have many Pistons that do something similar by “watching” something until “it” changes. I’m just not sure Sharptools is my best option for solving the pending SmartThings / WebCoRE issue…
No worries. Switching from webcore requires a new way of thinking.
Yes, the work is done in Rule 2. Rule 1 is basically just to poll from.
All the first rule does is set the variable to true or false based on the door being open or closed to be used on other rules.
The second rule is triggered once the variable stays True for 10 mins
It runs the logic by first checking to make sure the variable is still true (you didn’t close your door in that 10 min wait) and then does stuff because the door is open.
Set the variable to false and then back to true to restart the 10min wait.
Once it reaches the stays True for 10 mins it runs the logic again.
You don’t really need the else because if the door closes the variable will be set to false by rule 1.
I’ve been able to transition 99% of my webcore pistons over, everything except the ones with time calculations but it did take a lot of variables and thinking about it slightly differently.
Hopefully I answered your question.
As an example of using the variable in other rules; I created the Rule 1 for all my doors and windows. I then have another rule with another variable $allDoorWindowsClosed. I use the variables from each door & window as a trigger and condition for this rule and then display $allDoorWindowsClosed on my dashboard as a tile. Now I can see if any door/window is open without having multiple tiles on the dashboard.
I don’t know your comfort level but if you’re interested, there are also context variables available for use that slightly speed up rule execution because it doesn’t have to pull the actual devices status.
Right now… comfort level is about a 1. I just started using Sharptools 2 days ago. I am very comfortable using variables, expressions, etc. in WebCoRe, but this is just a bit different. I’m sure in time, I’ll get there. Thanks for your help!!!