Add Buienradar apparent temperature and forecast rain chance & wind gust (#135287)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
Hugo van Rijswijk 2025-04-11 00:24:59 +02:00 committed by GitHub
parent 2eb1041f4b
commit c6994731b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -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."""

View File

@ -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),
}