An open API service indexing awesome lists of open source software.

https://github.com/palemoky/paper-pi

A personalized, asynchronous dashboard for Waveshare E-Ink displays, built with Python and Docker.
https://github.com/palemoky/paper-pi

eink epaper raspberry-pi waveshare

Last synced: 2 months ago
JSON representation

A personalized, asynchronous dashboard for Waveshare E-Ink displays, built with Python and Docker.

Awesome Lists containing this project

README

          


Logo

Powered by Pi, rendered in Pixels.

# Paper Pi

[![Build Status](https://img.shields.io/github/actions/workflow/status/palemoky/paper-pi/release.yml)](https://github.com/palemoky/paper-pi/actions)
[![Docker Image Size](https://img.shields.io/docker/image-size/palemoky/paper-pi/latest)](https://hub.docker.com/r/palemoky/paper-pi)
[![Test Coverage](https://img.shields.io/badge/coverage-66%25-green)](https://github.com/palemoky/paper-pi)
[![Python](https://img.shields.io/badge/python-3.14-blue?logo=python&logoColor=white)](https://www.python.org/)
[![GitHub](https://img.shields.io/github/license/palemoky/paper-pi)](https://github.com/palemoky/paper-pi)

A modern, modular, and highly customizable dashboard for Waveshare E-Ink displays. Built with Python 3.14+ using async/await patterns and a clean, testable architecture.

## ๐Ÿš€ Quick Start with Docker

The easiest way to run is using Docker - it handles all dependencies and driver setup automatically.


Device Demo

## Screenshots

### ๐Ÿ“Š Dashboard

| Todo | HackerNews |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| ![Todo](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/dashboard-todo.png) | ![HackerNews](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/dashboard-hackernews.png) |

### ๐Ÿฅท Other Modes

| Quote | Poetry | Wallpaper | Year-End Summary |
| --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| ![Quote](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/quote.png) | ![Poetry](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/poetry.png) | ![Wallpaper](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/wallpaper.png) | ![Year-End Summary](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/year_end_summary.png) |

### ๐ŸŽ‰ Special Days

| Happy Birthday | Anniversary | Valentine's Day |
| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| ![Birthday](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/birthday.png) | ![Anniversary](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/anniversary.png) | ![Valentine's Day](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/valentines_day.png) |

| Happy New Year | Spring Festival | Mid-Autumn Festival | Christmas |
| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| ![Happy New Year](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/new_year.png) | ![Spring Festival](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/spring_festival.png) | ![Mid-Autumn Festival](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/mid_autumn_festival.png) | ![Christmas](https://raw.githubusercontent.com/palemoky/paper-pi/main/docs/screenshots/christmas.png) |

### Pull and Run

```bash
# Pull the latest image
docker pull palemoky/paper-pi:latest

# Or use GitHub Container Registry
docker pull ghcr.io/palemoky/paper-pi:latest

# Run with docker-compose (recommended)
git clone https://github.com/palemoky/paper-pi.git
cd paper-pi
cp .env.example .env
# Edit .env with your API keys

# For dashboard/quote/wallpaper modes (default)
docker-compose up -d

# For poetry mode (includes poetry-api service)
docker-compose --profile poetry up -d
```

> **Note**: The `poetry-api` service is optional and only needed when using `DISPLAY_MODE=poetry`. For other modes (dashboard, quote, wallpaper), you can run without the poetry profile to save resources.

### Supported Platforms

- `linux/arm64` - Raspberry Pi 3/4/5 (64-bit)

## โœจ Features

### ๐Ÿ“Š Dashboard Widgets

- **Custom To-Do Lists** - Three customizable lists (Goals/Must/Optional) with strikethrough for completed items
- **HackerNews** - Auto-rotating top stories with pagination and configurable display time ([Live Mirror](https://gist.github.com/palemoky/b04f3dcfb8431784cddc648d1af6dd4c))
- **Real-time Weather** - OpenWeatherMap integration with icon support
- **GitHub Contributions** - Daily/Weekly/Monthly/Yearly stats with grid layout
- **Bitcoin Price** - Live BTC price with 24h change percentage
- **VPS Data Usage** - Monitor your server's data consumption
- **Weekly Progress** - Visual progress ring for the current week

### ๐ŸŽจ Display Modes

- **Dashboard** - Main information display with time-based TODO/HN switching
- **Quote** - Inspirational quotes
- **Poetry** - Classical Chinese poetry
- **Holiday Greetings** - Auto-triggered on special days
- **Wallpaper** - Custom images

### ๐ŸŽ‰ Smart Features

- **Year-End Summary** - Automatic GitHub contribution summary on Dec 31st
- **Holiday Detection** - Auto-displays greetings for:
- Birthdays & Anniversaries (configurable)
- Lunar New Year (Spring Festival)
- Mid-Autumn Festival
- New Year's Day & Christmas
- **Time-based Switching** - Configurable time slots for TODO lists vs HackerNews
- **Quiet Hours** - Configurable sleep period (e.g., 1 AM - 6 AM)
- **Grayscale Support** - 4-level grayscale for enhanced visual quality (white/light gray/dark gray/black)
- **Audio Notifications** - [Xiaomi speaker](https://github.com/palemoky/xiaomi-speaker) [integration](https://github.com/palemoky/xiaomi-speaker-action) for alerts and announcements

### ๐Ÿ—๏ธ Modern Architecture

- **Async/Await** - Built with `asyncio` and `httpx` for concurrent operations
- **Modular Design** - 23+ focused modules following Single Responsibility Principle
- **Type Safety** - Full type hints with mypy validation
- **Plugin System** - Extensible display mode system
- **Event Bus** - Decoupled component communication
- **Smart Caching** - TTL-based caching with LRU eviction
- **Unified Retry** - Automatic retry with exponential backoff using `tenacity`
- **Task Management** - Async task lifecycle management
- **Config Hot Reload** - Runtime configuration updates with `watchdog`
- **Graceful Shutdown** - Proper SIGTERM/SIGINT handling

### ๐Ÿงช Quality & Testing

- **Unit Tests** - 90+ tests with 66% overall coverage
- **Core Modules** - 77%+ coverage on critical components
- **CI/CD** - Automated testing, type checking, and Docker builds via GitHub Actions
- **Type Checking** - Full mypy validation with strict mode
- **Code Quality** - Ruff linting and formatting
- **Pre-commit Hooks** - Automated code quality checks before commits
- **Mock System** - CLI tool for generating test images without hardware

## ๐Ÿ›๏ธ System Architecture

The E-Ink Dashboard follows a modular, event-driven architecture with clear separation of concerns:

```mermaid
flowchart LR
%% --- Style Definition ---
classDef control fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
classDef data fill:#f3e5f5,stroke:#4a148c,stroke-width:2px;
classDef render fill:#fff3e0,stroke:#e65100,stroke-width:2px;
classDef hw fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px;
classDef subBox fill:#ffffff,stroke:#90a4ae,stroke-width:1px,stroke-dasharray: 5 5;

%% --- 1. Control Layer ---
subgraph ControlLayer ["๐ŸŽฎ Core & Control"]
direction TB
Main("Main Orchestrator")
Config("Config & Hot Reload")
DisplayCtrl{{"Display Controller"}}
TaskMgr("Task Manager")
end

%% --- 2. Data Layer ---
subgraph DataLayer ["๐Ÿ“ก Data Acquisition"]
direction TB
Fetcher("Data Fetcher")

subgraph Providers ["Providers"]
External["External APIs
(Weather, GitHub, BTC, HN)"]
Local["Local Info
(Quotes, Poetry, TODO)"]
end

subgraph Storage ["State Management"]
Cache[("Cache (TTL/LRU)")]
State[("Persistence DB")]
end
end

%% --- 3. Render Layer ---
subgraph RenderLayer ["๐ŸŽจ Rendering Engine"]
direction TB
ImgBuilder("Image Builder")

subgraph Strategies ["Layout Strategies"]
DashLayout["Dashboard Layout"]
ContextLayouts["Context Layouts
(Holiday, Quote, Poetry)"]
end

Renderer["Primitive Renderers
(Text, Icons, Shapes)"]
end

%% --- 4. Hardware Layer ---
subgraph HWLayer ["๐Ÿ–ฅ๏ธ Hardware Output"]
direction TB
DriverFac("Driver Factory")
EPD["E-Paper Driver"]
Mock["Mock (PNG)"]
end

%% --- Connection Logic ---
%% Control Flow
Main --> Config & TaskMgr
Main --> DisplayCtrl
Config -.-> Main

%% Data Flow
Main --"Trigger"--> Fetcher
Fetcher --> External & Local
External & Local -.-> Storage

%% Render Flow
DisplayCtrl --"Select Mode"--> ImgBuilder
ImgBuilder --"Get Data"--> Storage
ImgBuilder --> DashLayout & ContextLayouts
DashLayout & ContextLayouts --> Renderer

%% Output Flow
Renderer --> DriverFac
DriverFac --> EPD & Mock

%% --- Application Style ---
class Main,Config,DisplayCtrl,TaskMgr control
class Fetcher,External,Local,Cache,State data
class ImgBuilder,DashLayout,ContextLayouts,Renderer render
class DriverFac,EPD,Mock hw
class Providers,Storage,Strategies subBox
```

## ๐Ÿ–ฅ๏ธ Hardware Support

- **Primary**: Waveshare 7.5inch E-Paper HAT (V2)
- **Other Models**: Configurable via `EPD_MODEL` env var (supports most models in the [official repo](https://github.com/waveshareteam/e-Paper))
- **Platform**: Raspberry Pi (Zero/3/4/5) or any Linux board with SPI/GPIO

## ๐Ÿ™ Acknowledgments

- [Antigravity](https://antigravity.google/) for the pair programming
- [Waveshare](https://www.waveshare.com/) for E-Ink display drivers
- [Chinese Poetry](https://github.com/chinese-poetry/chinese-poetry), [LxgwWenKai](https://github.com/lxgw/LxgwWenKai), [Hanyi](https://hanyi.com.cn/) for poetry
- [Flaticon](https://www.flaticon.com/), [Weather Icons](https://github.com/erikflowers/weather-icons) for icons
- [CoinGecko](https://www.coingecko.com/) for BTC price
- [OpenWeatherMap](https://openweathermap.org/) for weather
- [Figma](https://www.figma.com/) for UI design

- All the open-source libraries that make this project possible