atbore-phx / sbam

Smart Battery Advanced Manager
MIT License
16 stars 4 forks source link

Max API calls - Solcast - 2 arrays #40

Closed Johnnexto closed 2 weeks ago

Johnnexto commented 2 weeks ago

Solcast API;

When adding two arrays in Solcast by look of the log, each one of the array counts as one API call, resulting in 2 calls per hour if the Cron runs every hour that will resulting in to many calls, 5 calls before the daily limit is exceeded. Also, the Solcast seems to reset the call count at 01:00 local time.(CET)

I would ideally like to;

  1. Have a spare API call available for midnight (two calls)
  2. Four API calls during the start_hr and end_hr

Would changing the Crontab sort this? ie 10 00,03,05,06 *

I have sent an email to Solcast support for confirmation on the number of API calls.

6059a692_sbam_2024-11-13T08-00-55.186Z.log

atbore-phx commented 2 weeks ago

Hi @Johnnexto,

You're absolutely right on all points. The hobbyist version of Solcast (free of charge) has a daily API limit of 10 calls per day, and if you have two installations, that would indeed count as two calls.

Your crontab is set to run four iterations and is well-configured, so it uses a total of 8 API calls. I’m not sure when the reset time occurs, so you'll need to test that. Let us know the results!

Johnnexto commented 2 weeks ago

Thanks, I will do some testing and let you know. I will also post the reply from Solcast if and when I receive. Maybe add a note on the limitation in the documentation?

atbore-phx commented 2 weeks ago

Maybe add a note on the limitation in the documentation?

That would be great! New contributors are welcome to help. You can do this via a Pull Request (PR), or I can add it in the next release!

Johnnexto commented 2 weeks ago

Will do.

Reply from Solcast: Correct with 2 arrays, if you split the API calls evenly, then you get 5 API calls per array per UTC day. So it resets midnight UTC.