From 33d5df874594582df2f08d6aa75e88334ce8a269 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 5 Oct 2020 03:51:15 +0100 Subject: [PATCH 1/6] dont check-in .env files --- .gitignore | 5 +++++ .../lib/__pycache__/epd2in7b.cpython-37.pyc | Bin 5026 -> 0 bytes .../lib/__pycache__/epdconfig.cpython-37.pyc | Bin 4263 -> 0 bytes 3 files changed, 5 insertions(+) create mode 100644 .gitignore delete mode 100644 dashboard/lib/__pycache__/epd2in7b.cpython-37.pyc delete mode 100644 dashboard/lib/__pycache__/epdconfig.cpython-37.pyc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f99cfe2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# .env +**/.env + +# stop checking in pycache files +**/__pycache__/*.pyc \ No newline at end of file diff --git a/dashboard/lib/__pycache__/epd2in7b.cpython-37.pyc b/dashboard/lib/__pycache__/epd2in7b.cpython-37.pyc deleted file mode 100644 index dd0516fb7ebbe9e2cb86a2b2cb7c061d8ee97fa9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5026 zcmcIoO>i7X74G?;U9F^*w2>t{IEv#qS;vtegoL6}!PpA1sbtG#Ifx92H@n-T)yVrJ z^^7cOYgJI#RTMW@krOBB0984`DQ9kQqBzeHE-a@UD4@86?{&|PMr&CZs?gSa{kr>g z&wKq|zxPJh#>evvf9=nHceiqpu|HF1_-BB)iYHtIaK^P3^BC8;(bC$wr)!Lxp2028 ze3x;XI}aIm9_XIMwG~!&2Ux=@0}WW#;+((98{N)Y&>Z{*BY}(Y25}7ku7J3TCtT1O z^O>h{=ILDH`a_0ysGrGANm)P}KN@xLxZILYZe%>qX~f`TcnaVknpTZV3X(UkcqX5~ zuETvNGy4`Z`%Y!X4gR0^y^K?s&g`3&H@ojdX5X32zB3tlOBs1Dd-nfHUgy}p&t&Av z%A3oKKixUFe3qYq4Rd^s&!f%rv-}*|G5#$73fclc&!0m(&KLOeXeamu{s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UeT;fs}?01oFv>9r5TMbN!aWLk-uUy|>*wa@v-+wv@ zqI~8Iig*on7O$hIqdZ9 zs&)D>y?SubHkAJ+@wp%IOeS$Rh!cUyLtwy)5(*o{%Du3IqdMvS0UAr*%g6|vOG_&& z%^{ZY!Z0+C;R*rFXCJ;Zqd@-c<6NgaGnqA~$Ch5<%q+M(v}a^gId!p(D|U^i?awjx zZDxGw2$5Ccxd+G%JnjpjX$9Y3H0eZFD9Qm@nxE5%S;E$@|cHSsuxO^kp)@ zxaJU+VOu8C*LH$9PO|18j9GJ|3V4a#&yG?q6-}hF(jePcWflr_59I(IM0yBZX%IpP z`?*J3qXc-*21k>b^sGLMBCq-&3D|>hPXyvf)gDe_O!*%OkqEDvAAr6E=rCy6d7|im zk-ZAS^WmM+bCyl7Dii%i#NpZb`hwSKheJPo0!6+G0@$8jB9z$FhWKbeZfOu~!3}^+ zFQ0k9cf0`T0A8?v&bP=y=aFIXq)?WmwpDoll8-ezZ6-EM65t!iwwgt9$~W^2g2_|I z=|5q89k{Xp;MxWN-;L|V6~yr}h$RjT`}2mt+;IS9X^7%MY$W#;m*Vyd8$eWCFWxxv zWJ_}zy3zZhcdxhR`hF&YSPr;YBE#G5d1RQ-jta<%NAzz{{qzjp|Agwn6xGw3<|+#A zV0Q22R;cGr@d|$74HOs);(I7G%lrUaO%!MO{fF4q9KN-|czYZOY%?Ee0+_*SiB7-H z;4Yb7EjZc#C4GyZpk;oFLYwF62J^t}U=x#z7OeUQRzt=_I{7wxZ?M>cyaoP^5pSY+ z3&rZnP&mi`kf+@kF<;>= S7Jg>qR^vA{U>=)pk#7J_50}OO From 7fe451f9c2059b71d8e87b33815073278e7d0523 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 5 Oct 2020 04:04:56 +0100 Subject: [PATCH 2/6] moved personal values to .env file; example .env; updated README --- README.md | 1 + dashboard/dashboard/Config.py | 10 +++++++--- dashboard/dotenv-example | 9 +++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 dashboard/dotenv-example diff --git a/README.md b/README.md index b8c5284..5d36f0f 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ 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) diff --git a/dashboard/dashboard/Config.py b/dashboard/dashboard/Config.py index 9bbc356..3810a01 100644 --- a/dashboard/dashboard/Config.py +++ b/dashboard/dashboard/Config.py @@ -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' diff --git a/dashboard/dotenv-example b/dashboard/dotenv-example new file mode 100644 index 0000000..19ba5ab --- /dev/null +++ b/dashboard/dotenv-example @@ -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' \ No newline at end of file From 9410d0d520bbb6b9abcb5b1facba22a42d29e179 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 5 Oct 2020 04:13:26 +0100 Subject: [PATCH 3/6] tweaked readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d36f0f..421b98f 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,14 @@ And two local data sources: ## 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 `.jpeg` flag icon must be added under `dashboard/assets/covid`. +- This project uses a `.env` file to store user specific values that you would not want to include in your git commits + - `lon` and `lat` are used to gather weather information for the desired location + - `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: - `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). - `country` is used to query Covid-19 data and to load the flag icon so it **must** match the `.jpeg` - `[small\medium\large]_font_[size\name]` were chosen to fit the size of the e-ink display From c89615854e1120ce85cca1a4010abe2cf67da96f Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 5 Oct 2020 04:14:40 +0100 Subject: [PATCH 4/6] added info about example file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 421b98f..d1d0ea1 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ And two local data sources: ## 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 `.jpeg` flag icon must be added under `dashboard/assets/covid`. -- This project uses a `.env` file to store user specific values that you would not want to include in your git commits +- 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 - `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). From fdb3ecd41d48656c4acaf9002f6f9e1f14bfba8f Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 5 Oct 2020 04:15:45 +0100 Subject: [PATCH 5/6] removed duplicate info --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d1d0ea1..7a801f0 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,6 @@ And two local data sources: - `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: - - `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 - `country` is used to query Covid-19 data and to load the flag icon so it **must** match the `.jpeg` From bc1e2235ac1d1839230641e69d5c4f61b0379cfc Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 5 Oct 2020 16:16:29 +0100 Subject: [PATCH 6/6] cleaned up regex pattern --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f99cfe2..d2753f1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ **/.env # stop checking in pycache files -**/__pycache__/*.pyc \ No newline at end of file +**/*.pyc