mirror of
https://github.com/elisspace/core.git
synced 2026-10-06 01:06:26 +00:00
* Add a DataUpdateCoordinator to Hydrawise * Replace DATA_HYDRAWISE with DOMAIN * Replace persistent notification with a ConfigEntryNotReady exception * Changes requested during PR review * Add a type annotation to the `monitored_conditions` field. Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
34 lines
941 B
Python
34 lines
941 B
Python
"""Base classes for Hydrawise entities."""
|
|
|
|
from typing import Any
|
|
|
|
from homeassistant.helpers.entity import EntityDescription
|
|
from homeassistant.helpers.update_coordinator import (
|
|
CoordinatorEntity,
|
|
DataUpdateCoordinator,
|
|
)
|
|
|
|
|
|
class HydrawiseEntity(CoordinatorEntity):
|
|
"""Entity class for Hydrawise devices."""
|
|
|
|
_attr_attribution = "Data provided by hydrawise.com"
|
|
|
|
def __init__(
|
|
self,
|
|
*,
|
|
data: dict[str, Any],
|
|
coordinator: DataUpdateCoordinator,
|
|
description: EntityDescription,
|
|
) -> None:
|
|
"""Initialize the Hydrawise entity."""
|
|
super().__init__(coordinator=coordinator)
|
|
self.data = data
|
|
self.entity_description = description
|
|
self._attr_name = f"{self.data['name']} {description.name}"
|
|
|
|
@property
|
|
def extra_state_attributes(self):
|
|
"""Return the state attributes."""
|
|
return {"identifier": self.data.get("relay")}
|