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.
The hourly GitHub Actions workflow publishes the latest images to GitHub Pages:
- Dithered PNG: https://leipeleon.github.io/zonneplan/dithered.png
- 1-bit PNG (for TRMNL): https://leipeleon.github.io/zonneplan/diffused.png
- 1-bit BMP (for TRMNL): https://leipeleon.github.io/zonneplan/diffused.bmp
- Rendered README: https://leipeleon.github.io/zonneplan/
The raw gnuplot render (hours.png) and its data file (hours.dat) aren't published — each run is archived under history/YYYY/MM/ instead.
- 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-minutequartersarray is preferred; the 60-minutehoursarray is the backstop. - 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. - 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.
- 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. - 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.
.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.pngandhours.datunderhistory/YYYY/MM/DD-HHMM*and commits the snapshot back tomain. - Deploys
build/to GitHub Pages.
Prerequisites:
brew install gnuplot imagemagick # Ruby 3.3 also requiredThen:
./script/buildOutputs land in build/. The script forces TZ=Europe/Amsterdam so the chart aligns with Dutch wall-clock time regardless of host TZ.
bundle exec rspecPlain RSpec unit tests — no fixtures, no HTTP stubbing.
- https://help.usetrmnl.com/en/articles/11479051-image-display
- https://docs.usetrmnl.com/go/imagemagick-guide
- https://usage.imagemagick.org/crop/#crop
