Skip to content
LeipeLeonPublic

About

Create an image for use in a TRMNL display

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Zonneplan → TRMNL

Generates an e-ink-ready image of Zonneplan's quarter-hourly dynamic electricity prices for the TRMNL display. Use the rendered PNG/BMP with the TRMNL Image display or Alias plugin.

Published outputs

The hourly GitHub Actions workflow publishes the latest images to GitHub Pages:

The raw gnuplot render (hours.png) and its data file (hours.dat) aren't published — each run is archived under history/YYYY/MM/ instead.

How it works

  1. Fetch. Scrape https://www.zonneplan.nl/energie/dynamische-energieprijzen, scanning the streamed Next.js chunks (self.__next_f.push([...])) for the electricity block's price arrays. The 15-minute quarters array is preferred; the 60-minute hours array is the backstop.
  2. Fallback. If neither array turns up, fall back to the EnergyZero public API (https://api.energyzero.nl/v1/energyprices), which only serves hourly prices. Pricing profile (low / normal / high) is then classified by quartile bucketing across the day's prices.
  3. Tabulate. Write a gnuplot data file with the tax-included total price, the profile color and a label on the window's cheapest and priciest entry. Past entries (older than ~1h) are greyed out; anything older than 4h is dropped. Quarter-hour rows only carry an x-axis label on the hour.
  4. Plot. Render an 800×480 monochrome PNG via gnuplot (set mono, one solid bar per entry shaded by pricing profile) — that's the TRMNL display resolution.
  5. Dither. Run it through ImageMagick: Floyd–Steinberg + ordered dither → 1-bit PNG and BMP.

priceTotalTaxIncluded is an integer; divide by Zonneplan::PRICE_DIVISOR (100_000) to get EUR/kWh.

Automation

.github/workflows/build.yml runs on push to main, PRs, manual dispatch, and an hourly cron (5 * * * *). Each run:

  • Installs gnuplot-nox + imagemagick (apt archives cached between runs).
  • Executes ./script/build.
  • Renders this README via the GitHub Markdown API into build/index.html.
  • Archives hours.png and hours.dat under history/YYYY/MM/DD-HHMM* and commits the snapshot back to main.
  • Deploys build/ to GitHub Pages.

Running locally

Prerequisites:

brew install gnuplot imagemagick    # Ruby 3.3 also required

Then:

./script/build

Outputs land in build/. The script forces TZ=Europe/Amsterdam so the chart aligns with Dutch wall-clock time regardless of host TZ.

Tests

bundle exec rspec

Plain RSpec unit tests — no fixtures, no HTTP stubbing.

Further reading

About

Create an image for use in a TRMNL display

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Used by

Contributors

Languages