From 9952eed671dead1bfd53ec4cb8d3ef4934e1a588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 30 Oct 2023 11:02:24 +0100 Subject: [PATCH] Show proper name on Airzone Cloud errors (#102998) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * airzone_cloud: fix showing None on errors Signed-off-by: Álvaro Fernández Rojas * airzone_cloud: use entity_id on errors/logs Signed-off-by: Álvaro Fernández Rojas --------- Signed-off-by: Álvaro Fernández Rojas --- .../components/airzone_cloud/climate.py | 4 +++- .../components/airzone_cloud/entity.py | 20 +++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/airzone_cloud/climate.py b/homeassistant/components/airzone_cloud/climate.py index 53bc7e89a3c..e5aa6be65e3 100644 --- a/homeassistant/components/airzone_cloud/climate.py +++ b/homeassistant/components/airzone_cloud/climate.py @@ -386,4 +386,6 @@ class AirzoneZoneClimate(AirzoneZoneEntity, AirzoneDeviceClimate): await self._async_update_params(params) if slave_raise: - raise HomeAssistantError(f"Mode can't be changed on slave zone {self.name}") + raise HomeAssistantError( + f"Mode can't be changed on slave zone {self.entity_id}" + ) diff --git a/homeassistant/components/airzone_cloud/entity.py b/homeassistant/components/airzone_cloud/entity.py index 297f85af359..a175167be5a 100644 --- a/homeassistant/components/airzone_cloud/entity.py +++ b/homeassistant/components/airzone_cloud/entity.py @@ -80,14 +80,14 @@ class AirzoneAidooEntity(AirzoneEntity): async def _async_update_params(self, params: dict[str, Any]) -> None: """Send Aidoo parameters to Cloud API.""" - _LOGGER.debug("aidoo=%s: update_params=%s", self.name, params) + _LOGGER.debug("aidoo=%s: update_params=%s", self.entity_id, params) try: await self.coordinator.airzone.api_set_aidoo_id_params( self.aidoo_id, params ) except AirzoneCloudError as error: raise HomeAssistantError( - f"Failed to set {self.name} params: {error}" + f"Failed to set {self.entity_id} params: {error}" ) from error self.coordinator.async_set_updated_data(self.coordinator.airzone.data()) @@ -122,14 +122,14 @@ class AirzoneGroupEntity(AirzoneEntity): async def _async_update_params(self, params: dict[str, Any]) -> None: """Send Group parameters to Cloud API.""" - _LOGGER.debug("group=%s: update_params=%s", self.name, params) + _LOGGER.debug("group=%s: update_params=%s", self.entity_id, params) try: await self.coordinator.airzone.api_set_group_id_params( self.group_id, params ) except AirzoneCloudError as error: raise HomeAssistantError( - f"Failed to set {self.name} params: {error}" + f"Failed to set {self.entity_id} params: {error}" ) from error self.coordinator.async_set_updated_data(self.coordinator.airzone.data()) @@ -164,14 +164,18 @@ class AirzoneInstallationEntity(AirzoneEntity): async def _async_update_params(self, params: dict[str, Any]) -> None: """Send Installation parameters to Cloud API.""" - _LOGGER.debug("installation=%s: update_params=%s", self.name, params) + _LOGGER.debug( + "installation=%s: update_params=%s", + self.entity_id, + params, + ) try: await self.coordinator.airzone.api_set_installation_id_params( self.inst_id, params ) except AirzoneCloudError as error: raise HomeAssistantError( - f"Failed to set {self.name} params: {error}" + f"Failed to set {self.entity_id} params: {error}" ) from error self.coordinator.async_set_updated_data(self.coordinator.airzone.data()) @@ -267,12 +271,12 @@ class AirzoneZoneEntity(AirzoneEntity): 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) + _LOGGER.debug("zone=%s: update_params=%s", self.entity_id, 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}" + f"Failed to set {self.entity_id} params: {error}" ) from error self.coordinator.async_set_updated_data(self.coordinator.airzone.data())