Author Topic: garage-auto-close  (Read 1016 times)

ssmall

  • Full Member
  • ***
  • Posts: 158
  • Country: us
garage-auto-close
« on: June 23, 2019, 09:56:03 AM »
Is garage-auto-close working for anyone?  It does not seem to be working for me.

sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: garage-auto-close
« Reply #1 on: June 23, 2019, 10:38:46 AM »
I tried also and didn't have any luck.  I asked Felix and he thought he had tried it but wasn't positive. 

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: garage-auto-close
« Reply #2 on: May 07, 2020, 10:41:54 AM »
I would like to revisit this event and rebuild it completely.
The problem I have with the current version is that it feels unsafe, the way it's intended to operate.
First, it runs every 30 seconds, but there is a limit of up to 3 run times. So what's the point in running this event all day long, and only actually executing useful code up to 3 times...

Also, the PRs #41 & #42 that ssmall submitted, injects new metric properties back in gateway.js, that nobody else knows about. I don't want to introduce such changes that are some obscure event dependent, in the main app. Programmers call this a code smell and it breaks all kinds of coding rules. I know the contribution is well intended and I realize the gateway.js app is not the easiest piece of code to grasp, so I hope my remarks are not ill received.

I would like to continue the conversation here about how to rewrite this event, and what makes most sense.
I propose something very simple:
- we schedule the event to run 1-3 times between the defined time frame (11-6 or whatever, could be settings in the node).
- when the event runs, check back N minutes (10 in current event code) for unchanged OPEN status. This would take care of erratic CLOSING/OPEN or OPENING/CLOSED cycling.

I think this would be a very simple approach, and eliminate the need to add stray properties to the node's metrics.