feat: run the departure board in the container, clock as fallback

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
rickzkmandClaude Sonnet 5.5 committed 2026-10-07 00:45:55 +02:00
1 parent 410eb82a02
commit e3304617f9
7 files changed
+245 -96

No files matched your search

+30 -23
View File
@@ -1,42 +1,49 @@
# bus-department-schedule
Drives a 3.5" Turing Smart Screen (Rev A, 320x480, USB serial) from a Docker
container on the Coolify server. Goal: show local bus departures.
Shows the next bus/trolleybus departures from Štípa,u potoka and Štípa,družstvo
(lines 4, 5, 35, 36) on a 3.5" Turing Smart Screen driven from a Docker container
on the Coolify home server. Scheduled times only (DSZO timetable pages); falls back
to an analog clock when there is nothing to show.
**Current stage: hardware smoke test.** `clock.py` draws a clock. Once it runs
on the server, it gets replaced by the departure board.
## Develop (no screen needed)
python3 -m venv .venv && .venv/bin/pip install -r requirements-dev.txt
.venv/bin/pytest
.venv/bin/python preview_board.py # writes docs/previews/board.png
Design: `docs/superpowers/specs/2026-10-06-bus-board-design.md`.
Plan: `docs/superpowers/plans/2026-10-07-bus-board.md`.
## Run on the server
Find a stable device path (survives replug/reboot, unlike `ttyACM0`):
Find the stable device path (survives replug/reboot, unlike `ttyACM0`):
ls -l /dev/serial/by-id/
Then, from this folder on the server:
SCREEN_DEVICE=/dev/serial/by-id/<your-device> docker compose up --build -d
docker compose logs -f screen
SCREEN_DEVICE=/dev/serial/by-id/<your-device> docker compose up --build
Timetables are cached in the `bus-board-data` volume (`/data`); they refresh on
start and daily at 03:00 (retry every 15 min after a failure).
In Coolify: new resource -> Docker Compose from the Gitea repo, and set
`SCREEN_DEVICE` in the environment variables.
## If something is wrong
## If the screen stays blank
1. `docker compose logs screen` - permission denied or "could not open port"?
2. ModemManager grabbing the port: `systemctl status ModemManager`. Fix with
`sudo systemctl disable --now ModemManager` (or a udev rule marking the
device `ID_MM_DEVICE_IGNORE=1`).
3. Wrong orientation: change `SCREEN_ORIENTATION` (PORTRAIT, REVERSE_PORTRAIT,
LANDSCAPE, REVERSE_LANDSCAPE).
4. Only one process can hold the port - make sure nothing else uses it.
- Blank screen: `docker compose logs screen`; check ModemManager
(`systemctl status ModemManager`, disable it or add a udev ignore rule).
- Upside-down: set `SCREEN_ORIENTATION` to `LANDSCAPE`.
- `jízdní řád zastaralý` on the board: a download failed for more than 3 days;
check `docker compose logs screen | grep refresh` (DSZO may have changed a page).
- Add or change lines: edit `lines.yaml` (one entry per line per stop).
## Config (env vars)
| Variable | Default | |
|---|---|---|
| `SCREEN_DEVICE` | `/dev/ttyACM0` | serial device, also passed into the container |
| `SCREEN_ORIENTATION` | `REVERSE_LANDSCAPE` | flip to `LANDSCAPE` if the picture is upside-down |
| `SCREEN_BRIGHTNESS` | `50` | 0-100 |
| `TZ` | `Europe/Prague` | clock timezone |
| `SCREEN_ORIENTATION` | `REVERSE_LANDSCAPE` | flip to `LANDSCAPE` if upside-down |
| `SCREEN_BRIGHTNESS` | `50` | 0–100 |
| `TZ` | `Europe/Prague` | time zone for departures |
| `DATA_DIR` | `/data` | cache directory |
| `LINES_FILE` | `/app/lines.yaml` | line/stop/URL list |
The screen library is pinned to one upstream commit in the `Dockerfile`
(`LCD_COMMIT`).
The screen library is pinned to one upstream commit in the `Dockerfile` (`LCD_COMMIT`).