Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic door closure after 10:30PM if a door is open for more than 30 minutes #110

Open
Gilles94500 opened this issue Mar 28, 2019 · 6 comments

Comments

@Gilles94500
Copy link

We went home late last nigth and we forgot to close the gate. My mobile phone is on mute between 10PM and 8AM, so I have not been alerted and the gate has been left opened all the night.

Would be it possible to add an automatic doors closure if the time is greater than 10:30PM and a door has been opened for more than 30 minutes? And send a specific mail to know that it has happened.

It could be customizable using the json config file. Something like:
"use_autom":true
"autom_start":2230
"autom_duration":30

Gilles

@rapi3
Copy link

rapi3 commented Mar 28, 2019

you can add on /etc/crontab a simple bash or python script that will close/open the garage at any time you want...
#!/bin/sh

Exports pin to userspace, change pin nr, sleep ...

echo "11" > /sys/class/gpio/export

Sets pin 11 as an output

echo "out" > /sys/class/gpio/gpio11/direction

Sets pin 11 to low

echo "0" > /sys/class/gpio/gpio11/value
sleep 1

Sets pin 11 to high

echo "1" > /sys/class/gpio/gpio11/value

UnExports pin from userspace

echo "11" > /sys/class/gpio/unexport
exit

python script:
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(11, GPIO.OUT)
GPIO.output(11, False)
time.sleep(1)
GPIO.output(11, True)

@zbowman
Copy link
Contributor

zbowman commented Mar 28, 2019

If you already have your garage publicly accessible, this script might work for you. I'm using Pushbullet for notifications and had to use a few sleep commands. The pi doesn't respond fast enough if you ask for the status of each door one right after another but works ok with these delays.

`import requests
import time
from pushbullet import Pushbullet

pb = Pushbullet('')

right = requests.get('http:///st?id=right')
time.sleep(2)
left = requests.get('http:///st?id=left')

if right.text == 'open':
pushright = pb.push_note("Garage Info", "Right Closing")
closeright = requests.get('http:///clk?id=right')
time.sleep(4)
elif left.text == 'open':
pushleft = pb.push_note("Garage Info", "Left Closing")
closeleft = requests.get('http:///clk?id=left')
time.sleep(15)

rightcheckup = requests.get('http:///st?id=right')
time.sleep(2)
leftcheckup = requests.get('http:///st?id=left')

if rightcheckup.text == 'open':
pushright = pb.push_note("Garage Info", "Right Closing")
closeright = requests.get('http:///clk?id=right')
time.sleep(15)
elif leftcheckup.text == 'open':
pushleft = pb.push_note("Garage Info", "Left Closing")
closeleft = requests.get('http:///clk?id=left')
time.sleep(15)

rightfinal = requests.get('http:///st?id=right')
time.sleep(2)
leftfinal = requests.get('http:///st?id=left')

if rightfinal.text == 'open':
pushright = pb.push_note("Garage Info", "Right Door STUCK")
time.sleep(8)
elif leftfinal.text == 'open':
pushleft = pb.push_note("Garage Info", "Left Door STUCK")
closeleft = requests.get('http:///clk?id=left')

if (rightfinal.text == 'closed' and leftfinal.text == 'closed'):
pushfinal = pb.push_note("Garage Info", "Both doors closed.")

`

I know my code is ugly, but it works.

@Gilles94500
Copy link
Author

Thanks; very nice scripts. I don't know the Pushbullet pushbullet feature. I will give it a try. To be honest I am a little bit scary to be locked out in some cases. It is why I wanted to add this test (time and duration) .

@Pack3tL0ss
Copy link

I forked and modified this project a 2-3 years ago to add something along these lines.
Slightly different, but adding a time of day bit wouldn't be difficult.

What I designed it to do:

  • send notification if garage left open for 10 mins. I added Pushbullet which has been added to master since

  • send notification 60 seconds before autoclose

  • audible warning 2 min before autoclose

  • audible warning as autoclose becomes eminent

  • retry loop that will give up after 5 attempts... Send notification on every failure... For times when an obstruction etc prevents for from closing

  • autoclose enable/disable button in web interface
    Added ZoneMinder integration and a lot of other stuff, unfortunately it's far deviated from the master branch at this point. I have a lot of cleanup/ refactoring to do beforeI can post it, but I've been using it for a few years now. It's a goal to get it up and start doing PRs, but it'll be a bit B4 I have time

@Gilles94500
Copy link
Author

Gilles94500 commented Apr 10, 2019 via email

@andrewshilliday
Copy link
Owner

Hi all, I’m a bit late to the party on this issue, but just to throw in my own two cents. I had considered adding a capability like that when I was originally writing the code but decided against it for the simple reason that the idea of garage doors opening and shutting on their own without any human involvement leaves me apprehensive.

Safety issues aside, there is a security aspect to consider. If for some reason your sensor should fail (loose wire, bad contact, etc.) the controller will think the door is open when it’s in fact close. When 10:30 comes around, it will try to close it and instead will wind up opening the garage.

I would suggest that a notification system would serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants