From 0a7a6540e437cde540edef2eaedc41effa88bd8d Mon Sep 17 00:00:00 2001 From: Ferenc Bakonyi Date: Thu, 21 Mar 2024 08:02:59 +0100 Subject: [PATCH] Fix issue #94 --- custom_components/sagemcom_fast/button.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/sagemcom_fast/button.py b/custom_components/sagemcom_fast/button.py index 8cbab96..03f33cf 100644 --- a/custom_components/sagemcom_fast/button.py +++ b/custom_components/sagemcom_fast/button.py @@ -11,7 +11,7 @@ from sagemcom_api.models import DeviceInfo as GatewayDeviceInfo from . import HomeAssistantSagemcomFastData -from .const import DOMAIN +from .const import DOMAIN, LOGGER async def async_setup_entry( @@ -43,7 +43,11 @@ def __init__(self, gateway: GatewayDeviceInfo, client: SagemcomClient) -> None: async def async_press(self) -> None: """Handle the button press.""" - await self.client.reboot() + try: + await self.client.login() + await self.client.reboot() + except Exception as exception: # pylint: disable=broad-except + LOGGER.exception(exception) @property def device_info(self) -> DeviceInfo: