GithubHelp home page GithubHelp logo

homeboard's Introduction

Home Board

A set of scripts to load "agenda" data and display it on a Waveshare ePaper display (7.5 inch, 3 color) - Powered by a Raspberry Pi (in my case, a Raspberry Pi Model B Rev 2).

Written for Python3 (tested on 3.7), utilizes pipenv.

Setup

  1. Use an RPi image with desktop, we need a web browser to complete the OAuth2 Flow for Google.
  2. After installing the RPi image, use the RPi config gui or raspi-config command to enable SPI (under "Interfaces").
  3. Install python3.7 and libpython3.7-dev: sudo apt install python3.7 libpython3.7-dev.
  4. Install/upgrade pip: python3.7 -m pip install --user --upgrade pip.
  5. Install pipenv: python3.7 -m pip install --user --upgrade pipenv.
  6. Install application dependencies via pipenv: cd homeBoard && pipenv install.
  7. Configure Google Calendar and Weather by editing home_board/calendar.py and home_board/nws.py
  8. Generate Oauth2 credentials: pipenv run python -c "from home_board.calendar import generate_credentials; generate_credentials()".
    • Follow prompts in browser to complete authentication.
  9. Run application: pipenv run python main.py

Details

Pulls weather conditions and forecasting from the National Weather Service (NO API Key required).

Pulls Calendering information from Google Calendar (OAuth2 authentication required).

After configuring weather and calendaring APIs:

Note: As far as I can tell, you need to generate the OAuth2 credentials on the device that will run homeBoard. You can generate them elsewhere and then copy them to the device, but for me they wouldn't refresh as the device was unknown to Google. Once I generated on the device they were able to automatically refresh.

Pulls Special Events from a locally-defined Dict.

Determines Daylight Saving Time changes from the defined timezone using pytz. (Can do this, currently disabled.)

Has functionality for using mock data at 2 levels:

  • High-level responses from data modules (useful for mocking specific displays)
  • Uses Pickle files due to JSON-incompatible data types
  • Low-level responses from remote APIs (useful for testing parsing changes without hitting API limits)
  • Uses JSON files

Can save a file, rather than send it to the display by passing "save" as the only parameter to main.py:

> pipenv run python main.py save

Saved files are in grayscale with 3 possible values per pixel: 0, 128, and 255. The display will interpret these values as Black, Red, and White, respectively.

The provided example images have been colorized to give a better idea of the end result.

Current weather conditions are displayed in red. Calendar events that are currently happening are displayed in red. Special Event messages are displayed in red.

Original icons from flaticons.net and then modified, except windy.bmp and cloudy_windy.bmp. windy.bmp and cloudy_windy.bmp modified from https://www.flaticon.com/free-icon/wind_56086, original by Yannick.

Run DocTests:

> pipenv run python doctest_runner.py -v

Example Crontab entries:

> # Update every 15 minutes during the day
> */15 7-21 * * * /home/pi/.local/share/virtualenvs/homeBoard--Ftpympu/bin/python3 /home/pi/homeBoard/main.py 2>&1 | /usr/bin/logger -t homeBoard
> # Only update once per hour overnight
> 0 22-23,0-6 * * * /home/pi/.local/share/virtualenvs/homeBoard--Ftpympu/bin/python3 /home/pi/homeBoard/main.py 2>&1 | /usr/bin/logger -t homeBoard

Example Crontab entries using Flock to avoid simultaneous executions (which usually result in image corruption on the display):

> # Update every 15 minutes during the day
> */15 7-21 * * * /usr/bin/flock -n /home/pi/homeBoard_cron.lock -c "/home/pi/.local/share/virtualenvs/homeBoard--Ftpympu/bin/python3 /home/pi/homeBoard/main.py 2>&1 | /usr/bin/logger -t homeBoard"
> # Only update once per hour overnight
> 0 22-23,0-6 * * * /usr/bin/flock -n /home/pi/homeBoard_cron.lock -c "/home/pi/.local/share/virtualenvs/homeBoard--Ftpympu/bin/python3 /home/pi/homeBoard/main.py 2>&1 | /usr/bin/logger -t homeBoard"

homeboard's People

Contributors

kdickerson avatar

Stargazers

Jofish avatar Shelane French avatar Zixian Cai avatar Evelyn Hathaway avatar vad babushkin avatar Jacob (JRY) avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

homeboard's Issues

Having trouble with Pipenv setup

Hey!
This is a really cool project! I have spent hours trying to get Pipenv running correctly on my raspberry pi W and it is giving me some real pain.. I am sure you know there is also a retirement of the weather API so that will stop working unfortunately. I am not a Python master but perhaps I can help if I get the time. Here is the message I keep getting. I has to update because a straight install kept failing with invalid hash codes on the dependencies..

Any insights would be appreciated.

Thanks!

(venv) pi@epaper01:~/homeBoard $ pipenv update
Running $ pipenv lock then $ pipenv sync.
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success!
Updated Pipfile.lock (5c9a1e)!
Installing dependencies from Pipfile.lock (5c9a1e)…
An error occurred while installing spidev==3.2 --hash=sha256:09d2b5122f0dd79910713a11f9a0020f71537224bf829916def4fffc0ea59456! Will try again.
An error occurred while installing rpi.gpio==0.6.5 --hash=sha256:a4210ad63bfe844e43995286de0d3950dfacfa0f3799bb9392770ac54a7d2e47! Will try again.
An error occurred while installing pillow==5.4.1 --hash=sha256:051de330a06c99d6f84bcf582960487835bcae3fc99365185dc2d4f65a390c0e --hash=sha256:0ae5289948c5e0a16574750021bd8be921c27d4e3527800dc9c2c1d2abc81bf7 --hash=sha256:0b1efce03619cdbf8bcc61cfae81fcda59249a469f31c6735ea59badd4a6f58a --hash=sha256:163136e09bd1d6c6c6026b0a662976e86c58b932b964f255ff384ecc8c3cefa3 --hash=sha256:18e912a6ccddf28defa196bd2021fe33600cbe5da1aa2f2e2c6df15f720b73d1 --hash=sha256:24ec3dea52339a610d34401d2d53d0fb3c7fd08e34b20c95d2ad3973193591f1 --hash=sha256:267f8e4c0a1d7e36e97c6a604f5b03ef58e2b81c1becb4fccecddcb37e063cc7 --hash=sha256:3273a28734175feebbe4d0a4cde04d4ed20f620b9b506d26f44379d3c72304e1 --hash=sha256:4c678e23006798fc8b6f4cef2eaad267d53ff4c1779bd1af8725cc11b72a63f3 --hash=sha256:4d4bc2e6bb6861103ea4655d6b6f67af8e5336e7216e20fff3e18ffa95d7a055 --hash=sha256:505738076350a337c1740a31646e1de09a164c62c07db3b996abdc0f9d2e50cf --hash=sha256:5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f --hash=sha256:5d95cb9f6cced2628f3e4de7e795e98b2659dfcc7176ab4a01a8b48c2c2f488f --hash=sha256:7eda4c737637af74bac4b23aa82ea6fbb19002552be85f0b89bc27e3a762d239 --hash=sha256:801ddaa69659b36abf4694fed5aa9f61d1ecf2daaa6c92541bbbbb775d97b9fe --hash=sha256:825aa6d222ce2c2b90d34a0ea31914e141a85edefc07e17342f1d2fdf121c07c --hash=sha256:9c215442ff8249d41ff58700e91ef61d74f47dfd431a50253e1a1ca9436b0697 --hash=sha256:a3d90022f2202bbb14da991f26ca7a30b7e4c62bf0f8bf9825603b22d7e87494 --hash=sha256:a631fd36a9823638fe700d9225f9698fb59d049c942d322d4c09544dc2115356 --hash=sha256:a6523a23a205be0fe664b6b8747a5c86d55da960d9586db039eec9f5c269c0e6 --hash=sha256:a756ecf9f4b9b3ed49a680a649af45a8767ad038de39e6c030919c2f443eb000 --hash=sha256:b117287a5bdc81f1bac891187275ec7e829e961b8032c9e5ff38b70fd036c78f --hash=sha256:ba04f57d1715ca5ff74bb7f8a818bf929a204b3b3c2c2826d1e1cc3b1c13398c --hash=sha256:cd878195166723f30865e05d87cbaf9421614501a4bd48792c5ed28f90fd36ca --hash=sha256:cee815cc62d136e96cf76771b9d3eb58e0777ec18ea50de5cfcede8a7c429aa8 --hash=sha256:d1722b7aa4b40cf93ac3c80d3edd48bf93b9208241d166a14ad8e7a20ee1d4f3 --hash=sha256:d7c1c06246b05529f9984435fc4fa5a545ea26606e7f450bdbe00c153f5aeaad --hash=sha256:e9c8066249c040efdda84793a2a669076f92a301ceabe69202446abb4c5c5ef9 --hash=sha256:f227d7e574d050ff3996049e086e1f18c7bd2d067ef24131e50a1d3fe5831fbc --hash=sha256:fc9a12aad714af36cf3ad0275a96a733526571e52710319855628f476dcb144e! Will try again.
An error occurred while installing httplib2==0.12.0 --hash=sha256:f61fb838a94ce3b349aa32c92fd8430f7e3511afdb18bf9640d647e30c90a6d6! Will try again.
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 15/15 — 00:04:33
Installing initially failed dependencies…
☤ ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 4/4 — 00:01:56
[pipenv.exceptions.InstallError]: File "/home/pi/.local/lib/python3.5/site-packages/pipenv/cli/command.py", line 527, in update
[pipenv.exceptions.InstallError]: pypi_mirror=state.pypi_mirror,
[pipenv.exceptions.InstallError]: File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 2611, in do_sync
[pipenv.exceptions.InstallError]: system=system,
[pipenv.exceptions.InstallError]: File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]: File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 862, in do_install_dependencies
[pipenv.exceptions.InstallError]: _cleanup_procs(procs, False, failed_deps_queue, retry=False)
[pipenv.exceptions.InstallError]: File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Looking in indexes: https://pypi.python.org/simple, https://www.piwheels.org/simple', 'Collecting spidev==3.2 (from -r /tmp/pipenv-hk9amcsh-requirements/pipenv-knd2qcar-requirement.txt (line 1))', ' Using cached https://www.piwheels.org/simple/spidev/spidev-3.2-cp35-cp35m-linux_armv6l.whl']
[pipenv.exceptions.InstallError]: ['THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.', ' spidev==3.2 from https://www.piwheels.org/simple/spidev/spidev-3.2-cp35-cp35m-linux_armv6l.whl#sha256=f94b272a318b4566e4e8454cd6fbd9ffec9e6639f2b6250b2541fb7932ece53a (from -r /tmp/pipenv-hk9amcsh-requirements/pipenv-knd2qcar-requirement.txt (line 1)):', ' Expected sha256 09d2b5122f0dd79910713a11f9a0020f71537224bf829916def4fffc0ea59456', ' Got f94b272a318b4566e4e8454cd6fbd9ffec9e6639f2b6250b2541fb7932ece53a']

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.