Problems using OpenMeteo Forecast

Hello everyone,

i wanted to try the new Weather Forecast using OpenMeteo and the Predictor Production Linear Model, which were released in the tag 2025.7.0. I have some questions regarding the usage:

  • Do I need an API key? On the webpage I read for non-commercial use, OpenMeteo can be used without one.
  • Do I need to do anything else than activating the OpenMeteo and Predictor.Production.Linearmodel components, when I already have the other components needed for the Timeofuse Controller?
  • I saw that the predictor accesses a file in the data directory (see error below, path should be correct and is also passed to the execution of OpenEMS edge). Do I need to create some files manually or should the component take care of everything?

I tried to use these controllers, but got the following error messages:

Error 1

[thread-1] ERROR [n.linearmodel.ModelFitRunnable] Cannot train linear model: io.openems.common.exceptions.OpenemsException: Cannot fetch historical weather data: java.lang.IllegalStateException: Not a JSON Object: null at io.openems.edge.predictor.production.linearmodel.ModelFitRunnable.fetchTrainingData(ModelFitRunnable.java:103) ~[?:?] at io.openems.edge.predictor.production.linearmodel.ModelFitRunnable.run(ModelFitRunnable.java:87) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?] at java.lang.Thread.run(Thread.java:1583) [?:?]

Error 2

[thread-1] ERROR [ictorProductionLinearModelImpl] [predictorPvWeather] Failed to load linear model: <path-to>/data/models/linearmodel.json (No such file or directory)

I hope you can help me with these issues, thank you in advance for any help.

Best Regards
Daniel

Hi Daniel,

thanks for your feedback.

For non-commercial use, you don’t actually need an API key, it should work fine without one.

To get the weather-based forecast up and running, you’ll need to do the following:

  • Enter the site coordinates in the meta app.
  • Install the components Weather Open-Meteo and Predictor Production Linear Model.
  • In the Predictor Production Linear Model component, set Production Active Power as the source channel.
  • Then, in the Core Predictor-Manager, make sure the predictor priorities are set so that the Predictor Production Linear Model (for example predictor1) is at the top of the list.

Once that’s done, everything should work as expected.

About the second error: my guess is that it can’t find the file yet because the model hasn’t been trained. As soon as there’s been a training run, the file should show up.

Let me know if it still doesn’t work after that!

Best regards,
Leonhard

Hi Leonhard,
I have the same problem. If I activate the OpenMeteo component the request gets http status code 303 and no valid json response:

Stefan

I found the reason. If there is no API key the corresponding url parameter must not appear.

This is not working:

https://customer-api.open-meteo.com//v1/forecast?past_days=1&apikey=&minutely_15=shortwave_radiation,direct_normal_irradiance,temperature_2m,weather_code&forecast_days=3&timezone=UTC&latitude=47.11&longitude=11.11

The answer is

{"reason":"The supplied API key is invalid.","error":true}

Without the empty api key parameter this leads to a valid answer:

https://api.open-meteo.com/v1/forecast?past_days=1&minutely_15=shortwave_radiation,direct_normal_irradiance,temperature_2m,weather_code&forecast_days=3&timezone=UTC&latitude=47.11&longitude=11.11

Hi Stefan,

you’re absolutely right, that URL doesn’t work. Good job!

This issue has already been fixed, so now the parameter will only appear if there’s actually an API key.

Best regards,
Leonhard

This is the fix: Open-Meteo: Fixed empty apikey parameter in url by leonhardanderle · Pull Request #3235 · OpenEMS/openems · GitHub

Thank you for the response! Unfortunately, it still does not seem to work for me. I see that the weather data is fetched, but the Linear Model Predictor still seems to have some issues.

When activating the predictor (after weather data already has been fetched) i get this error:

PredictorError

[thread-1] ERROR [n.linearmodel.ModelFitRunnable] Cannot train linear model: io.openems.common.exceptions.OpenemsException: Insufficient data points available for training at io.openems.edge.predictor.production.linearmodel.ModelFitRunnable.trainModel(ModelFitRunnable.java:164) ~[?:?] at io.openems.edge.predictor.production.linearmodel.ModelFitRunnable.run(ModelFitRunnable.java:88) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?] at java.lang.Thread.run(Thread.java:1583) [?:?]

And then at each cycle of the Optimizer:

Error at each cycle

[thread-1] ERROR [ictorProductionLinearModelImpl] [predictorWeather] Failed to load linear model: <path-to-data>/data/models/linearmodel.json (No such file or directory) [thread-1] INFO [i.prediction.AbstractPredictor] [predictorWeather] Prediction for [_sum/ProductionActivePower]: Prediction{EMPTY}

I deployed the components as you described.

Best regards,
Daniel

Hello Daniel,

I have the same messages. I have so far interpreted this in such a way that the data is not yet sufficient to calculate the model.

Do you have new insights yet?

Best regards

Christian