diff --git a/homeassistant/components/htu21d/sensor.py b/homeassistant/components/htu21d/sensor.py index 4f93ecbc42d..7032f36919b 100644 --- a/homeassistant/components/htu21d/sensor.py +++ b/homeassistant/components/htu21d/sensor.py @@ -13,11 +13,10 @@ from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, PERCENTAGE, - TEMP_FAHRENHEIT, + TEMP_CELSIUS, ) import homeassistant.helpers.config_validation as cv from homeassistant.util import Throttle -from homeassistant.util.temperature import celsius_to_fahrenheit _LOGGER = logging.getLogger(__name__) @@ -48,7 +47,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= """Set up the HTU21D sensor.""" name = config.get(CONF_NAME) bus_number = config.get(CONF_I2C_BUS) - temp_unit = hass.config.units.temperature_unit bus = smbus.SMBus(config.get(CONF_I2C_BUS)) sensor = await hass.async_add_executor_job(partial(HTU21D, bus, logger=_LOGGER)) @@ -59,7 +57,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= sensor_handler = await hass.async_add_executor_job(HTU21DHandler, sensor) dev = [ - HTU21DSensor(sensor_handler, name, SENSOR_TEMPERATURE, temp_unit), + HTU21DSensor(sensor_handler, name, SENSOR_TEMPERATURE, TEMP_CELSIUS), HTU21DSensor(sensor_handler, name, SENSOR_HUMIDITY, PERCENTAGE), ] @@ -113,8 +111,6 @@ class HTU21DSensor(SensorEntity): if self._client.sensor.sample_ok: if self._variable == SENSOR_TEMPERATURE: value = round(self._client.sensor.temperature, 1) - if self.unit_of_measurement == TEMP_FAHRENHEIT: - value = celsius_to_fahrenheit(value) else: value = round(self._client.sensor.humidity, 1) self._state = value