Add humidity to tomorrowio hourly weather forecasts (#70186)
* Add humidity to hourly weather forecasts * Don't include humidity in daily forecasts * Fix testpull/70295/head
parent
2228ea5ee0
commit
febcab11fb
|
@ -297,6 +297,7 @@ class TomorrowioDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
[
|
||||
TMRW_ATTR_TEMPERATURE_LOW,
|
||||
TMRW_ATTR_TEMPERATURE_HIGH,
|
||||
TMRW_ATTR_HUMIDITY,
|
||||
TMRW_ATTR_WIND_SPEED,
|
||||
TMRW_ATTR_WIND_DIRECTION,
|
||||
TMRW_ATTR_CONDITION,
|
||||
|
|
|
@ -18,6 +18,9 @@ from homeassistant.components.weather import (
|
|||
ATTR_CONDITION_WINDY,
|
||||
)
|
||||
|
||||
# Attribute missing from homeassistant.components.weather
|
||||
ATTR_FORECAST_HUMIDITY = "humidity"
|
||||
|
||||
CONF_TIMESTEP = "timestep"
|
||||
FORECAST_TYPES = [DAILY, HOURLY, NOWCAST]
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ from homeassistant.util import dt as dt_util
|
|||
|
||||
from . import TomorrowioDataUpdateCoordinator, TomorrowioEntity
|
||||
from .const import (
|
||||
ATTR_FORECAST_HUMIDITY,
|
||||
CLEAR_CONDITIONS,
|
||||
CONDITIONS,
|
||||
CONF_TIMESTEP,
|
||||
|
@ -100,6 +101,7 @@ class TomorrowioWeatherEntity(TomorrowioEntity, WeatherEntity):
|
|||
forecast_dt: datetime,
|
||||
use_datetime: bool,
|
||||
condition: int,
|
||||
humidity: float | None,
|
||||
precipitation: float | None,
|
||||
precipitation_probability: float | None,
|
||||
temp: float | None,
|
||||
|
@ -118,6 +120,7 @@ class TomorrowioWeatherEntity(TomorrowioEntity, WeatherEntity):
|
|||
data = {
|
||||
ATTR_FORECAST_TIME: forecast_dt.isoformat(),
|
||||
ATTR_FORECAST_CONDITION: translated_condition,
|
||||
ATTR_FORECAST_HUMIDITY: humidity,
|
||||
ATTR_FORECAST_PRECIPITATION: precipitation,
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY: precipitation_probability,
|
||||
ATTR_FORECAST_TEMP: temp,
|
||||
|
@ -211,6 +214,7 @@ class TomorrowioWeatherEntity(TomorrowioEntity, WeatherEntity):
|
|||
use_datetime = True
|
||||
|
||||
condition = values.get(TMRW_ATTR_CONDITION)
|
||||
humidity = values.get(TMRW_ATTR_HUMIDITY)
|
||||
precipitation = values.get(TMRW_ATTR_PRECIPITATION)
|
||||
precipitation_probability = values.get(TMRW_ATTR_PRECIPITATION_PROBABILITY)
|
||||
|
||||
|
@ -237,6 +241,7 @@ class TomorrowioWeatherEntity(TomorrowioEntity, WeatherEntity):
|
|||
forecast_dt,
|
||||
use_datetime,
|
||||
condition,
|
||||
None if self.forecast_type == DAILY else humidity,
|
||||
precipitation,
|
||||
precipitation_probability,
|
||||
temp,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue