Skip to content

Commit f503ed9

Browse files
committed
Add additional try except block around init
1 parent 444776d commit f503ed9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

custom_components/nefiteasy/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from homeassistant.core import HomeAssistant
1414
from homeassistant.exceptions import ConfigEntryNotReady
1515
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
16+
import slixmpp
1617

1718
from .const import (
1819
CONF_ACCESSKEY,
@@ -145,7 +146,11 @@ async def connect(self) -> None:
145146
self.connected_state = STATE_CONNECTED
146147

147148
if self.connected_state == STATE_CONNECTED:
148-
self.nefit.get("/gateway/brandID")
149+
try:
150+
self.nefit.get("/gateway/brandID")
151+
except slixmpp.xmlstream.xmlstream.NotConnectedError:
152+
self.connected_state == STATE_INIT
153+
return
149154
try:
150155
await asyncio.wait_for(
151156
self.nefit.xmppclient.message_event.wait(), timeout=29.0

0 commit comments

Comments
 (0)