mickeykkim / inky_pi

Project to display data using InkyWHAT on a Raspberry Pi
https://mickeykkim.github.io/inky_pi/
MIT License
8 stars 1 forks source link

Inky Pi

pypi python build docs codecov Maintainability

Inky_pi is a project to display train and weather data on an Inky e-ink display using a Raspberry Pi. It is modular and fetches data from a variety of sources (OpenLDBWS, Huxley2, OpenWeatherMap).

image 1

Example outputs (generated with desktop output option):

weather_train weather_only

Example terminal output (generated with terminal output option):

╭────────────── InkyPi Terminal Output ──────────────╮
│ Sun 10 Mar 2024                                    │
│ 16:03                                              │
│ 🌦                                                 │
│ Current Weather:                                   │
│ Temperature: 9.0°C                                 │
│ Condition: Rain                                    │
│ Today's Temperature Range: 7.5°C – 9.0°C           │
│ Today's Condition: moderate rain                   │
│ Tomorrow's Condition: overcast clouds              │
│ Train schedule from Kingston to London Waterloo:   │
│ 16:04 | P3 to London Waterloo - On time            │
│ 16:12 | P3 to London Waterloo - On time            │
│ 16:34 | P3 to London Waterloo - On time            │
╰────────────────────────────────────────────────────╯

Weather icon drawing code was adapted from raspi-weather.

Project setup was aided using Sam Brigg's cookiecutter template fork.

Installation

Use the Poetry package manager to install Inky_pi.

poetry install

Usage

poetry shell
inky_pi display --help

Alternatively, the program can be called via its main function.

poetry shell
python -m inky_pi --help

The program can be configured by running python -m inky_web to launch the configuration editor web interface. The web interface creates/edits the local .env file which holds application configuration.

image 2

API keys for configuration are needed for train data using OpenLDBWS and for weather data using OpenWeatherMap. Alternatively, train data can be fetched using Huxley2 without an API key (though the maintainer contends that the Huxley2 server goes down often without notice). A module for Weather Underground could be easily written as a contribution/exercise.

The program runs once per invocation. For automated scheduling, cron is recommended using the python main.py invocation as described above.

Development Tools

Development tools can be run using Invoke.

Virtual Environment: Poetry

A Poetry virtual environment must be created before running any dev tools:

poetry shell

Linting and Type Analysis: Pylint, Flake8, ruff, and mypy

invoke lint

Formatting: Black, isort, and ssort.

invoke format

Testing: Pytest

invoke test
invoke coverage

Docs Generation: Sphinx

invoke docs

CI Workflow: Tox

tox

CI/CD is configured and run using GitHub Actions.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to add/update tests as appropriate.

License

MIT