Skip to content

Commit d991571

Browse files
committed
Try 3
1 parent f1cff36 commit d991571

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

plugwise_usb/connection/__init__.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ async def pair_plus_device(self, mac: str) -> bool:
230230
raise NodeError(
231231
"Pairing failed, StickNetworkInfoResponse is None"
232232
) from None
233+
_LOGGER.debug("HOI NetworkInfoRequest done")
233234

234235
# Init Stick
235236
try:
@@ -238,18 +239,19 @@ async def pair_plus_device(self, mac: str) -> bool:
238239
raise NodeError(
239240
f"Pairing failed, failed to initialize Stick: {exc}"
240241
) from exc
241-
242-
try:
243-
request = CirclePlusConnectRequest(self.send, bytes(mac, UTF8))
244-
response = await request.send()
245-
except MessageError as exc:
246-
raise NodeError(f"Pairing failed: {exc}") from exc
247-
if response is None:
248-
raise NodeError(
249-
"Pairing failed, CirclePlusConnectResponse is None"
250-
) from None
251-
if response.allowed.value != 1:
252-
raise NodeError("Pairing failed, not allowed")
242+
_LOGGER.debug("HOI Init done")
243+
244+
#try:
245+
# request = CirclePlusConnectRequest(self.send, bytes(mac, UTF8))
246+
# response = await request.send()
247+
#except MessageError as exc:
248+
# raise NodeError(f"Pairing failed: {exc}") from exc
249+
#if response is None:
250+
# raise NodeError(
251+
# "Pairing failed, CirclePlusConnectResponse is None"
252+
# ) from None
253+
#if response.allowed.value != 1:
254+
# raise NodeError("Pairing failed, not allowed")
253255

254256
return True
255257

tests/test_pairing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,10 @@ async def test_pair_plus(self, monkeypatch: pytest.MonkeyPatch) -> None:
431431
await stick.connect("test_port")
432432
# with pytest.raises(pw_exceptions.StickError):
433433
await stick.initialize()
434-
# await stick.plus_pair_request("0098765432101234")
435-
# await asyncio.sleep(5)
434+
435+
await asyncio.sleep(2)
436+
await stick.plus_pair_request("0098765432101234")
437+
await asyncio.sleep(2)
436438

437439
await stick.disconnect()
438440

0 commit comments

Comments
 (0)