mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Convert ecobee pressure to local units (#51379)
* Convert ecobee pressure to local units * Round inHg to 2 places
This commit is contained in:
parent
c21895facb
commit
d3a4e21cb5
@ -12,8 +12,9 @@ from homeassistant.components.weather import (
|
|||||||
ATTR_FORECAST_WIND_SPEED,
|
ATTR_FORECAST_WIND_SPEED,
|
||||||
WeatherEntity,
|
WeatherEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import TEMP_FAHRENHEIT
|
from homeassistant.const import PRESSURE_HPA, PRESSURE_INHG, TEMP_FAHRENHEIT
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
from homeassistant.util.pressure import convert as pressure_convert
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
@ -113,7 +114,11 @@ class EcobeeWeather(WeatherEntity):
|
|||||||
def pressure(self):
|
def pressure(self):
|
||||||
"""Return the pressure."""
|
"""Return the pressure."""
|
||||||
try:
|
try:
|
||||||
return int(self.get_forecast(0, "pressure"))
|
pressure = self.get_forecast(0, "pressure")
|
||||||
|
if not self.hass.config.units.is_metric:
|
||||||
|
pressure = pressure_convert(pressure, PRESSURE_HPA, PRESSURE_INHG)
|
||||||
|
return round(pressure, 2)
|
||||||
|
return round(pressure)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user