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
1 changed files with 7 additions and 2 deletions
|
@ -12,8 +12,9 @@ from homeassistant.components.weather import (
|
|||
ATTR_FORECAST_WIND_SPEED,
|
||||
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.pressure import convert as pressure_convert
|
||||
|
||||
from .const import (
|
||||
_LOGGER,
|
||||
|
@ -113,7 +114,11 @@ class EcobeeWeather(WeatherEntity):
|
|||
def pressure(self):
|
||||
"""Return the pressure."""
|
||||
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:
|
||||
return None
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue