Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved user values to .env & added .gitignore #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# .env
**/.env

# stop checking in pycache files
**/*.pyc
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@ And two local data sources:
- [Speed-Test NPM package](https://github.com/sindresorhus/speed-test)
- [Rubik font](https://fonts.google.com/specimen/Rubik) ([Raspberry Pi font installation instructions](https://raspberrytips.com/install-fonts-raspberry-pi/))
> Any font may be used instead of Rubik, but not all fonts will look good on the display, especially in smaller sizes.
- [python-dotenv](https://pypi.org/project/python-dotenv/)

## Hardware prerequisites
- Raspberry Pi (this dashboard was run on a Raspberry Pi 3 Model B but will probably work on any version)
- [Waveshare 2.7inch E-Ink display HAT for Raspberry Pi](https://www.waveshare.com/2.7inch-e-paper-hat-b.htm)

## Code configuration
- The assets used in this dashboard were chosen from [flaticon](https://www.flaticon.com/) for their aesthetics and appearances on the low resolution e-ink display used. The repository includes an icon for the US flag, if you would like to display Covid-19 data for a different country, an appropriate `<country_name>.jpeg` flag icon must be added under `dashboard/assets/covid`.
- The repository includes a `Config.py` file which holds all the configurations required to run the dashboard. In order for the dashboard to run correctly, all of the properties must be provided:
- This project uses a `.env` file to store user specific values that you would not want to include in your git commits. An example of this file and format can be found in the `dotenv-example` file.
- `lon` and `lat` are used to gather weather information for the desired location
- `units` used to determine which temperature units will be used in the weather request. Options are `imperial` for Fahrenheit and `metric` for Celsius
- `unit_letter` used to determine which temperature letter will be used in the display. `F` for Fahrenheit and `C` for Celsius
- `open_weather_map_api_key` is the openweathermap.org API key.
> An account is required to access the openweathermap.org weather API, you can register **for free** [here](https://home.openweathermap.org/users/sign_up).
- The repository includes a `Config.py` file which holds all the configurations required to run the dashboard. In order for the dashboard to run correctly, all of the properties must be provided:
- `units` used to determine which temperature units will be used in the weather request. Options are `imperial` for Fahrenheit and `metric` for Celsius
- `unit_letter` used to determine which temperature letter will be used in the display. `F` for Fahrenheit and `C` for Celsius
- `country` is used to query Covid-19 data and to load the flag icon so it **must** match the `<country_name>.jpeg`
- `[small\medium\large]_font_[size\name]` were chosen to fit the size of the e-ink display

Expand Down
10 changes: 7 additions & 3 deletions dashboard/dashboard/Config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from dotenv import load_dotenv
load_dotenv()
import os

# weather
icon_base_url = 'http://openweathermap.org/img/wn/'
open_weather_map_api_key = 'your_api_key'
lat = '40.71'
lon = '-74.00'
open_weather_map_api_key = os.environ.get("open_weather_map_api_key")
lat = os.environ.get("lat")
lon = os.environ.get("lon")
units = 'imperial'
unit_letter = 'F'

Expand Down
9 changes: 9 additions & 0 deletions dashboard/dotenv-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Example .env file
# To use this - save & rename this file as `.env` after updating the appropriate values below

# Open Weather Map API Key
open_weather_map_api_key = 'YOUR API KEY'

# Home Lat / Lon
lat = 'YOUR LATITUDE'
lon = 'YOUR LONGITUDE'
Binary file removed dashboard/lib/__pycache__/epd2in7b.cpython-37.pyc
Binary file not shown.
Binary file removed dashboard/lib/__pycache__/epdconfig.cpython-37.pyc
Binary file not shown.