Skip to content

Commit de8aeb9

Browse files
Make sure the Stick is ready to pair, as suggested
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 40df511 commit de8aeb9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

plugwise_usb/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ def port(self, port: str) -> None:
176176

177177
self._port = port
178178

179+
`@raise_not_connected`
180+
`@raise_not_initialized`
179181
async def plus_pair_request(self, mac: str) -> bool:
180182
"""Send a pair request to a Plus device."""
183+
if self._network is None:
184+
raise StickError("Cannot pair when network is not initialized")
181185
try:
182186
await self._network.pair_plus_device(mac)
183187
except NodeError as exc:

0 commit comments

Comments
 (0)