Alert when door sensor is tripped, then wait 2 minutes before alerting again


I’ve attempted to follow other examples, however I’m just not getting there.

I’m not really up on the type of variables used in Webcore but I tried.

It appears to me, with Trace on, that the Piston gets to the 2 minute wait. However, as soon as it triggers again it cancels the wait and cycles again.

Am I using the wrong variable?


There are many ways to do this. I would not use a variable here. I would code this as follows…

    IF Contact Sensor 2's contact changes to open
      With Presence Sensor 1
          Send PUSH notification "Back Door is Open"
      END With
      With Location          (Set TCP to NEVER here)
        Wait 2 minutes
      END With
      With Presence Sensor 1
          Send PUSH notification "Back Door is Open"
      END With
    END IF

If you do not want to be notified the second time (if the contact sensor is closed), then it will have to be coded differently.


I’m a complete newbie here, you’ve lost me.

Is the “With Location” and the second “With Presence Sensor 1” new IF statements?

What is TCP?

I only want to be notified when the door is opened, not closed. Repeat notification should only occur after a 2 minute timeout. I want to be alerted when someone comes in, however if the wife goes in and our carrying groceries the repeat notifications will drive me nutz!




Sorry for throwing you in the deep end. :slight_smile:
Load this piston using the code “simy” and take a look at it in edit mode.

WAIT statements can be quite confusing/frustrating in webcore. Many of us here struggle with them, myself included. If the status of your trigger device (your Contact Sensor 2) changes at all (ie from open to closed) during the 2 minutes WAIT, then the piston halts there and starts execution from the beginning again. That can sometimes work in your favor. In order to keep that from happening, the TCP (Task Cancellation Policy) must be set to NEVER. Search the webcore forum on TCP for lots more information.

The piston I have suggested above will send a PUSH notification if the porch door is opened. It will wait 2 minutes. Then it will check and see if the porch door is still open. If so, it will send a PUSH notification a second time.


Nope. Alerts every time I open the door.

Other examples use variables instead of a timer, I just don’t know what type of variable to use?



Make sure to enable Drag & Drop to see the TCP setting on the WAIT.

Try this one…


Still alerts every time.


Try setting the TCP to NEVER on the very first IF.


Still alerts. I clicked on the first IF and set it to Never.

Let me repeat my goal just to make sure I was clear.

The door will open and most likely immediately close. I want an alert.
If the door opens and closes withing a 2 minute period I do not want an alert.
After 2 minutes start the process over again.



Yes, I just tested my last piston and it did not work. Sorry. Give me a minute…


A couple issues. You don’t want to set the value of the boolean in the define statement at top as that sets it every time the piston runs. That is why it alerts every time. Try this one:


As others mentioned there are many ways to do this, I prefer not to use waits. Here is how I would do it. I think this should work.


Sorry to jump in…

I can offer you 2 pistons solution… may not be the best way but try it.

@Boolean : dooropen

Piston 1 - DOOR OPEN
IF door sensor changes to OPEN 
IF @dooropen is true
Send message *door opened*

Other piston is:

IF @dooropen changes to TRUE
Wait 2 minutes
Set @dooropen to FALSE


@guxdude, @Terminal, @ike2018 Thanks for bailing me out guys. I just could not get the logic correct here. However, can someone explain why the following did not work?

With TCP set at the WAIT, I THOUGHT that the piston would pause until the WAIT was over, even if the contact changed state. But it appears that the piston ran from the top each time the door was open, even if it were less than 2 minutes.


did you have TCP set to NEVER


Yes. At the WAIT.


It used to be that way I guess… But maybe some pros can explain this, it is different now.


In this case, I believe the wait sets up another execution in 2 minutes and TCP makes sure that will run but it does not stop the piston from running again in the interim.


That would suggest that you could have multiples of the same piston running in a stack, so to speak.


Would seem that way. In pistons like my arrival piston, I add a ‘cancel all pending tasks’ to make sure things don’t stack up.