From c029c534d6dbb209954a54c9f54f79786276ce78 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Fri, 28 Jun 2024 18:34:24 +0200 Subject: [PATCH] Do not call async_delete_issue() if there is no issue to delete in Shelly integration (#120762) Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com> --- homeassistant/components/shelly/coordinator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/shelly/coordinator.py b/homeassistant/components/shelly/coordinator.py index 02feef3633b7f7..33ed07c35de206 100644 --- a/homeassistant/components/shelly/coordinator.py +++ b/homeassistant/components/shelly/coordinator.py @@ -377,12 +377,13 @@ def _async_handle_update( eager_start=True, ) elif update_type is BlockUpdateType.COAP_PERIODIC: + if self._push_update_failures >= MAX_PUSH_UPDATE_FAILURES: + ir.async_delete_issue( + self.hass, + DOMAIN, + PUSH_UPDATE_ISSUE_ID.format(unique=self.mac), + ) self._push_update_failures = 0 - ir.async_delete_issue( - self.hass, - DOMAIN, - PUSH_UPDATE_ISSUE_ID.format(unique=self.mac), - ) elif update_type is BlockUpdateType.COAP_REPLY: self._push_update_failures += 1 if self._push_update_failures == MAX_PUSH_UPDATE_FAILURES: