So recently i got myself a photovoltaic system installed on our roof. After the installation was done, the technician asked me if i wanted him to show me the web interface and functionality of the system since he knew i was an IT guy and of course i said yes.
But before we head down the rabbithole, i’m going to explain something about the PV (photovoltaik system, im going to abbreviate it from now on), how it works and what components are used in my installation.
Photovoltaic is the correct term if you use solar power to generate electrical power. There are panels on the south-facing side of the roof of our house that are not obstructed by trees or neighboring buildings. These panels are wired up to an inverter, a device that transforms the power from the solar panels into the correct wattage and frequency for the power grid and manages power flow between panels, grid, household and battery (if you have one – it’s not required and you have to decide for yourself if you want or need one).
The Inverter is the „heart“ of the system since it has to have all the intelligence:
- when to charge/discharge the battery
- when to draw power from the grid or feed power back to the grid
- when to cut off the panels (sun rising/sun setting or cloudy weather makes the voltage too unstable)
Because the inverter has to make all these decisions, it needs to know where power is coming from and where power is going. This is done with a smart meter that’s built into the house’s fuse box and wired to the inverter.
The system i’m using at home has 28 panels on the roof with 335W each. This is because of regulations in Germany where it’s way easier/more economic if your PV system has less than 10.000 watts peak power and 30 panels would be 50 watts above that limit (29 wouldn’t look symmetrical on the roof).
The inverter is a „Fronius Symo GEN24 10.0 plus“ and the battery a „BYD Battery-Box Premium“ with around 8kWh of storage.
This inverter has wired and wireless network connectivity with it’s own web interface paired with the „Fronius Solarweb“ where the data gets uploaded and logged. The Solarweb comes with a free version where you can see some usage-graphs but more advanced options and functions need a premium subscription.
The local web interface of the inverter is only capable of showing current readings and does not keep data stored on itself as far as i know.
I was pretty impressed by the web interface at first since it’s a cool visualization with the dots moving in the direction the power is flowing and the dots growing in size as more power is moving – but after a few days i realized that this means all the live data is accessible locally with the worst case meaning i had to scrape this webpage.
And at this point i decided to try and gather all that data locally, store it in a database (influxDB because it’s known to work well with grafana) and then display everything in grafana later on.
So i set out with a plan:
- find the cleanest way to get live data from the inverter
- set up a virtual machine to gather the data, store it inside a db and run grafana
- write a script that gathers the data and stores it
- let the script automatically run on a virtual machine every X seconds
- build a grafana dashboard for a nice overview
- make a write-up of everything 😉
That’s it for the introduction, the next parts will go through every step in detail.