Lacerte / clima

MOVED TO https://codeberg.org/Lacerte/clima
Mozilla Public License 2.0
105 stars 14 forks source link

Automatic weather data polling #288

Open Matsyir opened 2 years ago

Matsyir commented 2 years ago

Is your feature request related to a problem? Please describe. I am using this app in a way that it's always open to display the weather. Having it automatically update as time passes would be very convenient.

Describe the solution you'd like Automatically refresh the weather data every N minutes depending on config (or never). This should probably not be available until you've entered a custom api key.

Additional context @mhmdanas seemed to show support for this in #275, and as long as this has a "never" option, it shouldn't affect those who only want manual polling.

The free tier of openweathermap offers a API limit of 1000 requests/day, which is enough to refresh the weather every 2 minutes and still have 280 requests left over, so that would be a comfortable maximum for the free tier. (You could do every 1.5 minutes also, but then barely have any left over, and 2 minutes is MORE than enough anyways)

prestosole commented 2 years ago

From https://openweathermap.org/appid

First, we recommend making API calls no more than once in 10 minutes for each location, whether you call it by city name, geographical coordinates or by zip code. The update frequency of the OpenWeather model is not higher than once in 10 minutes.

It will be practically useless to update the weather every 2 (or 1.5) minutes. Aside from that, I agree with all your points and the idea sounds great and useful to me. I am looking forward into implementing it in the future.

Matsyir commented 2 years ago

From https://openweathermap.org/appid (...) It will be practically useless to update the weather every 2 (or 1.5) minutes.

Makes sense to me, didn't look into that too much except for the rate limits.

One thing I had in mind when suggesting this though, which could be its own issue at this point: to have somewhat more "realtime" visual updates if you are looking at the main dashboard. Once you pass an hour mark, you will see the previous hour's weather on the hourly forecast until you refresh again - that's a bit odd. Similar thing for the daily forecast once you pass midnight. That's initially why I had in mind to make it 2 minutes, however if that's pointless for the data anyways, then that behavior could be scheduled using system time combined with the returned timezone of the selected city.. or something like that.