Skip to content

maxbbraun/accent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Accent

Accent is a smart picture frame with a pop of color and no cables. Read more about it on Medium.

Accent

Client

The Accent client uses the PlatformIO Arduino toolchain for the Waveshare ESP32 board. See the client control flow for a high-level overview of the client code.

To push the client code to the board:

  1. Configure the IDE or CLI with platformio.ini.
  2. Pick one display type via build_flags in platformio.ini:
  3. If you want to point the client to a custom server, change kBaseUrl in Client.cpp.
  4. Compile and upload with pio run -t upload.

Follow the on-screen instructions to connect the client to a Wifi access point. The settings will be preserved across uploads and can be reset manually. See the setup documentation for details.

Server

The Accent server is built on Google App Engine using the Python 3 runtime in the standard environment. See the server control flow for a high-level overview of the client code.

The database backend uses Cloud Firestore. User-specific data is stored in the users collection with each user identified by a key generated by the client to identify it.

  • /users/<USER_KEY>/home - The home address used for the local time, the weather, and the commute origin.
  • /users/<USER_KEY>/work - The work address used for the commute destination.
  • /users/<USER_KEY>/travel_mode - The commute travel mode.
  • /users/<USER_KEY>/schedule - The content schedule.
  • /users/<USER_KEY>/google_calendar_credentials - The OAuth credentials for Google Calendar.

To populate the cross-user data after setting up:

  1. Obtain an API key for Google Maps and add it the api_keys collection under /api_keys/google_maps/api_key. Ensure that the Maps Static API, Directions API, Geocoding API, Maps Elevation API, and Time Zone API are all enabled and added to the key's restrictions. The Cloud Vision API and Google Calendar API also need to be enabled, but they do not need a key.
  2. Obtain an API key for OpenWeather and add it in the api_keys collection under /api_keys/open_weather/api_key.
  3. Obtain an OAuth client ID for the Google Calendar API with scope https://www.googleapis.com/auth/calendar.readonly in the OAuth consent screen. You will either need to make your OAuth app public or add your account to the list of test users. Configure the full /oauth URL of your App Engine app as an authorized redirect URI for the OAuth client. Write OAuth Client ID and Client Secret to the client_id and client_secret fields of the google_calendar document in the oauth_clients Firestore collection (/oauth_clients/google_calendar).

To test and deploy the server:

  1. Install the Google Cloud SDK, create a project, and authenticate with a service account.
  2. Run cd server && python3 -m venv venv && . venv/bin/activate.
  3. Run pip install -r requirements.txt (which also builds the C extension).
  4. Run the server locally with export GOOGLE_CLOUD_PROJECT=$(gcloud config get-value project) && python main.py.
  5. Test the local server with:
  6. Deploy the server with gcloud app deploy.

Frame

Files describing the Accent frame hardware include: