Automatic Garage Door Close


#1

I wrote a Piston to close my garage door if it’s left open for 60 minutes between sunset and sunrise and I have the condition checked at certain hours, but nothing happened

1/22/2020, 10:04:07 PM +233ms
+1ms ╔Starting piston… (v0.3.110.20191009)
+342ms ║╔Subscribing to devices…
+413ms ║╚Finished subscribing (82ms)
+472ms ║Comparison (enum) open is (string) open = true (1ms)
+482ms ║Comparison (enum) open stays (string) open = true (2ms)
+484ms ║Cancelling condition #4’s schedules…
+521ms ║Comparison (time) 79447718 is_between (time) 1579738020000 … (time) 1579702500000 = true (10ms)
+522ms ║Time restriction check passed
+524ms ║Cancelling condition #2’s schedules…
+531ms ║Setting up scheduled job for Wed, Jan 22 2020 @ 10:09:07 PM MST (in 299.919s)
+545ms ╚Piston successfully started (544ms)


#2

The logs show the piston starting up and scheduling the first of the timers (‘every’). I wouldn’t expect to see anything else happen until three minutes later when that timer fires. However …

Timers (‘every 5 minutes …’) work outside the normal flow of pistons and you don’t normally have triggers inside them. The timed trigger (‘stays open …’) is also an unusual beast at the best of times and I don’t think it could work properly in that context. It also basically says ‘if the door stays open for the next 60 minutes starting from now’ and I’m not sure that is what you really need anyway.

As you are running the piston every five minutes, I would have thought you simply want to check if the door has already been open for 60 minutes at that point. That would be Garage door 2's door was open for at least 60 minutes.

The alternative is to remove the timer and just let the piston fire when it wants to, which is whenever the door changes from open to closed or closed to open. The ‘stays open’ should work nicely like that.


#3

try this

IF garage door stays open 60 minutes
      IF time is between sunset - sunrise
      Then 
      Garage door 2
      Close

#4

I just used 5 minutes to test the piston. When I first wrote that I didn’t have the timer trigger, so the piston just checked it once and when the the close it won’t check again. That’s why I add the timer for it to check once awhile


#5

Isn’t it similar to :
IF garage door stays open 60 minutes and time is between sunset - sunrise

?


#6

yes…
But i’m not sure if you can put that in a single line >?


#7

I just put “and” in between, i did use it before, but after it checks and see that the door is closed, it won’t check again


#8

let me draft something. Hope it helps


#9

Sorry I haven’t (couldn’t) test this because I don’t use Sts system for garage door.
Whatthis does (assuming) is, checks the sensor every 75 minutes to see if it was open.

lets say you open the door at 6.30pm but the timer fired the piston at 6.55, Since it’s been not 60 minutes YET, it won’t turn it OFF.
But next time it fires, it WILL BE more then 60 minutes and the door will be shut.

once again sorry couldn’t test this.


#10

So I should get rid of between sunset & sunrise. Testing it right now


#11

How did you do “was open for at least xx minutes”


#12

it’s under THE CONDITIONS
WAS or WASN’T