Displays data on a Waveshare 5.83in e-ink display powered by a Raspberry Pi.
- Python 3.7+
- Create API keys for all the data modules listed below that you want to utilize.
- Weather: OpenWeatherMap API (requires a subscription to One Call API 3.0, first 1000 calls/day are free which is plenty for this application)
- News: New York Times API and/or Newsapi.org
- Word of the day: Wordnik API
- Get the Google Calendar id for the calendar that contains events you want to display. To find your calendar id:
- Go to your Google Calendar settings.
- Click your desired calendar on the left sidebar under "Settings for my calendars".
- Scroll down to the "Integrate calendar" section and copy the
Calendar ID
.
- Set your secret keys in a
.env
file in the root/pi-display
directory (note that the IP address for your Pi-Hole also needs to be stored):OWM_API_KEY=[open_weather_map_key] NYTIMES_API_KEY=[nytimes_api_key] NEWSAPI_API_KEY=[newsapi_api_key] WORDNIK_API_KEY=[wordnik_api_key] PIHOLE_ADDRESS=[ip_address_for_your_pihole] GOOGLE_CALENDAR_ID=[google_calendar_id]
- Install the python dependencies by running the following in the
python
directory:pip install -r requirements.txt
- Required for Google Calendar capabilities: Initialize your Google Calendar credentials and token.
- Note: the following instructions will allow your calendar to sync temporarily, but the Google authentication seems to expire rather quickly. More investigation is needed in order to have this work consistently.
- Follow all the directions listed in the
Prerequisites
section of the python Google Calendar API quickstart guide. You must create a Google Cloud Platform project and OAuth desktop credentials. - As part of the prerequisites above, you should have created OAuth credentials in the Google Cloud Console. Download and save the JSON credentials from the Google Cloud Console as
credentials.json
in thepython
directory of this project. To download the JSON file:- Go to the Google Cloud Console. Make sure you have the correct project selected.
- In the left hamburger menu, select
APIs & Services
thenCredentials
. - Under
OAuth 2.0 Client IDs
, click theDownload Auth Client
button for your desktop credentials. - Click
DOWNLOAD JSON
- Rename the downloaded file to
credentials.json
and move it to thispython
directory.
- Run the initialization script. This only needs to be run on first install:
python google_cal_init.py
- Note: this requires browser access as you have to log in through the Google UI. If running your Pi headlessly, run this script on another computer and copy the
token.pickle
file that's generated to your Pi.
- Note: this requires browser access as you have to log in through the Google UI. If running your Pi headlessly, run this script on another computer and copy the
- Required for Fast CLI capabilities: Install Fast CLI cli (
npm install --global fast-cli
)
This project was specificially built for the Waveshare 5.83inch e-Paper HAT.
Some data module settings can be set in the root settings.json
file. Use this file to enable/disable various data modules and adjust their settings. Default is all enabled.
The data displayed is optained from the folowing sources:
The Google Calendar API is used to display the next calendar event. Your Google Calendar ID needs to be set in the GOOGLE_CALENDAR_ID environment variable in order for this functionality to work.
enabled
: Boolean to declare whether to get and display Google Calendar data
The source for news headlines is set in the config.py
. News can either be fetched from the New York Times API or News API. Set the source
to 'nytimes'
to use the NY Times API or any source ID from News API to use the News API (ex. 'the-washington-post'
).
News headlines can be retrieved from the New York Times API. Your NYTimes API key needs to be set in the NYTIMES_API_KEY environment variable in order for this functionality to work and the configuration's source
needs to be set to nytimes
.
News headlines can also be retrieved from the News API. Your News API key needs to be set in the NEWSAPI_API_KEY environment variable in order for this functionality to work and the configuration's source
needs to be set to a valid Newsapi source ID. Note: Articles are delayed a hour if you are using the free version.
enabled
: Boolean to declare whether to get and display news headlinessource
: Source for the articles. Can be 'nytimes' or any source ID from News APInum
: Number of headlines to display
Weather data is retrieved from the OpenWeatherMap one call API. It includes current temperature, 3-day forecast, sunrise/sunset, and weather description (used to generate weather icon). Your OpenWeatherMap API key needs to be set in the OWM_API_KEY environment variable in order for this functionality to work. Default location is Philadelphia, PA.
enabled
: Boolean to declare whether to get and display the weather informationlat
: Latitude for the weather locationlon
: Longitude for the weather location
The default latitude and longitude is Philadelphia, PA.
The Pi-Hole status information is retrieved from the local Pi-Hole API. It includes current status (enabled/disabled), number of queries blocked, and percentage of queries blocked. Your Pi-Hole's IP address needs to be set in the PIHOLE_ADDRESS environment variable in order for this functionality to work.
enabled
: Boolean to declare whether to get and display the Pi-Hole information
The free SEPTA api is used to retrieve the next arriving buses for the specified routes in the app settings. No API key is required.
enabled
: Boolean to declare whether to get and display the word of the daynum
: The number of upcoming buses to display on the screen. Default is 4.routes
: An array of bus route objects containing a busroute
number and astop
id. Stop ids can be retrieved via the SEPTA stops API.
Wordnik is used to get the word of the day definition. Your Wordnik API key needs to be set in the WORDNIK_API_KEY environment variable in order for this functionality to work.
enabled
: Boolean to declare whether to get and display the word of the day
The following integrations are in the codebase but have not been implemented to print on the display.
Network speed information is run in local speed tests via the Fast CLI. This data is pretty slow to collect and the results don't seem very precise.
enabled
: Boolean to declare whether to calculate and display the network speed
To run the python program to retrieve and print the display data, run the command python main.py
from the root folder.
autopep8 is used for Python linting. Install the autopep8
VS Code extension for autoformatting in the IDE.
autopep8 --aggressive --aggressive --indent-size=2 --max-line-length=120 --ignore=E302 --ignore=E121 --in-place -v --recursive .
Icons are from Icons8.