From b76ba002e2611bb1e51a218d80f70ab7b5af0fc7 Mon Sep 17 00:00:00 2001 From: lymanepp <4195527+lymanepp@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:12:18 -0400 Subject: [PATCH] Fix missing dew point and humidity in tomorrowio forecasts (#99793) * Fix missing dew point and humidity in tomorrowio forecasts * Add assertion for correct parameters to realtime_and_all_forecasts method --- .../components/tomorrowio/__init__.py | 2 + tests/components/tomorrowio/test_weather.py | 59 ++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tomorrowio/__init__.py b/homeassistant/components/tomorrowio/__init__.py index 41fa8158624..77675e3f2ec 100644 --- a/homeassistant/components/tomorrowio/__init__.py +++ b/homeassistant/components/tomorrowio/__init__.py @@ -302,6 +302,8 @@ class TomorrowioDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]): [ TMRW_ATTR_TEMPERATURE_LOW, TMRW_ATTR_TEMPERATURE_HIGH, + TMRW_ATTR_DEW_POINT, + TMRW_ATTR_HUMIDITY, TMRW_ATTR_WIND_SPEED, TMRW_ATTR_WIND_DIRECTION, TMRW_ATTR_CONDITION, diff --git a/tests/components/tomorrowio/test_weather.py b/tests/components/tomorrowio/test_weather.py index a6a5e935614..229e62065a6 100644 --- a/tests/components/tomorrowio/test_weather.py +++ b/tests/components/tomorrowio/test_weather.py @@ -153,9 +153,66 @@ async def test_legacy_config_entry(hass: HomeAssistant) -> None: assert len(er.async_entries_for_config_entry(registry, entry.entry_id)) == 30 -async def test_v4_weather(hass: HomeAssistant) -> None: +async def test_v4_weather(hass: HomeAssistant, tomorrowio_config_entry_update) -> None: """Test v4 weather data.""" weather_state = await _setup(hass, API_V4_ENTRY_DATA) + + tomorrowio_config_entry_update.assert_called_with( + [ + "temperature", + "humidity", + "pressureSeaLevel", + "windSpeed", + "windDirection", + "weatherCode", + "visibility", + "pollutantO3", + "windGust", + "cloudCover", + "precipitationType", + "pollutantCO", + "mepIndex", + "mepHealthConcern", + "mepPrimaryPollutant", + "cloudBase", + "cloudCeiling", + "cloudCover", + "dewPoint", + "epaIndex", + "epaHealthConcern", + "epaPrimaryPollutant", + "temperatureApparent", + "fireIndex", + "pollutantNO2", + "pollutantO3", + "particulateMatter10", + "particulateMatter25", + "grassIndex", + "treeIndex", + "weedIndex", + "precipitationType", + "pressureSurfaceLevel", + "solarGHI", + "pollutantSO2", + "uvIndex", + "uvHealthConcern", + "windGust", + ], + [ + "temperatureMin", + "temperatureMax", + "dewPoint", + "humidity", + "windSpeed", + "windDirection", + "weatherCode", + "precipitationIntensityAvg", + "precipitationProbability", + ], + nowcast_timestep=60, + location="80.0,80.0", + ) + assert weather_state.state == ATTR_CONDITION_SUNNY assert weather_state.attributes[ATTR_ATTRIBUTION] == ATTRIBUTION assert len(weather_state.attributes[ATTR_FORECAST]) == 14