Help With CoRE or webCoRE Piston for Door Lock

Hey Guys,

I need some help…I have an electronic lock on my hub the is set to lock when the routine goodnight triggers. However, this door sometimes does not close itself all the way due to the air pressure differences on the other side. What I would like to do is create a piston that stops the door from locking when the routine goodnight runs and sends a push or sms to me letting me know it failed to lock so I can go down and close it. This will hopefully keep the deadbolt from damaging itself when it is not closed all the way. Let me know what you think! Thanks in advance!

There are MANY ways to do this. It also depends on how you are triggering your “Goodnight” routine.
First, I would make a virtual switch in ST, Goodnight_Lock_Door. I would turn that switch ON in my “Goodnight” routine. In webcore, I would run the following piston when the Goodnight_Lock_Door switch is turned ON.

IF Goodnight_Lock_Door switch turns ON
  THEN
    IF Door's contact is closed
      THEN
         With Door_Lock
            DO
               Lock;
      ELSE
         Send SMS "The door is not closed.";
    END IF
    Set Goodnight_Lock_Door to OFF;
END IF