The goal of this app is to make information more accessible and to have a single place to hold information valuable to a family. The project is made as a website interface so everyone can follow along.
- Skills Practiced
- Current Features
- Running the Project
- API in keys.py
- Weather API
- Google Calendar API
- Todos and Grocery List
- Api connections
- Database Models
- Creating a Database
- CRUD with Database items
- Routes and "live" site with Flask
Current features are in the works. They will consist of:
- Daily weather forecast + next 3 days
- Grocery list
- ToDo list
- Calendar events for the day
You will need Python version 3. This project utilizes pipenv to run:
- Download the project
- Make sure you have pipenv installed -
python -m pip install pipenv
orpip install pipenv
- Create the environment with
python -m pipenv shell
- Install the dependencies -
pipenv install --ignore-pipfile
- Run with
pipenv run python app.py
To run this project in development mode:
- Download the project
- Make sure you have pipenv installed -
python -m pip install pipenv
orpip install pipenv
- Create the environment with
python -m pipenv shell
- Install the dependencies -
pipenv install --dev
- Run with
pipenv run python app.py
With this approach you save more time as Docker containerizes the entire platform abstracting dependency issues away from developers.
-
Install Docker daemon
- Run project (with Dockerfile)
- Run project (with docker-compose, the easiest/fastest way)
Download the Docker desktop locally from here. Select your OS and download the agent. e.g. If you are using a Mac, please click "Mac" > "Install Docker Desktop on Mac" > click "Download from Docker Hub"
The easiest way to run this project is using the command line below:
docker build -t home-automation-app . && \
docker run --env-file .env.home_automation_app -p 8000:8000 home-automation-app
This uses the Dockerfile
to do the setup for us. After building the app, we tell the Docker agent to run using our .env
file. This is only accesible by you and you must not share these details to anyone.
WEATHER_KEY=YOUR_API_KEY
WEATHER_CITY=YOUR_CITY
WEATHER_STATE=YOUR_STATE
CAL_ID=YOUR_CALENDAR_ID
An even easier way to run the app is just configure your .env
file (like above) but run the command below:
docker-compose up -d
Docker compose is just like Dockerfile, but it's more useful as an ochestration tool to launch multiple docker containers.
You will need to create your own keys.py file and include your API information.
-
- variables: weather_key = api key, city = your city, state = your state
-
If you want to connect to a specific Google Calendar (other than your primary one) you will need to grab the calendar's ID from it's settings (click on the gear icon in the top right of your screen, select "Settings", and scroll down to 'Integrate calendar')
- variable: cal_key = calendar id
example keys.py
weather_key = "Api key"
city = "Your city"
state = "Your state"
cal_key = "Calender id"
Create an OpenWeather account to get an API key. Add the key to your keys.py file. You can find the docs here for the specific API connection being used.
Complete step 1 from Google's documentation. Make sure you are logged in with the Google account you want to use.
Download your credentials (file should be called credentials.json) and add the file to your directory and to your .gitignore file.
Both the Todos and Grocery list are using Peewee to create a SQLite database.