Help with Garage Door Auto Close


#21

One more time… any thoughts? It’s a complete rewrite using all the feedback. Tests seem successful. No errors.

.


#22

Lookin’ good! I believe you actually incorporated all of my tips!

:white_check_mark: Single trigger
:white_check_mark: No loops
:white_check_mark: No commands sent which would restart the piston
:white_check_mark: No spanning midnight
:white_check_mark: No triggers indented

Well done.

Although, I would consider allowing lines 27-43 to run 24 hours a day.
(and only placing a restriction on the final IF at lines 44-57)

IE:

IF {DoorPositionOpen} is true
   and
   {GarageLightOn} is false
   and
   Time is not between sunrise and sunset
Then ...

I do have two other thoughts in the back of my mind, but no need to mention them if things are working well for you. :sunglasses:


#23

How is changing the time restriction beneficial? Is it to keep the boolean values from potentially being out of sync?

In the interest of education, what are your thoughts?


#24

Absolutely.

Lets say Contact Sensor 1 or 2 is opened at 5pm… Maybe a cleaning day or whatever.

Lets say the sun sets at 5:30… The door is still open…
The variables would not be updated until the next cycle.

My advice would be to keep the variables accurate 24/7, but restrict the actions based on time or whatever.


Pro Tip:

Dropping the ONLY WHEN also allows you to insert a Time trigger, to re-sync. Maybe something like:

IF Time happens daily at sunset + 2 minutes
    Then Log to console "Sun setting"  (Anything can go here. It's just a forced trigger)
END IF

Keeping in mind that this will also recheck your last piston lines 37 onwards.
(well, if ONLY WHEN is removed, that is)


#25

Got it.


#26

Okay… You asked for it… LOL. Just kidding

(1) is simply dropping the ONLY WHEN, as somewhat mentioned above…
(IF conditions are almost always preferred)

(2) is more of a curiosity…
I wonder if one of these devices:

  • Switch 6
  • Door 1
  • Door 2

will do something that will change either:

Contact Sensor 1’s contact
- or -
Contact Sensor 2s contact

(perhaps you see where I am heading with this, :grin:)


#27

I think I see what you’re asking and I aborted the previous idea as the risk vs reward wasn’t favorable.

The piston is as you see it.