Skip to content

Commit 9d5ba85

Browse files
committed
Exit when network is not online
1 parent 938d49c commit 9d5ba85

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

plugwise_usb/connection/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ async def pair_plus_device(self, mac: str) -> bool:
220220
raise NodeError(
221221
"Pairing failed, StickNetworkInfoResponse is None"
222222
) from None
223-
_LOGGER.debug("HOI NetworkInfoRequest done")
224223

225224
# Init Stick
226225
try:
@@ -229,7 +228,8 @@ async def pair_plus_device(self, mac: str) -> bool:
229228
raise NodeError(
230229
f"Pairing failed, failed to initialize Stick: {exc}"
231230
) from exc
232-
_LOGGER.debug("HOI Init done")
231+
if not self._network_online:
232+
raise NodeError("Pairing failed, network is not online")
233233

234234
try:
235235
request = CirclePlusConnectRequest(self.send, bytes(mac, UTF8))
@@ -243,8 +243,6 @@ async def pair_plus_device(self, mac: str) -> bool:
243243
if response.allowed.value != 1:
244244
raise NodeError("Pairing failed, not allowed")
245245

246-
_LOGGER.debug("HOI PlusConnectRequest done")
247-
248246
return True
249247

250248
async def get_node_details(

0 commit comments

Comments
 (0)