-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
Met.no weather platform #16582
Met.no weather platform #16582
Conversation
continue | ||
|
||
if param == 'precipitation': | ||
new_state = loc_data[param]['@value'] |
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.
We should extract this into a third party lib.
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.
Ok 👍
self._pressure = metno.get_forecast('pressure', ordered_entries) | ||
self._humidity = metno.get_forecast('humidity', ordered_entries) | ||
self._wind_speed = metno.get_forecast('windSpeed', ordered_entries) | ||
self._wind_bearing = metno.get_forecast('windDirection', ordered_entries) |
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.
line too long (81 > 79 characters)
self._weather_data = metno.MetWeatherData(coordinates, | ||
clientsession, | ||
'https://aa015h6buqvih86i1.api.met.no/' | ||
'weatherapi/locationforecast/1.9/' |
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.
line too long (84 > 79 characters)
self._urlparams = coordinates | ||
self._weather_data = metno.MetWeatherData(coordinates, | ||
clientsession, | ||
'https://aa015h6buqvih86i1.api.met.no/' |
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.
line too long (89 > 79 characters)
'msl': str(elevation), | ||
} | ||
|
||
async_add_entities([MetWeather(name, coordinates, async_get_clientsession(hass))]) |
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.
line too long (86 > 79 characters)
Still need to test it more locally |
"""Initialise the platform with a data instance and site.""" | ||
import metno | ||
self._name = name | ||
self._urlparams = coordinates |
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.
This isn't used.
"""Start unavailability tracking.""" | ||
await self._fetching_data() | ||
|
||
async def _fetching_data(self, *_): |
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.
Rename to _fetch_data
.
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.
Nice!
@Danielhiversen merge when you're happy with testing. 👍 |
async def async_added_to_hass(self): | ||
"""Start fetching data.""" | ||
await self._fetch_data() | ||
async_track_utc_time_change(self.hass, self._update, minute=31, second=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.
line too long (81 > 79 characters)
https://home-assistant.io/components/weather.met/ | ||
""" | ||
import logging | ||
from datetime import timedelta |
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.
'datetime.timedelta' imported but unused
Description:
A weather component with data from Met.no
This is the same data source as the yr.no sensor.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#6287
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.