Skip to content

Commit ca79d37

Browse files
authored
Use native_value property instead of _attr_native_value in the Brother integration (home-assistant#156878)
1 parent df8ef15 commit ca79d37

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

homeassistant/components/brother/sensor.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
SensorStateClass,
1818
)
1919
from homeassistant.const import PERCENTAGE, EntityCategory
20-
from homeassistant.core import HomeAssistant, callback
20+
from homeassistant.core import HomeAssistant
2121
from homeassistant.helpers import entity_registry as er
2222
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
2323
from homeassistant.helpers.typing import StateType
@@ -345,12 +345,10 @@ def __init__(
345345
"""Initialize."""
346346
super().__init__(coordinator)
347347

348-
self._attr_native_value = description.value(coordinator.data)
349348
self._attr_unique_id = f"{coordinator.brother.serial.lower()}_{description.key}"
350349
self.entity_description = description
351350

352-
@callback
353-
def _handle_coordinator_update(self) -> None:
354-
"""Handle updated data from the coordinator."""
355-
self._attr_native_value = self.entity_description.value(self.coordinator.data)
356-
self.async_write_ha_state()
351+
@property
352+
def native_value(self) -> StateType | datetime:
353+
"""Return the native value of the sensor."""
354+
return self.entity_description.value(self.coordinator.data)

0 commit comments

Comments
 (0)