Make Hydrawise initialize data immediately (#101936)

This commit is contained in:
David Knowles 2023-10-30 10:18:59 -04:00 committed by GitHub
parent 92ec525de1
commit f160fa4bc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 45 additions and 86 deletions

View file

@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Any
from homeassistant.core import callback
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity import EntityDescription
from homeassistant.helpers.update_coordinator import CoordinatorEntity
@ -36,3 +37,14 @@ class HydrawiseEntity(CoordinatorEntity[HydrawiseDataUpdateCoordinator]):
name=data["name"],
manufacturer=MANUFACTURER,
)
self._update_attrs()
def _update_attrs(self) -> None:
"""Update state attributes."""
return # pragma: no cover
@callback
def _handle_coordinator_update(self) -> None:
"""Get the latest data and updates the state."""
self._update_attrs()
super()._handle_coordinator_update()