From f54fcb76468e316e48bdf44fa7aa3f949efa770a Mon Sep 17 00:00:00 2001 From: mbo18 Date: Thu, 17 Dec 2020 22:04:20 +0100 Subject: [PATCH] Add new sensors to meteo_france (#44150) Co-authored-by: Thibaut --- .../components/meteo_france/const.py | 24 +++++++++++++++++++ .../components/meteo_france/sensor.py | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/meteo_france/const.py b/homeassistant/components/meteo_france/const.py index 0055d323938..d642d3c6e0f 100644 --- a/homeassistant/components/meteo_france/const.py +++ b/homeassistant/components/meteo_france/const.py @@ -85,6 +85,14 @@ SENSOR_TYPES = { ENTITY_ENABLE: True, ENTITY_API_DATA_PATH: "probability_forecast:freezing", }, + "wind_gust": { + ENTITY_NAME: "Wind gust", + ENTITY_UNIT: SPEED_KILOMETERS_PER_HOUR, + ENTITY_ICON: "mdi:weather-windy-variant", + ENTITY_DEVICE_CLASS: None, + ENTITY_ENABLE: False, + ENTITY_API_DATA_PATH: "current_forecast:wind:gust", + }, "wind_speed": { ENTITY_NAME: "Wind speed", ENTITY_UNIT: SPEED_KILOMETERS_PER_HOUR, @@ -141,6 +149,22 @@ SENSOR_TYPES = { ENTITY_ENABLE: True, ENTITY_API_DATA_PATH: "current_forecast:clouds", }, + "original_condition": { + ENTITY_NAME: "Original condition", + ENTITY_UNIT: None, + ENTITY_ICON: None, + ENTITY_DEVICE_CLASS: None, + ENTITY_ENABLE: False, + ENTITY_API_DATA_PATH: "current_forecast:weather:desc", + }, + "daily_original_condition": { + ENTITY_NAME: "Daily original condition", + ENTITY_UNIT: None, + ENTITY_ICON: None, + ENTITY_DEVICE_CLASS: None, + ENTITY_ENABLE: False, + ENTITY_API_DATA_PATH: "today_forecast:weather12H:desc", + }, } CONDITION_CLASSES = { diff --git a/homeassistant/components/meteo_france/sensor.py b/homeassistant/components/meteo_france/sensor.py index 3c88914aafd..00f3c2da2cb 100644 --- a/homeassistant/components/meteo_france/sensor.py +++ b/homeassistant/components/meteo_france/sensor.py @@ -115,7 +115,7 @@ class MeteoFranceSensor(CoordinatorEntity): else: value = data[path[1]] - if self._type == "wind_speed": + if self._type in ["wind_speed", "wind_gust"]: # convert API wind speed from m/s to km/h value = round(value * 3.6) return value