Don't try to connect after exiting loop in ntfy (#152011)

This commit is contained in:
Manu
2025-09-12 11:14:01 +02:00
committed by GitHub
parent 8412581be4
commit 8263ea4a4a
+13 -13
View File
@@ -146,20 +146,20 @@ class NtfyEventEntity(NtfyBaseEntity, EventEntity):
)
self._attr_available = False
finally:
if self._ws is None or self._ws.done():
self._ws = self.config_entry.async_create_background_task(
self.hass,
target=self.ntfy.subscribe(
topics=[self.topic],
callback=self._async_handle_event,
title=self.subentry.data.get(CONF_TITLE),
message=self.subentry.data.get(CONF_MESSAGE),
priority=self.subentry.data.get(CONF_PRIORITY),
tags=self.subentry.data.get(CONF_TAGS),
),
name="ntfy_websocket",
)
self.async_write_ha_state()
if self._ws is None or self._ws.done():
self._ws = self.config_entry.async_create_background_task(
self.hass,
target=self.ntfy.subscribe(
topics=[self.topic],
callback=self._async_handle_event,
title=self.subentry.data.get(CONF_TITLE),
message=self.subentry.data.get(CONF_MESSAGE),
priority=self.subentry.data.get(CONF_PRIORITY),
tags=self.subentry.data.get(CONF_TAGS),
),
name="ntfy_websocket",
)
await asyncio.sleep(RECONNECT_INTERVAL)
@property