Using ImmerSUN data for rooftop solar measurements


I recently signed up to solcast to predict the output of my 4kW home solar array so that my Home Energy Management System could establish when it needed to charge our storage battery from the grid. We have a dynamic smart tariff where the price changes each half hour, and the battery helps to minimise our cost by charging when the price is lowest and discharging when the price is highest.

About 2 weeks ago I started to upload generation data from the panels every 5 minutes. The generation data is measured by my ImmerSUN as part of an optional monitoring add-on and automatically uploaded to the cloud by the ImmerSUN. I use a modified version of this script to collect the data from the cloud which is then uploaded to solcast.

Initially there were some discrepancies between estimates and actuals where the orientation of the roof seemed a little out, and the periods of peak production over-estimated (although my system peaks at 4 kW it rarely sustains 4 kW and certainly not in March). However after 2 weeks the tuning routine ran automatically last night, and now these concerns appear to have been eliminated. Prior estimates now seem to have been revised to reflect the new tuning giving these results for the last 7 days…

There is a period yesterday morning when the ImmerSUN cloud went down so the uploaded measurements are wrong being all zeros, but otherwise the projections now look very good.

My system actually takes the estimates from the evening before, not an hour before, and so there is more uncertainty in the data that I actually use; but all the same I am quite impressed by the accuracy here.


Hi @Greening_Me, glad you are finding this useful and really appreciate you taking the time to share what you’ve built. Tuning with good quality measurements enables us to capture characteristics about the solar installation and site that we otherwise would be quite hard to model. As your site moves through the seasons the tuning will adjust until we have a good representation of seasonal variability.

We are always interested in hear about peoples experience with our technology so if you are able to share your scripts (be sure not to share your API key) with other here or on your own site, I’m sure others will find it helpful.

Thanks again!


In my original post I linked to the code to download the immersun data from the cloud which I saved as

I have a cron job which runs every 5 minutes and calls this shell script:

enddate="`date -u +'%Y-%m-%dT%H:%M:00.000000Z'`"
power="`/home/pi/HEMS/solarfeedback/ | sed -n -f /home/pi/HEMS/solarfeedback/immersun.sed`"
curl -sH "Content-Type: application/json" -X POST -d '{"measurement": {"period_end": "'$enddate'", "period": "PT5M", "total_power": '$power' } }'{my Resource ID}/measurements?api_key={my API key}

The shell script uses the sed editor to manipulate the list of parameter-value pairs generated by according to this script:

s/^.*'gen' => [-]*\([0-9]\)[,]*$/0.00\1/p
s/^.*'gen' => [-]*\([0-9][0-9]\)[,]*$/0.0\1/p
s/^.*'gen' => [-]*\([0-9][0-9][0-9]\)[,]*$/0.\1/p
s/^.*'gen' => [-]*\([0-9]\)\([0-9][0-9][0-9]\)[,]*$/\1.\2/p

Only lines including ‘gen’ are printed (so other measured values are ignored). The 4 alternatives take 1, 2, 3 or 4 digit power values in Watts and convert to kW by inserting zeros and decimal point as required. This can handle from 0 to 9999 Watts or 0.000 up to 9.999 kW.