From 90bdbf503a399e822c0d984f5c83c2c098f0383a Mon Sep 17 00:00:00 2001 From: Arjan <44190435+vingerha@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:14:09 +0200 Subject: [PATCH] Add humidity to meteo_france weather forecast (#96524) Add humidity to forecast figures --- homeassistant/components/meteo_france/sensor.py | 7 +++++++ homeassistant/components/meteo_france/weather.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/homeassistant/components/meteo_france/sensor.py b/homeassistant/components/meteo_france/sensor.py index 8c27f2970a3..89faf6d80eb 100644 --- a/homeassistant/components/meteo_france/sensor.py +++ b/homeassistant/components/meteo_france/sensor.py @@ -137,6 +137,13 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = ( entity_registry_enabled_default=False, data_path="today_forecast:weather12H:desc", ), + MeteoFranceSensorEntityDescription( + key="humidity", + name="Humidity", + native_unit_of_measurement=PERCENTAGE, + icon="mdi:water-percent", + data_path="current_forecast:humidity", + ), ) SENSOR_TYPES_RAIN: tuple[MeteoFranceSensorEntityDescription, ...] = ( diff --git a/homeassistant/components/meteo_france/weather.py b/homeassistant/components/meteo_france/weather.py index 7709ba0a638..165cefc9240 100644 --- a/homeassistant/components/meteo_france/weather.py +++ b/homeassistant/components/meteo_france/weather.py @@ -6,6 +6,7 @@ from meteofrance_api.model.forecast import Forecast from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, + ATTR_FORECAST_HUMIDITY, ATTR_FORECAST_NATIVE_PRECIPITATION, ATTR_FORECAST_NATIVE_TEMP, ATTR_FORECAST_NATIVE_TEMP_LOW, @@ -171,6 +172,7 @@ class MeteoFranceWeather( ATTR_FORECAST_CONDITION: format_condition( forecast["weather"]["desc"] ), + ATTR_FORECAST_HUMIDITY: forecast["humidity"], ATTR_FORECAST_NATIVE_TEMP: forecast["T"]["value"], ATTR_FORECAST_NATIVE_PRECIPITATION: forecast["rain"].get("1h"), ATTR_FORECAST_NATIVE_WIND_SPEED: forecast["wind"]["speed"], @@ -192,6 +194,7 @@ class MeteoFranceWeather( ATTR_FORECAST_CONDITION: format_condition( forecast["weather12H"]["desc"] ), + ATTR_FORECAST_HUMIDITY: forecast["humidity"]["max"], ATTR_FORECAST_NATIVE_TEMP: forecast["T"]["max"], ATTR_FORECAST_NATIVE_TEMP_LOW: forecast["T"]["min"], ATTR_FORECAST_NATIVE_PRECIPITATION: forecast["precipitation"][