-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Weather module (yr) stops after a while #3296
Comments
as you already suggests "error response from YR" this sounds like problems on their side or they may restrict access if there are to many requests. You can try with an increased update interval. @rejas is it possible to improve the code so that the weather module starts working again after such errors? |
other weather providers and calendar module have the same problem. limited error recovery |
probably :-) but since I am still recovering from surgery I dont think I can cook something up until the next release. |
Yes, I agree it's from their side. Their API says they reply with a 429 error message if they feel like you're sending too often. I already tried limiting my api calls by lowering the forecast api calls ( |
@Jessendelft your delay is only 120 seconds the delay is milliseconds 5 or 10 minutes might be better 10 * 60 * 1000 |
Well I'll be damned... That was supposed to be 10 and ~20 minutes. Forgot a 0, and that should hopefully fix my issue of too many requests. I'll let you know. |
no, tested this, all other providers and calendar will recover with next update interval if there were fetch problems. The yr provider is special, it caches data in local storage in the browser. I deactivated my internet connection and even after browser restart (cached) yr data is displayed. Will not look deeper into this, its a nightmare to debug. |
Just to confirm, the error still pops up even with my intended delays of 10 and ~20 minutes for my two weather modules. So it's still an issue, and I'd appreciate a fix that recovers from an empty response. |
I added a Pull Request that fixes this (3706). The module should now be able to recover from errors like HTTP 429. The main reason for the errors is HTTP 429 Too Many Requests. From the terms of service:
I don't know how we can limit the traffic. We have implemented caching and use the Maybe we should treat the MagicMirror as a "mobile device" and make sure we don't make more than one poll every 10 minutes? This can happen if the We can add something like this in if (this.config.updateInterval < 600000) {
Log.error("The Yr weather provider requires an update interval of at least 10 minutes (600 000 ms). Please increase the update interval in your configuration.");
throw new Error("Update interval too short");
} What do you think? Should I add it to the PR? |
other suggestion: Set updateInterval to 600000 if the user provides a smaller value and log a warning. But you can decide ... |
Nice suggestion 😊 I agree changing the value instead of crashing is a much better user experience. I tried setting the |
Fixes #3296 The problem was that the fetch-methods threw errors when something went wrong instead of calling `updateAvailable()`. `updateAvailable()` must be called in order to schedule the next update. I added some filtering for the hourly forecast that removes hours in the past. If the API call fails we use the cached data, but we should only display hours in the future.
Running the latest MM v2.25.00 with the YR weather fix from #3227
I have 2 weather modules, 1 which shows the current weather and 1 that shows the forecast with the following config:
// Weather now { module: "weather", position: "top_right", config: { weatherProvider: "yr", type: "current", initialLoadDelay: 1000, updateInterval: 60000, appendLocationNameToHeader: false, onlyTemp: false, showWindDirection: false, showSun: false, lat: xx.xxxx, lon: xx.xxxx, altitude: 111 } }, // Daily forecast { module: "weather", position: "top_right", config: { weatherProvider: "yr", type: "daily", initialLoadDelay: 3000, updateInterval: 120630, appendLocationNameToHeader: false, maxNumberOfDays: 7, fade: true, fadepoint: 0.25, lat: xx.xxxx, lon: xx.xxxx, altitude: 111 }, },
After the module starts it stalls after a while, unsure how long after but within the same day.
I looked at the dev_tools, and this is the error log:
For some reason it gets an error response from YR, which causes the module to stop updating.
The text was updated successfully, but these errors were encountered: