mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Use the unit converter directly in google_weather (#195447)
This commit is contained in:
@@ -41,8 +41,6 @@ from homeassistant.components.weather import (
|
||||
ATTR_FORECAST_TIME,
|
||||
ATTR_FORECAST_UV_INDEX,
|
||||
ATTR_FORECAST_WIND_BEARING,
|
||||
ATTR_WEATHER_PRECIPITATION_UNIT,
|
||||
UNIT_CONVERSIONS,
|
||||
CoordinatorWeatherEntity,
|
||||
Forecast,
|
||||
WeatherEntityFeature,
|
||||
@@ -61,6 +59,7 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.unit_conversion import DistanceConverter
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import (
|
||||
@@ -385,7 +384,7 @@ class GoogleWeatherEntity(
|
||||
"""
|
||||
if amount is None or amount.quantity is None:
|
||||
return None
|
||||
return UNIT_CONVERSIONS[ATTR_WEATHER_PRECIPITATION_UNIT](
|
||||
return DistanceConverter.convert(
|
||||
amount.quantity,
|
||||
UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
self._precipitation_unit,
|
||||
|
||||
Reference in New Issue
Block a user