diff --git a/homeassistant/components/shelly/coordinator.py b/homeassistant/components/shelly/coordinator.py index f309fc99358..fdb94b3bdb0 100644 --- a/homeassistant/components/shelly/coordinator.py +++ b/homeassistant/components/shelly/coordinator.py @@ -8,7 +8,7 @@ from typing import Any, cast import aioshelly from aioshelly.block_device import BlockDevice -from aioshelly.exceptions import DeviceConnectionError, InvalidAuthError +from aioshelly.exceptions import DeviceConnectionError, InvalidAuthError, RpcCallError from aioshelly.rpc_device import RpcDevice from homeassistant.config_entries import ConfigEntry @@ -510,7 +510,11 @@ class ShellyRpcCoordinator(DataUpdateCoordinator): try: await self.device.trigger_ota_update(beta=beta) except DeviceConnectionError as err: - raise HomeAssistantError(f"Error starting OTA update: {repr(err)}") from err + raise HomeAssistantError( + f"OTA update connection error: {repr(err)}" + ) from err + except RpcCallError as err: + raise HomeAssistantError(f"OTA update request error: {repr(err)}") from err except InvalidAuthError: self.entry.async_start_reauth(self.hass) else: @@ -553,7 +557,7 @@ class ShellyRpcPollingCoordinator(DataUpdateCoordinator): LOGGER.debug("Polling Shelly RPC Device - %s", self.name) try: await self.device.update_status() - except DeviceConnectionError as err: + except (DeviceConnectionError, RpcCallError) as err: raise UpdateFailed(f"Device disconnected: {repr(err)}") from err except InvalidAuthError: self.entry.async_start_reauth(self.hass) diff --git a/homeassistant/components/shelly/entity.py b/homeassistant/components/shelly/entity.py index 72794be60cc..fd92ea41408 100644 --- a/homeassistant/components/shelly/entity.py +++ b/homeassistant/components/shelly/entity.py @@ -6,7 +6,7 @@ from dataclasses import dataclass from typing import Any, cast from aioshelly.block_device import Block -from aioshelly.exceptions import DeviceConnectionError, InvalidAuthError +from aioshelly.exceptions import DeviceConnectionError, InvalidAuthError, RpcCallError from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback @@ -426,7 +426,11 @@ class ShellyRpcEntity(entity.Entity): except DeviceConnectionError as err: self.coordinator.last_update_success = False raise HomeAssistantError( - f"Call RPC for entity {self.name} failed, method: {method}, params: {params}, error: {repr(err)}" + f"Call RPC for {self.name} connection error, method: {method}, params: {params}, error: {repr(err)}" + ) from err + except RpcCallError as err: + raise HomeAssistantError( + f"Call RPC for {self.name} request error, method: {method}, params: {params}, error: {repr(err)}" ) from err except InvalidAuthError: self.coordinator.entry.async_start_reauth(self.hass) diff --git a/homeassistant/components/shelly/manifest.json b/homeassistant/components/shelly/manifest.json index 3e12835bf0f..54396d7171e 100644 --- a/homeassistant/components/shelly/manifest.json +++ b/homeassistant/components/shelly/manifest.json @@ -3,7 +3,7 @@ "name": "Shelly", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/shelly", - "requirements": ["aioshelly==4.0.0"], + "requirements": ["aioshelly==4.1.0"], "dependencies": ["http"], "zeroconf": [ { diff --git a/requirements_all.txt b/requirements_all.txt index edfaa7c543e..2c436f65568 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -255,7 +255,7 @@ aiosenseme==0.6.1 aiosenz==1.0.0 # homeassistant.components.shelly -aioshelly==4.0.0 +aioshelly==4.1.0 # homeassistant.components.skybell aioskybell==22.7.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index d834a7c6585..a84a2eb13f7 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -230,7 +230,7 @@ aiosenseme==0.6.1 aiosenz==1.0.0 # homeassistant.components.shelly -aioshelly==4.0.0 +aioshelly==4.1.0 # homeassistant.components.skybell aioskybell==22.7.0