-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add SMHI as an weather provider for Sweden #51
Conversation
Thanks for that , looks good. I'm just testing this and going to make a few changes. The weather symbol position in the JSON seems to change so I'll keep a part of the loop. And there's a comment about getting the min/max of the next XX hours, I'm just working on that now, I'll push it up. I've had to do this in another weather provider too so it isn't too difficult. Some notes for myself:
|
for param in weather_data[item]['parameters']: | ||
if param['name'] == 't': | ||
temp = param['values'][0] | ||
temp_list.append(temp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looping through 12 forecasts, getting the temperature out, adding it to a list, then below getting min and max of those temperatures. So it acts as a min/max forecast for 12 hours.
The weather symbol unfortunately that's a bit difficult since there's no "min/max" or "average" of symbols.
# Get the weather code of the first item. | ||
for data in weather_data[0]["parameters"]: | ||
if data["name"] == "Wsymb2": | ||
weather_code = data["values"][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing the weather symbol was sometimes appearing in a different location so I decided just keep the looping bit to find the Wsymb2.
Thanks, done and merged. I've added to the changelog as well. |
Add SMHI (Swedish Meteorological and Hydrological Institute) as an weather provider for Sweden