I purchased a Raspberry Pi for my then 10 year old son so that I could teach him programming. His first idea for a project was to be able to "arm" the doorknob to his room so that when he was not in his room it would shock his younger brother when he tried to open the door. After some discussion we decided that maybe we would tackle another project.
That lead to some research where I came across an article here. This not only offered an opportunity to teach him some programming, but it also solved two practical problems. One - it was summer and the kids were bad about closing the garage door after they came in from playing and two - the kids had another habit of leaving the garage lights on - all four 100W bulbs of lights.
Fast forward 18 months and we have a working project. Unfortunately my son dropped out to use his Arduino to build the doorknob project, but on a positive note the garage project has turned out to be very useful. It's used daily and does a great job reminding me if doors are left open or lights are on. If I need to know when someone comes home I can just turn on the door notification. If I forget to close my door when I leave I get reminded after a few minutes and can close it remotely. If the kids are out playing and the door is open I can easily tell it to message me again in 3 hours if the door is still open. All in all it has met its use objectives.
While I did initially consider integration with openhab so that I'd have an app on my phone for controlling the door, in the end I decided that SMS was more efficient for my situation and had better security. It is on the drawing board for a future release.
We now have a solution that does the following:
1. It can remotely open / close either of our two garage doors via SMS message
2. It can alert you via SMS to any of the following events (door events work independently for either door):
- Door opened
- Door closed
- Door left opened for more than xx minutes
- Light on for more than xx minutes when dark
- Door finished closing when requested via SMS
- Door finished opening when requested via SMS
3. Every event can be independently subscribed / unsubscribed to via SMS (e.g. sub door1 open).
4. You can ask for current status, a list of what events are currently subscribed for your phone number, and help for commands.
5. You can snooze or shut off the "nag" reminders. Example, your door tells you that it has been open for 10 minutes. You can snooze it for another 60 or tell it to stop bothering you (e.g. snooze door1 60). You can do the same for the light "nag" reminders.
6. Note that in my case the doors are named Heather and Ivan. The commands are customized appropriately and shorted to be easy to text. Commands supported (case insensitive):
- s or status: return the status of each door and light
- ? or help: return description of commands
- sub {door} {event type}: subscribe the current phone number to event
- unsub {door} {event type}: unsubscribe the current phone number to event
- list: List out all events and if you are subscribed or not
- si [n]: Snooze Ivan's door timer. Cancels timer if no minutes are provided, otherwise will remind you again in n minutes if door is still open
- sh [n]: Snooze Heather's door timer
- i: Push open/close button on Ivan's door
- h: Push open/close button on Heather's door
I purchased a junction box from my local electric supply store for about $8. It's the perfect box for these types of projects. Add to that M2.5 Nylon Standoff spacers to mount the various boards and you get a nice, neat looking solution, One note for those using Pi's - I had stability problems when using WiFi. No such issues once I hardwired it.
One limitation today is that the device only knows if the door is not closed vs. closed. It does not register fully opened vs. partially opened. Easily fixed with a second set of reed switches but has not presented a problem thus far.
Planned for future:- Add ability to ask Alexa if garage door is opened
- Integration with Openhab
- Add ability to filter event notifications depending on whether or not I'm home
- Ability to stream video
- Improve open door detection
The software part of this is much more complicated than the hardware part. I'm happy to field questions about getting things set up on the Pi. If there is interest I'll write up some how-to's aimed specifically at this project.
The whole project cost about $60 USD. $35 for the Pi, $8 for the SD card, $8 for the box (local electric supply store), $7 for the relay (eBay), $4 for the light detector (eBay) and $2 for two reed switches (local hardware store). The ones they use for windows work just fine.
Finally - security is critical for this. Please, when you setup your Pi make sure to create a new user and change the default password. The code contains a fair amount of security checks to ensure that you are communicating only with Plivo, and it locks down the phone numbers that can be sent to / from. This is critical to prevent some stranger from opening / closing your garage door.
Comments