Solar Data Viewer

I’m finally ready to release (well actually post about) the viewing software that compliments the python acquisition software I created ( I actually had the viewer working when I wrote the last post, but have been lazy about writing it up. As such I’ll change my format and write a bit more general and less about how it internally works and was created. I can always add updates if asked in the comments.

So here are some screenshots of my “Solar Viewer”.

GIMP GIF-num-flat-dateRem
Solar Viewer Screenshots (1 – Interval Data; 2 – Plotly.js allows zoom and navigation; 3 – Data shown can be changed; 4 – Time Period can be changed; 5- Multiple types of data; 6 – Power Factor is shown as angle; 7 – Daily Stacked display; 8 – Daily Overlaid; 9 – Ability to export data to CSV). I removed the times for some of the images for privacy reasons.

It can be downloaded from here [].

To make it work, it uses a PHP script to extract the data from the database, format it into CSV format. The main html/AJAX script then processes the CSV and then the data is plotted using Plotly.js to create the graphs. The PHP script is controlled via parameters in its URL (GET Method). This allows different data sets and arbitrary time frames to be used for the exported CSV. The html/AJAX script uses papaphrase.js to take the CSV file and phrase it into arrays.

Solar Viewer Data Flow

I choose to use plotly.js as it seemed to be the only interactive (can hover, zoom, pan etc) plotting engine for JavaScript (browser based) that I could find. The data can all be changed without requiring to reload the webpage itself (using jquery.js).

The interface itself allows the user to:

  • Select shown data-set(s) via check-boxes (Daily and interval data shown separately)
  • Change between a stacked view or overlaid (good for comparing trends)
  • Set period of data (SolarWeb only allows a single day to be viewed, starting from midnight). Currently this period is from the current time backwards, you cannot start or end at an arbitrary date or time.
  • Download the shown data to a CSV file
  • Pan, scroll, zoom, hover over a point for specific detail


The default shown data and period times can be setup in the html script file. I have mine default to 3 days for interval data and all three power data sets (feed, production and usage) shown. Similarly, 1 year for daily data, and showing energy produced per day, time spent producing per day, and percentage of day spent exporting.

From the last couple of months since I’ve been collecting data, the acquisition script has worked flawlessly. However, my father requested I add frequency data collection. This is because frequency can give a good indication for load on the entire grid. However, we found out after implementation that the Fronius Smart Meter can only do frequency in 0.1Hz resolution thus, it is not as useful as it could be.

Frequency Plot
Frequency (Hz)

Comparison has been done to daily energy values between SolarWeb and the Modbus acquisition. On average they are similar, however per individual day there can be variations. These variations are sometimes positive and sometimes negative indicating that SolarWeb does not necessarily sample at the same time each day. The server that I run the Modbus collection on, has synced time via NTP and will always calculate daily values at 11:59pm (23:59).

There are a few issues with the interface which I would like to fix/change, however if I’m honest, it’s unlikely I will implement them due to time. These fixes/updates are:

  • Arbitrary start date when not in live view (Live Update). This would be beneficial for comparing summer and winter interval data together easily.
  • When using overlaid view, the Y axis titles and “ticks” end up overlaid thus making rendering them unreadable.
  • In stacked view mode, the X axes are not locked together. Ie, when zooming in on a plot in stacked view, only the sub-plot you are modifying will change, not the other sub-plots.
  • I was originally aiming to use cookies to store view settings between sessions.
  • The layout is not optimised for mobile viewing, so it will look very ugly on a narrow screen.
  • The html/JavaScript code is not clean and could be called “hacky”. I’m used languages with more structure and being new to AJAX found some of the flow different, plus I just wanted it working.
  • It’s not optimised for high volume of server requests (there is not compression in the CSV data for example).


So that’s the viewer. Hope it’s helpful. Comment below if you need help installing it. Database settings can be changed in the PHP script, and the PHP script does not necessarily have to be on the same server as the html file (however you will need to add “header(“Access-Control-Allow-Origin: *”);” to the top of the PHP script. Don’t forget to load mysql into PHP using PDO. I’ve also added to the github repo for the sunspec-modbus script, a systemd startup script. Ignore the moments.js in the github repo, I had been testing something with it and accidentally added it to the repo.