Mill, use native_value (#61382)

This commit is contained in:
Daniel Hjelseth Høyer 2021-12-10 09:24:59 +01:00 committed by GitHub
parent 8c39eade5e
commit dd6b179549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -202,14 +202,8 @@ class LocalMillSensor(CoordinatorEntity, SensorEntity):
self._attr_name = (
f"{coordinator.mill_data_connection.name} {entity_description.name}"
)
self._update_attr()
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
self._update_attr()
self.async_write_ha_state()
@callback
def _update_attr(self) -> None:
self._attr_native_value = self.coordinator.data[self.entity_description.key]
@property
def native_value(self):
"""Return the native value of the sensor."""
return self.coordinator.data[self.entity_description.key]