Skip to content
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

No daily weather #15

Open
kairapl opened this issue Mar 20, 2021 · 2 comments
Open

No daily weather #15

kairapl opened this issue Mar 20, 2021 · 2 comments

Comments

@kairapl
Copy link

kairapl commented Mar 20, 2021

After following all the instructions in github page it turns out, that daily forecast doesn't work/needs different API.
All of the fileds works like a charm besides 4 smaller weather fileds. While running script message says:

python3 /home/pi/EInk-Calendar/main.py -c /home/pi/EInk-Calendar/settings
Your API subscription level does not allow to perform this operation
Reason: Invalid API Key provided
2021-03-20 08:44:42,323 INFO Periodic update of the screen

I don't know unfortunately anything about python, so I can't repair it by myself.

@zli117
Copy link
Owner

zli117 commented Apr 26, 2021

How did you generate the API keys

@mav555555
Copy link

mav555555 commented Jul 3, 2021

I encountered and worked this out myself...
OpenWeatherMap have implemented restrictions on the API calls which are possible at the free tier, so the current day data returns and can be displayed, but the daily forecast data is where the API key error comes from. If your API key predates the change, however, you still get that daily forecast - it only affects new free tier users.
The daily and forecast is bundled into the same calls in the v2 pyowm library (I think), but there is a workaround for it in the more recent v3 - but there are lots of other changes at the same time, so a bunch of stuff needs to be changed: https://pyowm.readthedocs.io/en/latest/v3/code-recipes.html
...Using the new functionality, one can use the OneCall to gather both the current day's data and the forecast. To swap that out changes are needed in the model/weather.py to change to, for example:
one_call.forecast_daily[i].weather_code ...for the weather code.
get_reference_time() converts to... one_call.current.reference_time(timeformat='date').date()

Two big changes though, is an additional step to use 'weather_manager()', and OneCall can only be called using lat and lon, rather than the city ID

Providing a full breakdown of the needed code changes is beyond my skills, though I did manage to fuss about and make it work for me. So I hope the above helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants