Add new sensors to meteo_france (#44150)

Co-authored-by: Thibaut <thibaut@etienne.pw>
pull/45952/head^2
mbo18 2020-12-17 22:04:20 +01:00 committed by GitHub
parent 6ffa3c18b2
commit f54fcb7646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -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 = {

View File

@ -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