mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Add Buienradar apparent temperature and forecast rain chance & wind gust (#135287)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
2eb1041f4b
commit
c6994731b1
@ -12,6 +12,7 @@ from buienradar.constants import (
|
||||
CONDITION,
|
||||
CONTENT,
|
||||
DATA,
|
||||
FEELTEMPERATURE,
|
||||
FORECAST,
|
||||
HUMIDITY,
|
||||
MESSAGE,
|
||||
@ -22,6 +23,7 @@ from buienradar.constants import (
|
||||
TEMPERATURE,
|
||||
VISIBILITY,
|
||||
WINDAZIMUTH,
|
||||
WINDGUST,
|
||||
WINDSPEED,
|
||||
)
|
||||
from buienradar.urls import JSON_FEED_URL, json_precipitation_forecast_url
|
||||
@ -200,6 +202,14 @@ class BrData:
|
||||
except (ValueError, TypeError):
|
||||
return None
|
||||
|
||||
@property
|
||||
def feeltemperature(self):
|
||||
"""Return the feeltemperature, or None."""
|
||||
try:
|
||||
return float(self.data.get(FEELTEMPERATURE))
|
||||
except (ValueError, TypeError):
|
||||
return None
|
||||
|
||||
@property
|
||||
def pressure(self):
|
||||
"""Return the pressure, or None."""
|
||||
@ -224,6 +234,14 @@ class BrData:
|
||||
except (ValueError, TypeError):
|
||||
return None
|
||||
|
||||
@property
|
||||
def wind_gust(self):
|
||||
"""Return the windgust, or None."""
|
||||
try:
|
||||
return float(self.data.get(WINDGUST))
|
||||
except (ValueError, TypeError):
|
||||
return None
|
||||
|
||||
@property
|
||||
def wind_speed(self):
|
||||
"""Return the windspeed, or None."""
|
||||
|
@ -9,6 +9,7 @@ from buienradar.constants import (
|
||||
MAX_TEMP,
|
||||
MIN_TEMP,
|
||||
RAIN,
|
||||
RAIN_CHANCE,
|
||||
WINDAZIMUTH,
|
||||
WINDSPEED,
|
||||
)
|
||||
@ -33,6 +34,7 @@ from homeassistant.components.weather import (
|
||||
ATTR_FORECAST_NATIVE_TEMP,
|
||||
ATTR_FORECAST_NATIVE_TEMP_LOW,
|
||||
ATTR_FORECAST_NATIVE_WIND_SPEED,
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
|
||||
ATTR_FORECAST_TIME,
|
||||
ATTR_FORECAST_WIND_BEARING,
|
||||
Forecast,
|
||||
@ -153,7 +155,9 @@ class BrWeather(WeatherEntity):
|
||||
)
|
||||
self._attr_native_pressure = data.pressure
|
||||
self._attr_native_temperature = data.temperature
|
||||
self._attr_native_apparent_temperature = data.feeltemperature
|
||||
self._attr_native_visibility = data.visibility
|
||||
self._attr_native_wind_gust_speed = data.wind_gust
|
||||
self._attr_native_wind_speed = data.wind_speed
|
||||
self._attr_wind_bearing = data.wind_bearing
|
||||
|
||||
@ -188,6 +192,7 @@ class BrWeather(WeatherEntity):
|
||||
ATTR_FORECAST_NATIVE_TEMP_LOW: data_in.get(MIN_TEMP),
|
||||
ATTR_FORECAST_NATIVE_TEMP: data_in.get(MAX_TEMP),
|
||||
ATTR_FORECAST_NATIVE_PRECIPITATION: data_in.get(RAIN),
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY: data_in.get(RAIN_CHANCE),
|
||||
ATTR_FORECAST_WIND_BEARING: data_in.get(WINDAZIMUTH),
|
||||
ATTR_FORECAST_NATIVE_WIND_SPEED: data_in.get(WINDSPEED),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user