WebCore and devices changing state

Has something changed or am I remembering incorrectly…

I am converting all my 40 or rules over from CoRE to WebCoRE and have a very simple rule that says if the back door contact sensor changes to open then turn on the patio light…wait 10 minutes…then turn the light off.

This works fine if the door STAYS open. However, if the state changes back to closed it never turns off. I thought that once the “IF” match triggers a piston to run and it moved on to the “THEN” part of the sequence, changes to the state of the trigger didn’t matter?

IE - It’s acting more like a “Do / While” function

I am sure I can set a variable as the match and keep this behaving the way I want …but isn’t there a way to do what I want with a simple condition change as a trigger…and even if that state changed again while the piston was in the wait period… it would still complete the pistons functions where it left off when it returned to run the rest of it after the scheduled wait period?

If contact changes to open…ok true
Wait 10 minutes…means that if the contact changes to close then the statement is no longer true…
The rest is cancelled…
However, under the cancellation rule, you just select never cancel.

I would do it like this:
If contact changes to open
Time is between x and y
And light is off
Then using light set level

If contact changes to close
And light is on
Then using light
Wait 10 minutes
Turn Off

This way, you get a reset every time the door opens and you can also say when the light should turn on.

1 Like

All you need to do is with your with
Click on it.
Scroll down and click on the settings cog.
Now set Task Cancellation Policy (TCP) to never.
This way the tasks will not cancel when the piston/condition state changes as it will after a short period of time.

Need an additional condition or qualification for if the door remains open and they never close it completely (leave the light on?) or also add wait 10 minutes / Turn off on the open condition as well.

Thanks to all! I tried every variation suggested…and even though I guess it’s obvious it took me a bit to realize the cancellation policy was on the physical object…I ended up using that approach because it change the behavior to what I wanted. Every suggestion was a value add to learning and thanks to all you guys!


1 Like