Fix temperature unit in sensor for Sensibo (#80843)

This commit is contained in:
G Johansson 2022-10-23 22:24:55 +02:00 committed by GitHub
parent b04165b495
commit d85866d49c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,6 @@ from homeassistant.const import (
PERCENTAGE,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
@ -263,9 +262,7 @@ class SensiboMotionSensor(SensiboMotionBaseEntity, SensorEntity):
def native_unit_of_measurement(self) -> str | None:
"""Add native unit of measurement."""
if self.entity_description.device_class == SensorDeviceClass.TEMPERATURE:
return (
TEMP_CELSIUS if self.device_data.temp_unit == "C" else TEMP_FAHRENHEIT
)
return TEMP_CELSIUS
return self.entity_description.native_unit_of_measurement
@property
@ -299,9 +296,7 @@ class SensiboDeviceSensor(SensiboDeviceBaseEntity, SensorEntity):
def native_unit_of_measurement(self) -> str | None:
"""Add native unit of measurement."""
if self.entity_description.device_class == SensorDeviceClass.TEMPERATURE:
return (
TEMP_CELSIUS if self.device_data.temp_unit == "C" else TEMP_FAHRENHEIT
)
return TEMP_CELSIUS
return self.entity_description.native_unit_of_measurement
@property