Move temperature conversions to sensor base class (5/8) (#54475)

This commit is contained in:
Erik Montnemery 2021-08-12 13:26:17 +02:00 committed by GitHub
parent e55868b17f
commit 103e21c278
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 289 additions and 288 deletions

View file

@ -63,7 +63,7 @@ class NotionSensor(NotionEntity, SensorEntity):
coordinator, task_id, sensor_id, bridge_id, system_id, name, device_class
)
self._attr_unit_of_measurement = unit
self._attr_native_unit_of_measurement = unit
@callback
def _async_update_from_latest_data(self) -> None:
@ -71,7 +71,7 @@ class NotionSensor(NotionEntity, SensorEntity):
task = self.coordinator.data["tasks"][self._task_id]
if task["task_type"] == SENSOR_TEMPERATURE:
self._attr_state = round(float(task["status"]["value"]), 1)
self._attr_native_value = round(float(task["status"]["value"]), 1)
else:
LOGGER.error(
"Unknown task type: %s: %s",