Use Arial instead of Lato font
Step 3.1. Setup web server
After this step is complete, the following have been installed:
apache2
sqlite3
python3 is already installed
flask
pip
Step 3.2. Create database
If the garage door is open when it should not be, then send a text message to one or more smart phones. Sometimes, I go to bed and forget to close the garage door.
On the Raspberry Pi Zero, run the commands:
$ cd ~/.
$ wget "https://raw.githubusercontent.com/dumbo25/garage-door/main/home/pi/createDB.sh"
$ sudo bash createDB.sh
The script above creates /var/www/db/garagedoor.db with two tables:
schedule
status
It also inserts default values into the table.
Schedule includes each day of the week and the times when the garage door may be opened or closed
Status is a list of variables with an associated value. Some examples are:
vacation is either yes or no
schedule is either on or off
command is one of: toggle the schedule, toggle vacation, or open or close the garage door
Step 3.3. Add ssmtp
Follow the link in the step and return to this page when done
gmail resets your account settings if it is not used regularly. So, run the following commands to send a weekly email:
$ cd /usr/local/bin
$ wget https://raw.githubusercontent.com/dumbo25/garage-door/main/usr/local/bin/weekly.py
$ sudo chown root:root weekly.py
$ sudo chmod o+x weekly.py
$ cd ~/.
Add a crontab to execute the script every Sunday at 12:00pm
$ sudo crontab -e
And add the lines to the end:
# send weekly email every Sunday at 12pm to keep gmail security settings active
0 12 * * 0 sudo python /usr/local/bin/weekly.py
Step 3.4. Install rpi-monitor [optional]
To turn off rpi-monitor, set monitor = off in the database. By default it is on.
$ sqlite3 /var/www/db/garagedoor.db
sqlite> update status set value = 'off' where name = 'monitor';
sqlite>.quit
Step 3.5. Create Web Site
I use an accordion-style website, which makes it easy to fit on a smart phone. Plus and minus signs indicate whether or not part of the menu is opened or closed. A generic accordion menu is described here.
All that is really needed is open, close and the state of the garage door. I've added a bunch of other stuff that can be skipped.
The website uses php, html and css.
Open a terminal window and login to the Raspberry Pi.
If the uncomplicated firewall was enabled during setting up the Raspberry Pi, it will need to be disabled until all the elements required for https are in place. So, run this command:
$ sudo ufw disable
Get the files for the website:
$ wget "https://raw.githubusercontent.com/dumbo25/garage-door/main/home/pi/getWebsite.sh"
$ sudo bash getWebsite.sh
My house was built 12 years ago. I keep electronic copies of manuals for major systems in my house. Here is a link to Overhead Door Manuals. I found my Phantom and Legacy manual garage door opener. You may want to get the manual for your make and model of overhead door.
To view the website, open a browser and enter:
http://♣hostname♣.local/index.php