The electricity spot prices in Sweden (i.e the base price when you don’t have “fast pris”) are available from Vattenfal. On top of that price then come the transport costs your network operator charges, any taxes and 25% VAT. Yes. 25%. Yes on top of the taxes. Electricity is a luxury good. Apparently. These prices vary per region and the further south you go (the further away you are from the hydro plants) the more expensive it gets.

A couple of years ago I wrote a Prometheus exporter called Vattenfall that publishes this data. You can scrape it and ingest the hourly prices. Because Prometheus is meant for monitoring this only gives you data for the current hour. As long as you scrape it you’ll build up historical data. With some long-term storage solution for Prometheus you can travel as far back in time through this data as you’ve collected. You can use this to see the effect the climate and worldly events have etc. It’s interesting data to dig into.

This project has been quietly sitting on GitHub not ever gathering much interest, at least that I could see. Due to the recent energy crisis this little project is seeing a bit more interest. It’s fascinating to see how folks have suddently started to engage a little with it over the past 3 months. The real world influences the kind of software people are interested in. Who knew.

As interesting as historical data is, what folks need currently is access to the forecast, the prices over the next 24hrs. This can help people plan their electricity usage, like when to run the dishwasher. If you’re wondering where the future prices are coming from, it’s Vattenfal. Electricity prices are locked in 24hrs ahead of time and published.

There are great options available like Elklocka but it would be really nice to also have this data in Grafana. Turns out we can do this, just not with Prometheus. The exporter now has an additional endpoint, /forecast, that exposes the future prices in a JSON format you can graph with the Grafana JSON API data source. The README contains instructions on how to set it up.

I hope it helps!