Solar Forecast PV

historical-and-tmy-timeseries-solar-GIS-data

This binding provides data from Solar Forecast services. Use it to estimate your daily production, plan electric consumers like Electric Vehicle charging, heating or HVAC. Look ahead the next days in order to identify surplus / shortages in your energy planning.

Supported Services

You can start without any registration with forecast solar service providing a free public plan described in readme full example .

Changelog

Version 0.4-beta

  • Bugfix: Solcast channels day 4,5 and 6 working now
  • Bugfix: Fix Solcast power QuantityType unit
  • Feature: Thing Actions supporting parameters to access optimistic and pessimistic forecast scenarios

Version 0.3-alpha

  • Feature: Thing Actions with example to query forecast in rules
  • Feature: Added actual-power channel reporting predicted power in kW at this moment

Version 0.2-alpha

  • Bugfix: Solcast Zone time handling
  • Feature: Send Solcast tuning data to optimize forecast data

Version 0.1-alpha

Resources

solarforecast jar file
solarforecast kar file

Source Code

11 Likes

Would love to test this. I’m on OpenHabian 3.3.0 - Release Build on a Pi4. So, should i just drop the jar-file in the /usr/share/openhab/addons/ dir, just as with other bindings that are not (yet) in the Marketplace? If so -and please forgive my ignorance-, what’s with the .kar file?

I directly checked Marketplace after this post and the binding is present
image

Honestly I don’t know the purpose of the 2 packaging formats but I think kar is the preferred one for openHAB.
If you don’t use the Marketplace installation either pick jar or kar and drop it into the mentioned /usr/share/openhab/addons/ folder and you’ll be fine!

Tnx for the reply, i’ll take it from the Marketplace then :slightly_smiling_face:

Jar is for a standalone binding. Kar if you binding needs to be packaged with dependencies

2 Likes

I’ve upgraded my openHAB from a nodeRED Flow to this Binding and it works great :slight_smile:

Are you planning to integrate the Tuning-Function for Solcast? Here i am still using my nodeRED Flow atm.

Yes, test version is already running in my system and as soon as it’s stable enough on my side it’ll be part in an upcoming version update in the Marketplace.

2 Likes

Thanks Bernd for sharing this binding. I’m about to try it once being back from vacation :wink:

Happy, that you took the effort for simplifying this solar prediction stuff. I did something similar just by using the http binding getting the Solcast json and calculate the predicted solar production by a rule.

Your approach simplifies this a lot. And according to the other posts here and in other threads, there seems to be some demand for such a binding.

Mind raising a pull request for it to get it merged as official binding once you are convinced by your code’s maturity?

One additional thing: Would you add a channel for predicted “current solar power” which should provide the average power for the current time.

Example for Solcast (as they provide the prediction in 30 mins resolution):

<Solar yield for current half hour> * 2 = <current predicted power>

Bonus: You could even interpolate values by considering last+current+next half hour to provide intermediate values as you already seem to do for some of your existing channels.

Thanks for this binding. I was already looking for a way to do some solar predictions.
Grabbing the json via http binding was offcourse also an option, but this simplifies the whole process.

I created a rule which is triggered when the jsonraw channel changes to create some graphs (inspired by this post)

// import ForecastSolarPV_RawJSONResponse
val forecastJSON = ForecastSolarPV_RawJSONResponse.state.toString
//logInfo("ForecastSolar", forecastJSON)
// influx uri
val String influxdb_uri = "http://192.168.0.4:8086/write?db=openhab_db&precision=s"

// ZonedDateTime
val ZonedDateTime todayStart = now.withHour(0).withMinute(0).withSecond(0).withNano(0)
val today = now.getDayOfMonth()
val month = now.getMonthValue()
val year = now.getYear()
val hour = now.getHour()
  
//logInfo("ForecastSolar", "currentHour " + currentHour)
  
// json parse
var String watts = transform("JSONPATH", "$.result.watt_hours", forecastJSON) //watts or watt_hours
//logInfo("ForecastSolar", "-" + watts.toString + "-")

// loop over entries
var Integer x = 0
var influx_content = ""
while (x < watts.split(",").length() ) {
  val entry = watts.split(", ").get(x).replace("{","").replace("}","")
  val time = entry.split("=").get(0).toString
  val value = (Double::parseDouble(entry.split("=").get(1)))/1000 // watts to kWh
    
  val formatter = java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
  val dateTime = LocalDateTime.parse(time, formatter).atZone(ZoneId.systemDefault())
  val dateTime_seconds = (dateTime.toEpochSecond)
  val dateHour = dateTime.getHour()
  val dateDay = dateTime.getDayOfMonth()
  //logInfo("ForecastSolar", "-" + dateTime_seconds.toString + "-")
  
  // filter 0 values & hours in the past
  if ((value != 0 && dateHour > hour && dateDay == today) || (value != 0 && dateDay > today)) {
    //logInfo("ForecastSolar", "-" + dateTime.toString + "-")
    influx_content = influx_content + "solarforecast watt_hours=" + value + " " + dateTime_seconds.toString +"\n"
  }
  x++
}

// send to influx
influx_content = influx_content.substring(0, influx_content.length()-2)
//logInfo("ForecastSolar", influx_content.toString)
var responds = sendHttpPostRequest(influxdb_uri, "--data-binary", influx_content, 3000)
logInfo("test", "Influx responds {}", responds)

in Grafana ot looks like this

1 Like

Solcast tuning is now available in v0.2-alpha in advanced configuration and channels.
Please check in readme solcast tuning section the correct configuration with

  • powerItem - delivering the correct values
  • powerUnit - delivering values with the correct unit
  • DateTime - check openHAB region settings for right time zone

and advanced channels raw-tuning to verify sent data.

Thanks very much for this binding - it has greatly simplified one of my setups, and allowed me to get rid of poorly written spaghetti-code rules!

One minor bit of feedback: in the README, at the Channels sections, the first column is called Channel. However, the values in these cells are not the Channel name - to derive the name one must remove the -channel from the cell value.

So for example:

actual-channel

is not how this Channel should be referred to. It should just be

actual

This confused me for a second when trying to create links in Items files from the Solcast Thing.

Note that the example at the end of the README is correct, omitting the -channel from the Channel names.

1 Like

@curlyel
I think this is a good idea - looks pretty neat in the graph and can be used e.g. to calculate accuracy values using your pv inverter items.

For those who already installed the binding: Things needs to be re-created otherwise the channel won’t appear.

@wars
Please check the Thing Actions from version 0.3. You can query kW values at any point of time. Also kW/h values can be queried between two timestamps.
Note: I needed one reboot after exchanging the bundle in addons folder to be able to access the Actions

@hafniumzinc
You’re right - readme is corrected.

2 Likes

Perfect, exactly this was the intention while asking for it. Many thanks :+1:

1 Like