Add precipitation probability forecast to owm (#47284)
* Add precipitation probability forecast to owm * Update weather_update_coordinator.py Reformat the code based on blackpull/47555/head
parent
f542b360d5
commit
9101ed2732
|
@ -16,6 +16,7 @@ from homeassistant.components.weather import (
|
|||
ATTR_CONDITION_WINDY_VARIANT,
|
||||
ATTR_FORECAST_CONDITION,
|
||||
ATTR_FORECAST_PRECIPITATION,
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
|
||||
ATTR_FORECAST_PRESSURE,
|
||||
ATTR_FORECAST_TEMP,
|
||||
ATTR_FORECAST_TEMP_LOW,
|
||||
|
@ -93,6 +94,7 @@ MONITORED_CONDITIONS = [
|
|||
FORECAST_MONITORED_CONDITIONS = [
|
||||
ATTR_FORECAST_CONDITION,
|
||||
ATTR_FORECAST_PRECIPITATION,
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
|
||||
ATTR_FORECAST_PRESSURE,
|
||||
ATTR_FORECAST_TEMP,
|
||||
ATTR_FORECAST_TEMP_LOW,
|
||||
|
@ -212,6 +214,7 @@ WEATHER_SENSOR_TYPES = {
|
|||
FORECAST_SENSOR_TYPES = {
|
||||
ATTR_FORECAST_CONDITION: {SENSOR_NAME: "Condition"},
|
||||
ATTR_FORECAST_PRECIPITATION: {SENSOR_NAME: "Precipitation"},
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY: {SENSOR_NAME: "Precipitation probability"},
|
||||
ATTR_FORECAST_PRESSURE: {SENSOR_NAME: "Pressure"},
|
||||
ATTR_FORECAST_TEMP: {
|
||||
SENSOR_NAME: "Temperature",
|
||||
|
|
|
@ -10,6 +10,7 @@ from homeassistant.components.weather import (
|
|||
ATTR_CONDITION_SUNNY,
|
||||
ATTR_FORECAST_CONDITION,
|
||||
ATTR_FORECAST_PRECIPITATION,
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
|
||||
ATTR_FORECAST_PRESSURE,
|
||||
ATTR_FORECAST_TEMP,
|
||||
ATTR_FORECAST_TEMP_LOW,
|
||||
|
@ -143,6 +144,9 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
|||
ATTR_FORECAST_PRECIPITATION: self._calc_precipitation(
|
||||
entry.rain, entry.snow
|
||||
),
|
||||
ATTR_FORECAST_PRECIPITATION_PROBABILITY: (
|
||||
entry.precipitation_probability * 100
|
||||
),
|
||||
ATTR_FORECAST_PRESSURE: entry.pressure.get("press"),
|
||||
ATTR_FORECAST_WIND_SPEED: entry.wind().get("speed"),
|
||||
ATTR_FORECAST_WIND_BEARING: entry.wind().get("deg"),
|
||||
|
|
Loading…
Reference in New Issue