Skip to content

Commit

Permalink
fix: replace deprecated is_metric
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealWaldo committed Jan 5, 2023
1 parent 03c8530 commit 5cfedb1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions custom_components/optimal_humidity/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@
CONF_COMFORTABLE_SPECIFIC_HUMIDITY,
ATTR_COMFORTABLE_SPECIFIC_HUMIDITY,
)

from homeassistant import util

from homeassistant.util.unit_system import METRIC_SYSTEM

from homeassistant.components.sensor import (
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
)

from homeassistant.components.sensor import SensorDeviceClass

from homeassistant.const import (
Expand All @@ -47,6 +50,7 @@
STATE_UNKNOWN,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
METRIC_SYSTEM,
)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -148,7 +152,10 @@ def __init__(
self._indoor_humidity_sensor = indoor_humidity_sensor
self._critical_temp_sensor = critical_temp_sensor
self._sensor_type = sensor_type
self._is_metric = hass.config.units.is_metric
if hass.config.units is METRIC_SYSTEM:
self._is_metric = True
else:
self._is_metric = False

psychrolib.SetUnitSystem(psychrolib.SI)
self._indoor_pressure = psychrolib.GetStandardAtmPressure(
Expand Down

0 comments on commit 5cfedb1

Please sign in to comment.