New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.0.8 making multiple API requests per hour, exceeding Solcast limit #11
Comments
Same issue here with the updated component. |
While debugging my other issue #10, I was also seeing some weird logs the other day where it looked like the component was running multiple instances of itself, updating on more than one thread at a time on the hour. |
yeah sorry guys.. trying to move from HACS to HA seems to have just created too many problem @jasonpstokes as for the 55/50 not sure how it can get more than its allowed.. the Solcast API site has been having some errors on their end over the last few days. They log a blog when they have problems. They might be trying to sort out backend api things so ill keep an eye out for that @longzheng I don't see multi instances.. I have two integrations rooftop sites setup in HA.. one for each rooftop on my house which points two different directions. it should not be calling any more than that |
@oziee My theory is that you would only see the multiple instances/threads issue if you encountered an error/exception like I did in #10 (and I suspect OP @jasonpstokes did as well). |
@jasonpstokes I was able to see errors just in the logs page http://homeassistant.local:8123/config/logs |
yeah the listeners just are not updating the HA interface with this current version as for logging its just like any other HA way to view logs. so depending on how you currently have your HA config yaml file set to.. if its only set to show a level and up then you won't see any others log levels lower
|
yes after deleting what I have on the system and putting this GitHub version on there I too now see multi instance calls each hour when it does an update |
Thanks @oziee - sorry I should have been able to work that out myself. Data is showing in the UI now - it just took a long time to update. Although it is doing two passes, the second one says In approx. 90 minutes it's made six API calls - guessing the initial load, and then two on each hour since - so, so far so good. I'll keep monitoring and reporting anything unusual back.
|
There are 5 sensors and I am assuming each sensor consumes 1 api call. |
@oziee This addon has run well since I moved to a new HA container and (kind of) started my config again, so chalk it up to something in my old HA instance (which was crashing a lot), not the addon. Thanks for making this! And happy to test anything further for you. Still something not right with it running twice each hour, but as your checks are working and it's not chewing up API calls, it's not a big deal. |
@del13r :
Solcast provide two data streams (live and forecast) and so only two calls are required to get/update all sensors. Plus, according to the logs, this addon only updates between 5am and 7pm and so that makes approx. 26 calls per day when configured to hourly.
My Energy dashboard / graphs are all still in my local timezone, not UTC. 🤷♂️ |
@jasonpstokes just set the time interval to 2 or 3 hours and it will space out the 4 api calls |
I was testing with 2 different browsers which were on older versions. |
Thanks, but I'm not sure what you mean by this sorry? I was referring to the number of times it runs each hour, according to the logs. e.g. it ran three times at 12pm, and twice at 1pm - but after the first run each hour, the rest don't appear to be doing anything?
|
Yes, but no need, as even at every hour it only uses approx. half of the available calls. The duplicate checks are not polling the API. But you would know this as you wrote it! :-) |
Nope, it's failed the two days since! Today it made 54 API calls in 3 hours. Below are the logs. 11am local time is midnight UTC, when Solcast reset. Note 12pm - it made a LOT of calls. Is there anything else I can get you that might help you understand what it's doing? Logs
|
Additional errors FYI, mostly at the end of the log. 49 API calls made in just two hours! Logs
|
Similar problem here. It looks like every time it makes calls, it makes 2 more than the previous time. Soon adds up... |
its 3:34 am (UTC) here and I've done my 50 for the day already. |
I set the slider to 4 hours and still did 42/50 requests for the day. |
|
For now in HACS roll back to an earlier version |
Confirming 1.0.5 is working very well for me - it can also be manually downloaded from here. EDIT: Here's how to do this manually if you can't roll it back in HACS (as mine doesn't offer me versions?)
|
Thanks for the directions. seems better already |
Just installed 1.0.5, so interested to see how it goes. I do, however, see these log messages every 30 seconds (without the API count sensor going up). Would this be considered normal?
|
Yes 1.0.5 runs every 30 seconds, but only makes two API requests per hour. I've been running it for 5 days and haven't gone anywhere near the 50 limit on any day yet |
Followed the instructions at this post above. #11 (comment) |
@oziee Hi. I'm wondering whether I may ask what your plans are for this great integration. It does seem that 1.0.5 solves the API limit problem, but I'm not sure what is in 1.0.8 that we're missing out on. I'm also wondering what 1.0.5 is doing every 30 seconds. Thanks for any pointers... |
Yes I'm still working on it. I tried to comply with HA requirements to release it in the core, but it just created more problems It's set to polling that is why things in 1.05 happen every 30s I have been working in using the recorder for HA to record data pulled from solcast But my main problem has been finding time to work on it all |
Thank you for replying. I can appreciate that time is always a problem! What exactly does it do every 30 seconds? Clearly, it’s not polling the API. In what way do you want to use the recorder then? From what I’ve seen posted by others, the Energy platform takes the data you supply and adds it to the solar production graph. I’m not sure what else is required, and the recorder will be keeping a history of your created sensors. |
30s is a HA thing not me. It's ok Forecast api doesn't work like anything else. It's just a function call to return data.. it isn't a sensor etc so it does not store anything. You can play with the forecast.solar integration with a dummy lat/long to see how that item too does not save or recall saved data. It too is just a function call returning data HA wants (a dict of values and date times) |
OK, thanks. Pretty new to all this!
I was thinking of the sensors like “forecast - tomorrow”, “forecast - next hour”. They’re in Recorder. Are they created by HA from data you feed? I’m not sure I see a need for any other historical data to be recorded. But maybe that’s just me! |
Just reporting in that i set this integration up yesterday and have had the same issue, looks like it used 55 API calls in a little over an hour. |
Yes. Just follow the instructions at #11 (comment) to go to 1.0.5 for now, and I think all will be well. |
hoping tomorrow to PR a fully reworked code |
Personally, I think not calling the API between sunset and sunrise is a bit too aggressive. I use the forecast for tomorrow to decide whether to run a pool heater overnight or during the next day. I presume tomorrow’s forecast can be constantly changing, right up until midnight. Plus, with calls only once an hour, it shouldn’t really be necessary to restrict the calls most of the time. Maybe we could not call the API between 10pm and sunrise? Or optionally don’t have blackout periods at all? |
I tend to agree, I use the forecast to decide if i should sell my excess battery storage in the morning, So it would be best if I have accurate forecast data at 3-5am to make that call |
calm down.. calm down :) hahahah... can never make one thing work a million different ways, but it will be ok
|
Thanks @oziee ! Yes - a service call should cater for most people’s whims… |
time to delete your integrations (copy the API and resource id for quick re-setup) update to v2 :) then update |
Any chance of a tagged 'release'? https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases |
just remember to add to the recorder if you are filtering it something like
|
The updated integration is using a lot of calls - 55 calls in 8 hours? (ie. more than the limit!?).
The flat maxed-out line was a couple of template sensors I was using, until I found and installed your integration for the Energy portal, about 3 weeks ago. It was working well, until the update yesterday.
Having some issues (it wouldn't update and maxed out the API calls), last night I removed the integration and custom component (restarting HA) and after the Solcast UTC counter reset this morning, I reinstalled them both "from scratch". It's getting values again, but has already maxed out the API calls so won't get anything tomorrow morning until the counter resets at 11am local time.
I'm not sure how to see/provide the logs from your HACS add-on though?
Thanks for your work on this integration! :-)
The text was updated successfully, but these errors were encountered: