Implement Airzone Cloud Zone climate support (#100792)
* Implement Airzone Cloud Zone climate support Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> * airzone_cloud: add entity naming Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> * airzone_cloud: implement requested changes Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> --------- Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
c59404b5bc
commit
3178eac9cc
6 changed files with 669 additions and 27 deletions
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aioairzone_cloud.const import (
|
||||
|
@ -15,7 +16,9 @@ from aioairzone_cloud.const import (
|
|||
AZD_WEBSERVERS,
|
||||
AZD_ZONES,
|
||||
)
|
||||
from aioairzone_cloud.exceptions import AirzoneCloudError
|
||||
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
@ -23,6 +26,8 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|||
from .const import DOMAIN, MANUFACTURER
|
||||
from .coordinator import AirzoneUpdateCoordinator
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AirzoneEntity(CoordinatorEntity[AirzoneUpdateCoordinator], ABC):
|
||||
"""Define an Airzone Cloud entity."""
|
||||
|
@ -36,6 +41,10 @@ class AirzoneEntity(CoordinatorEntity[AirzoneUpdateCoordinator], ABC):
|
|||
def get_airzone_value(self, key: str) -> Any:
|
||||
"""Return Airzone Cloud entity value by key."""
|
||||
|
||||
async def _async_update_params(self, params: dict[str, Any]) -> None:
|
||||
"""Send Airzone parameters to Cloud API."""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class AirzoneAidooEntity(AirzoneEntity):
|
||||
"""Define an Airzone Cloud Aidoo entity."""
|
||||
|
@ -153,3 +162,15 @@ class AirzoneZoneEntity(AirzoneEntity):
|
|||
if zone := self.coordinator.data[AZD_ZONES].get(self.zone_id):
|
||||
value = zone.get(key)
|
||||
return value
|
||||
|
||||
async def _async_update_params(self, params: dict[str, Any]) -> None:
|
||||
"""Send Zone parameters to Cloud API."""
|
||||
_LOGGER.debug("zone=%s: update_params=%s", self.name, params)
|
||||
try:
|
||||
await self.coordinator.airzone.api_set_zone_id_params(self.zone_id, params)
|
||||
except AirzoneCloudError as error:
|
||||
raise HomeAssistantError(
|
||||
f"Failed to set {self.name} params: {error}"
|
||||
) from error
|
||||
|
||||
self.coordinator.async_set_updated_data(self.coordinator.airzone.data())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue