Skip to content

Commit 8263ea4

Browse files
authored
Don't try to connect after exiting loop in ntfy (home-assistant#152011)
1 parent 8412581 commit 8263ea4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

homeassistant/components/ntfy/event.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,20 @@ async def ws_connect(self) -> None:
146146
)
147147
self._attr_available = False
148148
finally:
149-
if self._ws is None or self._ws.done():
150-
self._ws = self.config_entry.async_create_background_task(
151-
self.hass,
152-
target=self.ntfy.subscribe(
153-
topics=[self.topic],
154-
callback=self._async_handle_event,
155-
title=self.subentry.data.get(CONF_TITLE),
156-
message=self.subentry.data.get(CONF_MESSAGE),
157-
priority=self.subentry.data.get(CONF_PRIORITY),
158-
tags=self.subentry.data.get(CONF_TAGS),
159-
),
160-
name="ntfy_websocket",
161-
)
162149
self.async_write_ha_state()
150+
if self._ws is None or self._ws.done():
151+
self._ws = self.config_entry.async_create_background_task(
152+
self.hass,
153+
target=self.ntfy.subscribe(
154+
topics=[self.topic],
155+
callback=self._async_handle_event,
156+
title=self.subentry.data.get(CONF_TITLE),
157+
message=self.subentry.data.get(CONF_MESSAGE),
158+
priority=self.subentry.data.get(CONF_PRIORITY),
159+
tags=self.subentry.data.get(CONF_TAGS),
160+
),
161+
name="ntfy_websocket",
162+
)
163163
await asyncio.sleep(RECONNECT_INTERVAL)
164164

165165
@property

0 commit comments

Comments
 (0)