Using API with Openhab


Just want to say Hello and thank you for the API from Switzerland. I’m using your API for my Smart Home Project with Openhab and our PV at home with 14 kwp.
Screenshot from today (using Influxdb and Grafana):

Green: Production Red: Consumption Blue: Forecast


Would you like to share your API integration code for others to learn from? Your choice of distribution GitHub, GitLab, BitBucket, self hosting, etc.


Thanks very much for posting your feedback!

We plan on announcing some exciting features to our API before the end of the year which we’ll post about on these forums. :tada:

We appreciate any sharing of data, code and the like which better informs us how users are using the API.

Thanks again :slight_smile:


Hi @hippo_2 - that looks like a fantastic use of the solcast API and exactly what I’m trying to achieve with my system at the moment.

Is there any chance you’d be able to share how you brought the information into influxDB/openHAB? I’ve followed one of the worked examples on the InfluxDB website to try and get the overall concepts, but it would be great to see how you’ve actually implemented getting data from Solcast in to InfluxDB (then displayed in openHAB).

Thanks very much in advance!


Hi @joncknott , I started with this tutorial to setup Influxdb and Grafana working with Openhab.

Create a persistence-file “influxdb.persist”. After that I made a cache item with the URL


Create a “items” file like that:
Number Solcast005 { http="<[solcast:300000:JSONPATH($.forecasts.[0].pv_estimate)]" }

In Grafana you have to create a new graph like that:

I hope this will help you with your project. Have fun!


@hippo_2 - thank you so much for the detailed response (and apologies for the delay in mine)!

I was able to get the forecast data into openHAB and then have it pop the data into InfluxDB, but I was having a real rough time trying to deal with the data structures and manipulating timestamps within openHAB so i ended up employing the excellent Solcast API python library to do all the heavy lifting for our prediction models outside of the openHAB environment. I also bring some values directly to openHAB for plotting and some rules-based behaviour with a separate API call.

As an aside, it is possible to do a direct HTTP request using something along the lines of:

Number Solcast005 "Value: [%.1f W]" { http="<[solcast.url=
:60000:JSONPATH($.forecasts.[0].pv_estimate)]" }

Is there any value to doing the HTTP cache method? The openHAB HTTP binding documentation just says that it is possible to do a HTTP cache or a direct HTTP API call, and doesn’t make recommendations for one way or the other. My reasoning is doing a direct API call every 30 mins or so achieves the same ends as refreshing a HTTP cache every 30 mins. I am certainly no expert, so it would be great to know if you’ve selected the HTTP cache method for a specific reason that I’m missing (programming best-practices, flexibility, etc.).