# bus-department-schedule 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. ## 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`. ## Deployment (Coolify, live since 2026-10-07) The board runs as a Coolify application on the home server: - Source: **Public Repository** `https://gitea.madeinzlin.cz/rickzkm/bus-department-schedule.git`, branch `main`. The repo must stay public: Gitea SSH is disabled, so Coolify cannot use a deploy key. - Build pack **Docker Compose**, base directory `/`, and **Docker Compose Location `/docker-compose.yml`**. Coolify's default is `/docker-compose.yaml` and fails with "Docker Compose file not found". - No domain and no environment variables: the defaults in `docker-compose.yml` fit this server. - **Update:** commit, `git push` to Gitea, then press **Deploy** in Coolify (no webhook yet). - **Logs:** Coolify → the application → Logs, or `ssh coolify 'docker logs --tail 20 $(docker ps --format "{{.Names}}" | grep ^screen-)'`. - The cache lives in a named Docker volume (`/data`). A brand-new volume logs four "no usable cache" warnings once, then downloads the pages. - Only one container can hold the screen's serial port. Stop any other container using it (for example a manual `docker compose up`) before deploying. Timetables refresh on start (only if the cache is older than 20 h) and daily at 03:00 (retry every 15 min after a failure). ### Running by hand on the server (debugging only) Find the stable device path (survives replug/reboot, unlike `ttyACM0`): ls -l /dev/serial/by-id/ docker compose up --build -d docker compose logs -f screen Stop it again before using Coolify, for the serial-port reason above. ## If something is wrong - 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/serial/by-id/usb-2017-2-25_UsbMonitor_USB35INCHIPSV2-if00` | serial device, also passed into the container | | `SCREEN_ORIENTATION` | `REVERSE_LANDSCAPE` | flip to `LANDSCAPE` if upside-down | | `SCREEN_BRIGHTNESS` | `50` | 0–100; halved from 00:00 to 06:00 | | `BOARD_TZ` | `Europe/Prague` | time zone for departures (the container's own `TZ` is ignored) | | `TZ` | `Europe/Prague` | container time zone (logs only) | | `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`). ## Known limitations Found in review and deliberately left for later: - **Scheduled times only.** No live delays; footnote marks (`v`, `A`, `z`, …) are stored but not shown. - **Special school-holiday column applies only on workdays.** Its header says "Prac.dny–školní prázdniny"; on a special date that is a weekend or state holiday the rest-day column is used. - **Slow start after a restart:** if the cache is older than 20 h and DSZO is slow or down, the first draw waits for the download (up to ~80 s, once). - **A page that only announces a future timetable** would replace the current cache at the next refresh and show the new times early. The pages seen so far carry only the newest columns. - **Retries:** after a failed refresh all four pages are retried every 15 min, with no backoff. - **Daylight-saving nights:** countdowns between 00:00 and 03:00 are off by one hour on the two switch nights. - **`zítra`** is shown for any departure on a later calendar day, including a bus shortly after midnight. - Long stop names are not truncated; the two real stop names fit.