Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show proper name on Airzone Cloud errors #102998

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion homeassistant/components/airzone_cloud/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
AZD_MASTER,
AZD_MODE,
AZD_MODES,
AZD_NAME,
AZD_NUM_DEVICES,
AZD_NUM_GROUPS,
AZD_POWER,
Expand Down Expand Up @@ -386,4 +387,6 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
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.get_airzone_value(AZD_NAME)}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option which I think is more used is self.entity_id given that a user can rename their devices etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option which I think is more used is self.entity_id given that a user can rename their devices etc.

Done in 1cfc888
Thanks!

)
26 changes: 18 additions & 8 deletions homeassistant/components/airzone_cloud/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ def get_airzone_value(self, key: str) -> Any:

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.get_airzone_value(AZD_NAME), 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.get_airzone_value(AZD_NAME)} params: {error}"
) from error

self.coordinator.async_set_updated_data(self.coordinator.airzone.data())
Expand Down Expand Up @@ -122,14 +124,16 @@ def get_airzone_value(self, key: str) -> Any:

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.get_airzone_value(AZD_NAME), 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.get_airzone_value(AZD_NAME)} params: {error}"
) from error

self.coordinator.async_set_updated_data(self.coordinator.airzone.data())
Expand Down Expand Up @@ -164,14 +168,18 @@ def get_airzone_value(self, key: str) -> Any:

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.get_airzone_value(AZD_NAME),
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.get_airzone_value(AZD_NAME)} params: {error}"
) from error

self.coordinator.async_set_updated_data(self.coordinator.airzone.data())
Expand Down Expand Up @@ -267,12 +275,14 @@ def get_airzone_value(self, key: str) -> Any:

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.get_airzone_value(AZD_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}"
f"Failed to set {self.get_airzone_value(AZD_NAME)} params: {error}"
) from error

self.coordinator.async_set_updated_data(self.coordinator.airzone.data())