A service for the weather calendar client written in Python3, backed by Airium and Chromedriver.
Example 1 | Example 2 | Example 3 |
---|---|---|
- Uses Accuweather or OpenWeatherMap APIs for weather data.
- Uses Google's StaticMaps API to generate a static map of your area.
- Uses Airium and Chromedriver to generate HTML and PNG files for image serving.
- Uses Flask to serve images.
In order to obtain an API Key, you will need to:
- Sign up to developer.accuweather.com.
- Create an app in https://developer.accuweather.com/user/me/apps.
- Enter some details about the app's usage and purpose.
- Generate API key.
Make sure you update the config weather.apikey
with your generated api key and update weather.service
to accuweather
.
In order to obtain an API Key, you will need to sign up to OpenWeatherMap and generate an API key.
Make sure you update the config weather.apikey
with your generated api key and update weather.service
to openweathermap
.
In order to generate a static map of your area you will need to sign up to Google's developer console:
- Create a new project.
- Go to Google Maps Platform →
Maps Static API
→Enable
. - Go to
Credentials
→Create Credentials
→API Key
- After generating your API key, copy and update
google.apikey
inconfig.yaml
- (Optional) add restriction to API Key and limit only to the
Maps Static API
service.
This will give us access to the Static Maps API service. In order to re-create the static map in the picture above, we first need to create a map style:
- In Google Maps Platform →
Map styles
→Create style
- In order to replicate the style used above, select
Import JSON
and paste the contents of map-style.json into the text field. This should replicate the map style I use. - Click
Save
and assign a name to the map style.
You can now use the map style to create a map ID that we can reference in our server:
- In Google Maps Platform →
Map management
→Create Map ID
. - Give the Map ID a name and make sure
map type
is set tostatic
, then clickSave
. - Update the
associated map style
to the name of the map style created in the steps earlier. - Copy the
Map ID
and update thegoogle.staticmaps_id
field inconfig.yaml
.
Ensure Python3 is installed on your system
python3 --version
Python 3.9.2
Download project and install dependencies
git clone https://github.com/chrisjtwomey/inkplate10-weather-cal.git
cd inkplate10-weather-cal
python3 -m pip install -r requirements.txt
Run the server manually:
python3 server.py
Run the server 9am each day:
crontab -e
Add this line:
0 9 * * * /usr/bin/python3 /path/to/server.py
/path/to/server.py
should be updated to whatever the absolute path is to where server.py
is on your filesystem.