/Kettle

A web app that schedules events, and turns on my tea kettle!

Primary LanguageHTMLApache License 2.0Apache-2.0

Kettle

Kettle is a web app created using flask, SQLAlchemy, bootstrap, and apscheduler. The applications purpose is to schedule weekly-repeating events that activate a servo that turns on a tea kettle. While the current use of the web app is quite specific, it could be used in many other ways where a user database and an event scheduler are needed.

Functionality

The web app uses sqlite Data Base with SQLAlchemy handling it (The db could be switched to PostgreSQL for production). The db holds the apscheduler events, the events but in a different location for displaying them, and the Users. The apscheduler event currently uses a Cron like style for their scheduling. When the event hits its activation date-time it calls a function, and in my case it is the runKettle() method which turns on the servo that flips the kettle switch. This method could be replaced with whatever you have in mind that you would like to run. More info about APscheduler.

The main functions the webapp features in the most recent version:

  • scheduling weekly-repeating events
  • deleting events
  • turning the Kettle on at the press of a button
  • updating your user profile (picture, email, username)

Demo

Home Page When Logged in, with events scheduled Home Page

The State page where you create events State Page

Register Page Register Page

Login Page Login Page

Account Page Account Page

Future Features

  • single day/date-time scheduling
  • ability to update an event
  • reset password via email link

Setup

  1. To setup first start by making sure you have python 3 installed
  2. Download and install the required modules used. This can be done by using pip/pip3 on the requirements.txt file. While in the Kettle directory on linux/mac you can use
    pip3 install -r requirements.txt
    to install the modules.
  3. You need to edit the path to the site.db in the code. In routes.py on line 14 you will find
    sched.add_jobstore('sqlalchemy', url='sqlite://///Users/user/Programs/site.db')
    You must change the /Users/user/Programs/site.db to your path to the site.db file.
  4. That is all the setup! Now just run python3 run.py and enjoy!

Resetting DB

To reset the db go to the directory the app folder is in. Next open python3 and import the db from the app:
from app import db
Then delete all the tables by
db.drop_all()
Next add all the tables back and you're all set!
db.create_all()

Acknowledgements

  • BootStrap code snippets where used in the making of this project
  • To find the python modules I used in this project see the requirements.txt file
  • This project was inspired by Corey Schafer's Flask Series