From 39843319e28f043c8e9e17bf3f4c2bcc4629cd5a Mon Sep 17 00:00:00 2001 From: Diogo Gomes Date: Tue, 11 Aug 2020 03:55:44 +0100 Subject: [PATCH] Update IPMA weather component (#38697) * long overdue mismatch * missing updated tests --- homeassistant/components/ipma/weather.py | 10 +++++----- tests/components/ipma/test_weather.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/ipma/weather.py b/homeassistant/components/ipma/weather.py index 62f1b0b39af..a2c47f43ffb 100644 --- a/homeassistant/components/ipma/weather.py +++ b/homeassistant/components/ipma/weather.py @@ -9,7 +9,7 @@ import voluptuous as vol from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, - ATTR_FORECAST_PRECIPITATION, + ATTR_FORECAST_PRECIPITATION_PROBABILITY, ATTR_FORECAST_TEMP, ATTR_FORECAST_TEMP_LOW, ATTR_FORECAST_TIME, @@ -256,9 +256,9 @@ class IPMAWeather(WeatherEntity): None, ), ATTR_FORECAST_TEMP: float(data_in.feels_like_temperature), - ATTR_FORECAST_PRECIPITATION: ( - data_in.precipitation_probability - if float(data_in.precipitation_probability) >= 0 + ATTR_FORECAST_PRECIPITATION_PROBABILITY: ( + int(float(data_in.precipitation_probability)) + if int(float(data_in.precipitation_probability)) >= 0 else None ), ATTR_FORECAST_WIND_SPEED: data_in.wind_strength, @@ -281,7 +281,7 @@ class IPMAWeather(WeatherEntity): ), ATTR_FORECAST_TEMP_LOW: data_in.min_temperature, ATTR_FORECAST_TEMP: data_in.max_temperature, - ATTR_FORECAST_PRECIPITATION: data_in.precipitation_probability, + ATTR_FORECAST_PRECIPITATION_PROBABILITY: data_in.precipitation_probability, ATTR_FORECAST_WIND_SPEED: data_in.wind_strength, ATTR_FORECAST_WIND_BEARING: data_in.wind_direction, } diff --git a/tests/components/ipma/test_weather.py b/tests/components/ipma/test_weather.py index c7a8bbda63f..bfe7eefbb4c 100644 --- a/tests/components/ipma/test_weather.py +++ b/tests/components/ipma/test_weather.py @@ -5,7 +5,7 @@ from homeassistant.components import weather from homeassistant.components.weather import ( ATTR_FORECAST, ATTR_FORECAST_CONDITION, - ATTR_FORECAST_PRECIPITATION, + ATTR_FORECAST_PRECIPITATION_PROBABILITY, ATTR_FORECAST_TEMP, ATTR_FORECAST_TEMP_LOW, ATTR_FORECAST_TIME, @@ -192,7 +192,7 @@ async def test_daily_forecast(hass): assert forecast.get(ATTR_FORECAST_CONDITION) == "rainy" assert forecast.get(ATTR_FORECAST_TEMP) == 16.2 assert forecast.get(ATTR_FORECAST_TEMP_LOW) == 10.6 - assert forecast.get(ATTR_FORECAST_PRECIPITATION) == "100.0" + assert forecast.get(ATTR_FORECAST_PRECIPITATION_PROBABILITY) == "100.0" assert forecast.get(ATTR_FORECAST_WIND_SPEED) == "10" assert forecast.get(ATTR_FORECAST_WIND_BEARING) == "S" @@ -216,6 +216,6 @@ async def test_hourly_forecast(hass): forecast = state.attributes.get(ATTR_FORECAST)[0] assert forecast.get(ATTR_FORECAST_CONDITION) == "rainy" assert forecast.get(ATTR_FORECAST_TEMP) == 7.7 - assert forecast.get(ATTR_FORECAST_PRECIPITATION) == "80.0" + assert forecast.get(ATTR_FORECAST_PRECIPITATION_PROBABILITY) == 80.0 assert forecast.get(ATTR_FORECAST_WIND_SPEED) == "32.7" assert forecast.get(ATTR_FORECAST_WIND_BEARING) == "S"