Add feels like temperature sensor to OpenWeatherMap (#47559)

pull/47626/head
Evgeny 2021-03-08 13:51:26 +01:00 committed by GitHub
parent f3c71a69f0
commit cf507b51cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -49,6 +49,7 @@ ATTR_API_PRECIPITATION = "precipitation"
ATTR_API_DATETIME = "datetime"
ATTR_API_WEATHER = "weather"
ATTR_API_TEMPERATURE = "temperature"
ATTR_API_FEELS_LIKE_TEMPERATURE = "feels_like_temperature"
ATTR_API_WIND_SPEED = "wind_speed"
ATTR_API_WIND_BEARING = "wind_bearing"
ATTR_API_HUMIDITY = "humidity"
@ -81,6 +82,7 @@ DEFAULT_FORECAST_MODE = FORECAST_MODE_ONECALL_DAILY
MONITORED_CONDITIONS = [
ATTR_API_WEATHER,
ATTR_API_TEMPERATURE,
ATTR_API_FEELS_LIKE_TEMPERATURE,
ATTR_API_WIND_SPEED,
ATTR_API_WIND_BEARING,
ATTR_API_HUMIDITY,
@ -190,6 +192,11 @@ WEATHER_SENSOR_TYPES = {
SENSOR_UNIT: TEMP_CELSIUS,
SENSOR_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE,
},
ATTR_API_FEELS_LIKE_TEMPERATURE: {
SENSOR_NAME: "Feels like temperature",
SENSOR_UNIT: TEMP_CELSIUS,
SENSOR_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE,
},
ATTR_API_WIND_SPEED: {
SENSOR_NAME: "Wind speed",
SENSOR_UNIT: SPEED_METERS_PER_SECOND,

View File

@ -25,6 +25,7 @@ from homeassistant.util import dt
from .const import (
ATTR_API_CLOUDS,
ATTR_API_CONDITION,
ATTR_API_FEELS_LIKE_TEMPERATURE,
ATTR_API_FORECAST,
ATTR_API_HUMIDITY,
ATTR_API_PRESSURE,
@ -115,6 +116,9 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
return {
ATTR_API_TEMPERATURE: current_weather.temperature("celsius").get("temp"),
ATTR_API_FEELS_LIKE_TEMPERATURE: current_weather.temperature("celsius").get(
"feels_like"
),
ATTR_API_PRESSURE: current_weather.pressure.get("press"),
ATTR_API_HUMIDITY: current_weather.humidity,
ATTR_API_WIND_BEARING: current_weather.wind().get("deg"),