mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix Met.no forecast precipitation (#44106)
This commit is contained in:
parent
ce3f6c368a
commit
e33405a8b0
@ -21,8 +21,10 @@ from homeassistant.const import (
|
|||||||
CONF_LATITUDE,
|
CONF_LATITUDE,
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
LENGTH_INCHES,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
LENGTH_MILES,
|
LENGTH_MILES,
|
||||||
|
LENGTH_MILLIMETERS,
|
||||||
PRESSURE_HPA,
|
PRESSURE_HPA,
|
||||||
PRESSURE_INHG,
|
PRESSURE_INHG,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
@ -32,7 +34,14 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|||||||
from homeassistant.util.distance import convert as convert_distance
|
from homeassistant.util.distance import convert as convert_distance
|
||||||
from homeassistant.util.pressure import convert as convert_pressure
|
from homeassistant.util.pressure import convert as convert_pressure
|
||||||
|
|
||||||
from .const import ATTR_MAP, CONDITIONS_MAP, CONF_TRACK_HOME, DOMAIN, FORECAST_MAP
|
from .const import (
|
||||||
|
ATTR_FORECAST_PRECIPITATION,
|
||||||
|
ATTR_MAP,
|
||||||
|
CONDITIONS_MAP,
|
||||||
|
CONF_TRACK_HOME,
|
||||||
|
DOMAIN,
|
||||||
|
FORECAST_MAP,
|
||||||
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -221,6 +230,14 @@ class MetWeather(CoordinatorEntity, WeatherEntity):
|
|||||||
for k, v in FORECAST_MAP.items()
|
for k, v in FORECAST_MAP.items()
|
||||||
if met_item.get(v) is not None
|
if met_item.get(v) is not None
|
||||||
}
|
}
|
||||||
|
if not self._is_metric:
|
||||||
|
if ATTR_FORECAST_PRECIPITATION in ha_item:
|
||||||
|
precip_inches = convert_distance(
|
||||||
|
ha_item[ATTR_FORECAST_PRECIPITATION],
|
||||||
|
LENGTH_MILLIMETERS,
|
||||||
|
LENGTH_INCHES,
|
||||||
|
)
|
||||||
|
ha_item[ATTR_FORECAST_PRECIPITATION] = round(precip_inches, 2)
|
||||||
if ha_item.get(ATTR_FORECAST_CONDITION):
|
if ha_item.get(ATTR_FORECAST_CONDITION):
|
||||||
ha_item[ATTR_FORECAST_CONDITION] = format_condition(
|
ha_item[ATTR_FORECAST_CONDITION] = format_condition(
|
||||||
ha_item[ATTR_FORECAST_CONDITION]
|
ha_item[ATTR_FORECAST_CONDITION]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user