Sliding Door Kill Switch back on only when just closed


#1

I’m having trouble thinking of how to set the closed controls on the else side of this piston. I’m shooting for an if the contact sensor has been open for > 2 minutes and changes to closed. I have an idea on how to do it but I wanted some alternate ideas on how to do it.


#2

You can also use a else if for it. Then you don’t need the extra if statement in de else (enable complex IF’s in the left top corner). Not sure if that’s your question?


#3

You can combine two conditions for this where the changes trigger is essentially filtered based on the was condition that checks how long it was open:

if 
    contact changes to closed
    and
    contact was open for at least 2 minutes

#4

I gave that a shot but it still turns back on as a I close the door even if I have the door closed in less than a 2 minute window. What does it compare to for “was open for?”


#5

try this:

if contact sensor contact changes to closed
   and
   previousAge([contact sensor : contact]) > 120000

#6

I tried it as @ipaterson suggested and it worked for my test.

image


#7

This is what I have at the moment. The problem I’m running into is any time I close the door it activates instead of only if the door was open for 2 minutes.


#8

I just checked it. I opened it for 2 minutes and closed it, it doesnt turn on. Then I open it for 2 secs then close and it kicks back on.


#9

Hmm, the way I see it, Set to Auto to should be in the then right after line 40, not in the else.


#10

Could you give an example? I figured else as it would be if a isnt happening check b.


#11

Something like this for the else…

else
  if
      Contact Sensor 3's contact changes to closed
      and
      Contact Sensor 3's contact was open for at least 2 minutes
  then
      with
          Thermostat 1
      do
          Set to Auto
      end with;
   end if;
end if;