Skip to content

Commit e47e19f

Browse files
committed
allow_join_requests(): handle return for false-state
Improve logging
1 parent 27186f4 commit e47e19f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugwise_usb/network/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,17 +513,19 @@ async def stop(self) -> None:
513513

514514
async def allow_join_requests(self, state: bool) -> None:
515515
"""Enable or disable Plugwise network."""
516+
_LOGGER.debug("Send AllowJoiningRequest to Circle+ with state=%s", state)
516517
request = CirclePlusAllowJoiningRequest(self._controller.send, state)
517518
if (response := await request.send()) is None:
518-
raise NodeError("No response to get notifications for join request.")
519+
raise NodeError("No response for AllowJoiningRequest request.")
519520

520-
if response.response_type != NodeResponseType.JOIN_ACCEPTED:
521+
if (
522+
response.response_type != NodeResponseType.JOIN_ACCEPTED
523+
or response.response_type != StickResponse,
524+
):
521525
raise MessageError(
522526
f"Unknown NodeResponseType '{response.response_type.name}' received"
523527
)
524528

525-
_LOGGER.debug("Send AllowJoiningRequest to Circle+ with state=%s", state)
526-
527529
def subscribe_to_node_events(
528530
self,
529531
node_event_callback: Callable[[NodeEvent, str], Coroutine[Any, Any, None]],

0 commit comments

Comments
 (0)