Skip to content

About

Home Assistant draws a calm, easy-to-read e-ink picture (weather, transit, city services) for an Xteink X4, set in Atkinson Hyperlegible

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

Civic Display

Civic Display

A Home Assistant integration that draws a calm, easy-to-read e-ink picture (weather, transit status, city services) and serves it to an Xteink X4 e-paper screen. Home Assistant does all the work, with no extra computer and no cloud.

Every word on the screen is set in Atkinson Hyperlegible, a free font the Braille Institute designed for readers with low vision. Its letters are built to be told apart at a glance. A capital I, a lowercase l, and a 1 never look alike, and neither do 0 and O, which matters on a small gray screen you read from across the kitchen. The font is bundled, so there is nothing to install.

Status: 0.2.0. It runs one kitchen screen every day on Home Assistant 2026.11. Home Assistant draws the picture, the X4 downloads it, and the layout is edited from the Home Assistant app. So far that is one person's setup, so expect rough edges on yours. When you hit one, please open an issue.

An X4 e-ink screen showing weather, two transit lines and a today/tomorrow strip

Sample picture, landscape, with made-up data

Made-up sample data. On the X4 the picture is turned to 480×800.

What it does

  • Draws the picture inside Home Assistant, every 2 minutes and soon after any shown value changes. A failed drawing keeps the last good picture.
  • Serves it at a private URL the X4 downloads: /api/civic_display/<device_token>/image.png. There's no login. A long secret token protects it instead, and you can make a new one any time. By default it works on the home network only.
  • Takes the X4's wake reports on a webhook and turns them into entities: battery, charging, last report, download time, next wake, app version, an Overdue alarm, and a count of lost reports.
  • Tells the X4 when to wake next, from a schedule you set in Home Assistant.
  • A drag-and-drop layout editor in Home Assistant's sidebar (admins only), with the real picture as the preview. It works from the phone app.
  • One entry per screen, so a second screen is just "Add integration" again.
  • Makes a PNG (the default, with 4 grays: sharp and small, about 15–20 KB) or a JPEG.

Install

Needs Home Assistant 2026.11 or newer.

With HACS, the Home Assistant Community Store

  1. HACS → ⋮ → Custom repositories → add this repo's URL, type Integration.
  2. Find Civic Display in HACS and download it.
  3. Restart Home Assistant.

By hand

Copy custom_components/civic_display/ into your Home Assistant config/custom_components/ folder, then restart Home Assistant.

There's nothing else to install. The only library it uses, Pillow, ships with Home Assistant.

Coming from the Mac-based x4-display setup? See Moving from x4-display.

Set up a screen

  1. Settings → Devices & services → Add integration → Civic Display.
  2. Give it a name (for example, "Kitchen"). Keep 800 × 480, turned clockwise, PNG, unless your screen hangs the other way.
  3. Leave Layout JSON empty to start from the example, then finish. The message that follows shows the screen's picture URL and webhook URL; you need both for the X4 app.
  4. Configure → Layout and data sources. The example uses placeholder entities (sensor.example_line_1_alert, weather.example_home, …). Replace each with your own (see below), then save.
  5. Configure → Show the X4's URLs shows both URLs again at any time.
  6. Move things around in the Civic Display page in the sidebar (next section).

Edit the layout

Open Civic Display in Home Assistant's sidebar. Only admins see it.

The layout editor, with made-up sample data

  • The preview is the picture the screen gets, drawn by the same code, with your screen's format and grays.
  • Tap a thing to pick it, drag to move it. Pick a box by its edge.
  • Arrows nudge by 1, 5 or 20 px. On a keyboard, arrow keys work too (Shift = 5 px).
  • Settings for the picked thing: size, style (plain, bold, italic), gray, and how many lines it may wrap to.
  • Text: Sample 1 / Sample 2 fills every spot with the longest text it is likely to get, so you can check nothing overlaps on a bad day. Sample text is never saved.
  • Grid and Snap to grid help line things up.
  • Save to screen saves and redraws at once; the X4 shows it on its next wake. Undo last save puts the layout from before the last save back (press it again to redo).

The editor only moves and styles what is there. It can't add or remove items, and it can't change which entities feed the screen (you do that under Configure → Layout and data sources). A layout that doesn't draw is refused, so a save can't blank the screen.

On a narrow screen (a phone, or an iPad with the sidebar open) the preview goes on top at full width and the controls below it.

Which entities go where

The layout's sources block feeds four places on the picture. Each uses entities you already have in Home Assistant, from any integration:

Slot What to map What it draws
weather one weather.* entity (any weather integration). Optional: separate high, low, condition, now sensors High and low, condition, "Now 41°", and the rain line ("Rain 10 AM to 12 PM") from the hourly forecast
transit per line: a label, a detail sensor (alert text, or the "good" word such as Good service), optional type and notices sensors (items joined with ·) "Good service" or "Not normal", with the problem type and details, wrapped to fit
headway 2–5 arrival-time sensors at your stop "A trains 25 min apart" when the gap is over threshold_min
status_grid per cell: a label, a today sensor, an optional tomorrow sensor A today/tomorrow strip; tomorrow is bold only where it changes

Nothing about where you live is in this code. Your entity ids live only in your Home Assistant.

Options

Configure → Picture and timing: format, gray levels, crisp edges, JPEG quality, turning, size, how often to redraw (default 120 s), redraw on change (on, 5 s settle), home-network-only URL (on), the X4's wake schedule, and the Overdue grace (120 s).

The wake schedule is a list of start times and seconds between wakes, for example 00:00 3600, 05:00 600, 05:30 180, 09:00 600. Each interval must divide the hour (the X4 lines its wakes up on the clock).

The header clock is set in the layout's clock block: show = always, never or when_stale (only when the data is old), format = 12h or 24h.

The X4 app

x4-app/ is the lock-screen app for the X4 (Lua). It downloads the picture, shows it, and posts a wake report.

  1. Copy x4-app/local.example.json to x4-app/local.json (it is gitignored) and paste the screen's two URLs under its name.
  2. Build: python3 x4-app/build.py kitchen → dist/x4-kitchen.xtapp. It needs the packer xtpack.py from touch-licorice-apps (set its path in local.json). --dry-run checks everything without packaging.
  3. Put the X4 in USB mode, copy the .xtapp to the root of its drive, eject. On the X4: All Files → the .xtapp → Install.
  4. Open the app, press Select to make it the lock screen, then lock the X4.
  5. Check the install: Home Assistant should show a report with App version 0.5.0 within one wake.

The app follows three rules learned on the device: one network request at a time, small network callbacks, and interval_sec equal to net_interval_sec. See docs/architecture.md.

Privacy

  • The picture URL and the webhook URL each carry a secret. Anyone with the picture URL can see the picture, so don't show private text on it. Rotate both under Configure → Make new secrets.
  • Home network only (on by default) refuses callers outside your home network. Tailscale's IPv4 addresses count as outside; its IPv6 addresses count as inside. So don't rely on this setting alone. The secret token is what protects the picture.
  • Run python3 scripts/privacy-check.py before sharing changes. See PRIVACY.md.

Develop

python3 -m unittest discover -s tests          # needs only Pillow; no Home Assistant
python3 scripts/render-sample.py 1 out/s1.png  # draw the example layout with made-up data

The drawing (renderer.py), data shapes (sources.py), layout checks (layout.py), and the schedule and telemetry math have no Home Assistant imports, so they test anywhere. GitHub runs the tests, the privacy check, Home Assistant's hassfest, and the HACS check on every push (.github/workflows/checks.yml). How the parts fit: docs/architecture.md. What's planned: docs/roadmap.md. Why the X4 app works the way it does: What we learned on the X4.

The editor is one plain JavaScript file with no build step: custom_components/civic_display/frontend/civic-display-panel.js. scripts/editor-demo.py opens it outside Home Assistant with made-up data.

AI use

We follow BetaNYC's AI Policy on transparency, human review, and documentation.

  • What wrote it. The code and docs were written with Claude Code (Anthropic's coding agent, model Claude Opus 5.5) at the direction of Noel Hidalgo, Executive Director of BetaNYC, from specs Noel approved.
  • What a person did. Noel set the goal and every design choice, and installs and tests each version on a real screen before it is released.
  • The pictures. The cartoon, and the tablet in the logo and icon, were made with OpenAI's image generator (through Codex) from a written description of the device and made-up screen text. No photo was uploaded. The prompts are in docs/art-prompts.md. The words in the logo are set in Atkinson Hyperlegible. The pictures on the logo's screen were rearranged and the side buttons redrawn by hand (Pillow). docs/editor.png and the sample pictures are real output from made-up data.
  • The record of review. Every change is a commit in this repo; decisions are listed in docs/architecture.md.

Data sources and terms

Civic Display draws whatever your Home Assistant entities say. It fetches nothing itself. Each source's terms still apply to what ends up on your screen:

  • Transit (MTA). If you map entities fed by MTA's developer feeds, their terms and conditions apply. Never state or imply that the data is accurate, complete, or on time. The picture shows "as of" the time it was drawn, so a stale screen says so. MTA's logos, maps, and route bullets are licensed separately, so Civic Display draws plain text labels only.
  • Weather. Met.no forecasts (Home Assistant's default) are CC BY 4.0.
  • NYC 311. The city-services calendar comes from the NYC API Portal, under its terms.

Treat the screen as a convenience. It is never the source of record, so for anything that matters, like a trip or a parking move, check the source.

Credits

  • Font: Atkinson Hyperlegible by the Braille Institute of America. SIL Open Font License 1.1, bundled with its license in custom_components/civic_display/fonts/atkinson-hyperlegible/ (details).
  • Ideas from E-Ink Dashboard (Apache-2.0): drawing inside Home Assistant on a timer, serving the picture at a URL, and a battery sensor. No code was copied.
  • App packaging: xtpack.py from touch-licorice-apps (MIT), run as a separate tool and not included here.

Related BetaNYC projects

BetaNYC maintains open-source tools for NYC civic data. Two cover the same ground as this screen:

  • mta-mcp: subway service alerts and elevator and escalator outages.
  • nyc-311-mcp: the city-services calendar (parking, trash, and schools), emergency status, and service requests.

More at beta.nyc/ai-tools.

About BetaNYC

BetaNYC builds and maintains this project. We're New York's civic technology and open data community, and we work to improve lives in New York through civic design, technology, and data.

We run public events, meetups, and hands-on data classes all year, including NYC School of Data and CityCamp NYC. See what's coming up on our events calendar.

Building on this? Tell us!

If you build something with this project, we'd love to hear about it, and we can help other New Yorkers find it. BetaNYC publishes a weekly newsletter, This Week in NYC's Civic Technology and Open Data.


Contributing

Issues and pull requests are welcome at github.com/BetaNYC/civic-display. BetaNYC's contributing guide and Code of Conduct apply. Report security problems privately, as SECURITY.md explains, not in a public issue.

Before a pull request: run the tests and python3 scripts/privacy-check.py (see PRIVACY.md). Nothing about where anyone lives goes in this repo.

Version history is in CHANGELOG.md, and the plain-language record is WHATS-CHANGED.md.

Support our work

Freedom isn't free. Support BetaNYC.


License

Code: MIT License, see LICENSE. Copyright (c) 2026 BetaNYC.

Documentation, text, and pictures (the cartoon, logo, and icon): Creative Commons Attribution-ShareAlike 4.0 (CC BY-SA 4.0).

The bundled font, Atkinson Hyperlegible, is under the SIL Open Font License 1.1.

About

Home Assistant draws a calm, easy-to-read e-ink picture (weather, transit, city services) for an Xteink X4, set in Atkinson Hyperlegible

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages