Fix OpenWeatherMap dewpoint conversion (#56303)
This commit is contained in:
parent
70f10338cc
commit
cce906f968
1 changed files with 4 additions and 4 deletions
|
@ -18,10 +18,10 @@ from homeassistant.components.weather import (
|
||||||
ATTR_FORECAST_WIND_BEARING,
|
ATTR_FORECAST_WIND_BEARING,
|
||||||
ATTR_FORECAST_WIND_SPEED,
|
ATTR_FORECAST_WIND_SPEED,
|
||||||
)
|
)
|
||||||
from homeassistant.const import TEMP_CELSIUS
|
|
||||||
from homeassistant.helpers import sun
|
from homeassistant.helpers import sun
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
from homeassistant.util import dt
|
from homeassistant.util import dt
|
||||||
|
from homeassistant.util.temperature import kelvin_to_celsius
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_API_CLOUDS,
|
ATTR_API_CLOUDS,
|
||||||
|
@ -180,10 +180,10 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
||||||
|
|
||||||
return forecast
|
return forecast
|
||||||
|
|
||||||
def _fmt_dewpoint(self, dewpoint):
|
@staticmethod
|
||||||
|
def _fmt_dewpoint(dewpoint):
|
||||||
if dewpoint is not None:
|
if dewpoint is not None:
|
||||||
dewpoint = dewpoint - 273.15
|
return round(kelvin_to_celsius(dewpoint), 1)
|
||||||
return round(self.hass.config.units.temperature(dewpoint, TEMP_CELSIUS), 1)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue