After getting the basic operation working with separate standalone scripts I decided to expand things a little.
carhole.py which is a small Flask application. There are three routes,
/ just responds to normal
GET request with a short string for testing.
/operate only accepts
POST requests and checks that they include a pre-configured key in
application/x-www-form-urlencoded encoding. If the key matches then the
operate function in
operatedoor.py is called.
/checkdoor functions the same except calls the
check_door function in
operatedoor.py and returns the value.
This all runs on
HTTPS on port 443 so the key value between the client and the server is encrypted.
During testing I was just using a
GET request without a key so I could test with the browser on my phone. Then later I opened the browser and when the tab came up it sent another request out and opened the door.
I setup a task in Tasker to send the request with the key, later on I would like to expand on this and try to get it to run the task as I am approaching the garage door. I exported the task and uploaded the xml file to the repository.
Last I added an init script to run my script on startup. I have a pretty solid base now that later I am thinking about setting up an internal site to pull information from various things in my house together into one place. Another possible project would be to check the state of the door periodically and send an email alert when its been open for a long time or if its open at night when I am asleep. Later if I added a smart lock I could extend it to unlock/lock the door when the garage door was operated.