I’m still very new to SharpTools, and in the process of moving my Webcore routines to ShartTools.
One of the things I’ not sure about is the trigger/flow of a rule.
I have a rule that triggers on motion in any room (about 5 motion detectors), the rule then checks the status of a switch and if the switch is off it turns it on for 30 minutes and then off again for a heating system.
Can some explain what happens is a second trigger occurs while the rule is running?
- Interrupt the flow and start it again.
- Start a second copy of the flow
- Do nothing
- something else?
Ideally I want the flow to continue and ignore further triggers until its finished. Possibly that is what happens since I have a condition that checks the status of the switch?
2 - It spawns a separate process. AFAIK, there isn’t a webCore equivalent of a piston cancellation, so the flow from the first iteration will continue.
There are two options. The first is that you can check the status of the switch and IF that in the flow. If that seems to work consistently, fine. If it doesn’t, instead of doing a turn on, delay, turn off, consider a separate rule that triggers on the switch turning on and the in the flow IF all motion sensors have stayed inactive for 30 minutes THEN turn the switch off.
To make this into 1 rule, you can use context variables.
As a trigger, you take your 5 motion sensors and a variable (“Delay” for example), which you set to “state stays off for 30 minutes”.
In the flow, you use an “if” argument and context variables to filter out the 5 motion sensors THEN turn light on and set Delay on and back off.
Another “if” argument, again context variables to filter the variable out of the triggers, THEN turn lights off.
Now every time movement is detected, it will turn the light on and reset the delay. Once nothing happened for 30 minutes, lights turn off.
That’s very useful, cheers. That’s the sort of behaviour I hoped it had. In practice for my requirement the flow does further checks eg temperature of the room and only turns on the heating if is is required.
Still got a lot of pistons to convert but it’s making progress.