-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
If Aeris throws an exception Belchertown doesn't update #904
Comments
I don't know if this helps you but I wonder if the problem is caused by your use of the forecast extension. You don’t need it to be able to access Aeris forecasts from the Belchertown skin. I am not familiar with the forecast extension, the number of calls it makes to Aeris or the limit set by your access method to Aeris. |
No, it isn't related to the use of the forecast extension. It was because I had a bug in the refresh rate on Belchertown that was fetching the forecast once per minute. Once fixed the problem doesn't reproduce and still, I didn't expect Belchertown to just fail so completely when the forecast from Aeris failed. That is what I consider the root problem here. |
It's unlikely to occur under normal conditions, but otherwise fair point. Let's see if anyone with better python skills than me can provide a fix for the error conditions that Aeris can produce. |
I agree 100%. I've not got the python chops to fix it either. |
Um - this code looks funky to me.
Specifically a boolean appears to be checked for being greater than 300 from an C++ programmers POV wouldn't you check the time difference to be > 300, and the strftime to be cast to an int and then compared to the value 5? Could someone explain this logic please? |
I had this recently, wish I had seen this report before lots of fiddling around with the Pi & WeeWx to try to nail the issue. I also am not good enough at Python to fix it! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
If the first statement in parentheses evaluates to false, the entire |
As I modified the original code, let me answer your question. The original code ensured the forecast downloaded at every archive interval to reduce the load on the server (now AERIS). When I introduced the 1 hour and 3 hour options for the forecast (the original version was every 24 hours), I inserted the check on the minutes past the hour (05) to ensure that in a steady state the forecast was downloaded on the hour. So if the first forecast downloaded at 35 mins past the hour, this code would force the next forecast on the hour and then the original code thereafter, That looked tidier for the 1 hour forecasts. Does that help? I was finding my way with Python (still am!) so that may explain the coding. In retrospect, the 300 should have been replaced by forecast_stale_timer. Feel free to change it. Michael |
Apologies, there are a couple of errors in my last response |
I can replicate this bug by turning off API access in Aeris/XWeather (so it returns "403: Forbidden"), so I think having a fix in place would be a good idea, even though rate-limiting is unlikely to occur under normal conditions, for situations when the API isn't working for some reason. I'm opening a pull request. |
First step
install weewx, belchertown, and the forecast extension.
Describe the bug
It appears that belchertown doesn't expect the exception from aeris and just aborts page generation, rather it should put up some kind of error entry "Aeris forecast not available", as an example.
Link to your website (IMPORTANT)
http://www.kdbarto.org/weather/belchertown
Version of the skin you're using
1.3.1
To Reproduce
Steps to reproduce the behavior:
Run and re-run aeris forecast until you have used all your free connections in a day.
Restart weewx
Note that Belchertown no longer updates because of the thrown exception getting the aeris forecast.
Expected behavior
What would be nice is to have a default "Aeris forecast is unavailable "
In this cast the would say "Too Many Requests"
Screenshots
Device Information (please complete the following information):
MacOS 12.6.8
Weewx 4.10.2
Python 3.11.5
Forecast extension from https://github.com/chaunceygardiner/weewx-forecast
The text was updated successfully, but these errors were encountered: