Fix OpenWeatherMap dewpoint conversion (#56303)

This commit is contained in:
Brian O'Connor 2021-09-23 13:14:15 -04:00 committed by GitHub
parent 70f10338cc
commit cce906f968
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,10 +18,10 @@ from homeassistant.components.weather import (
ATTR_FORECAST_WIND_BEARING,
ATTR_FORECAST_WIND_SPEED,
)
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers import sun
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util import dt
from homeassistant.util.temperature import kelvin_to_celsius
from .const import (
ATTR_API_CLOUDS,
@ -180,10 +180,10 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
return forecast
def _fmt_dewpoint(self, dewpoint):
@staticmethod
def _fmt_dewpoint(dewpoint):
if dewpoint is not None:
dewpoint = dewpoint - 273.15
return round(self.hass.config.units.temperature(dewpoint, TEMP_CELSIUS), 1)
return round(kelvin_to_celsius(dewpoint), 1)
return None
@staticmethod