mirror of
https://github.com/home-assistant/core.git
synced 2026-04-22 00:56:20 +00:00
Remove redudant state write in Smart Meter Texas (#154126)
This commit is contained in:
@@ -67,7 +67,7 @@ class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
|
||||
}
|
||||
|
||||
@callback
|
||||
def _state_update(self):
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Call when the coordinator has an update."""
|
||||
self._attr_available = self.coordinator.last_update_success
|
||||
if self._attr_available:
|
||||
@@ -77,7 +77,6 @@ class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Subscribe to updates."""
|
||||
await super().async_added_to_hass()
|
||||
self.async_on_remove(self.coordinator.async_add_listener(self._state_update))
|
||||
|
||||
# If the background update finished before
|
||||
# we added the entity, there is no need to restore
|
||||
|
||||
Reference in New Issue
Block a user