Skip to content

Commit 78e96a8

Browse files
committed
Clean up all existing accept/allow_join_request related
Function moved to CirclePlus Node
1 parent b6fd41f commit 78e96a8

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

plugwise_usb/__init__.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -180,37 +180,6 @@ def port(self, port: str) -> None:
180180

181181
self._port = port
182182

183-
@property
184-
def accept_join_request(self) -> bool | None:
185-
"""Automatically accept joining request of new nodes."""
186-
if not self._controller.is_connected:
187-
return None
188-
if self._network is None or not self._network.is_running:
189-
return None
190-
return self._network.accept_join_request
191-
192-
async def set_accept_join_request(self, state: bool) -> bool:
193-
"""Configure join request setting."""
194-
if not self._controller.is_connected:
195-
raise StickError(
196-
"Cannot accept joining node"
197-
+ " without an active USB-Stick connection."
198-
)
199-
200-
if self._network is None or not self._network.is_running:
201-
raise StickError(
202-
"Cannot accept joining node"
203-
+ " without node discovery be activated. Call discover() first."
204-
)
205-
206-
# Observation: joining is only temporarily possible after a HA (re)start or
207-
# Integration reload, force the setting when used otherwise
208-
try:
209-
await self._network.allow_join_requests(state)
210-
except (MessageError, NodeError) as exc:
211-
raise NodeError(f"Failed setting accept joining: {exc}") from exc
212-
return True
213-
214183
async def energy_reset_request(self, mac: str) -> bool:
215184
"""Send an energy-reset request to a Node."""
216185
_LOGGER.debug("Resetting energy logs for %s", mac)

plugwise_usb/network/__init__.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
class StickNetwork:
4242
"""USB-Stick zigbee network class."""
4343

44-
accept_join_request = False
4544
_event_subscriptions: dict[StickEvent, int] = {}
4645

4746
def __init__(
@@ -152,9 +151,6 @@ def registry(self) -> dict[int, tuple[str, NodeType | None]]:
152151

153152
async def register_node(self, mac: str) -> bool:
154153
"""Register node to Plugwise network."""
155-
if not self.accept_join_request:
156-
return False
157-
158154
try:
159155
await self._register.register_node(mac)
160156
except NodeError as exc:
@@ -527,22 +523,6 @@ async def stop(self) -> None:
527523

528524
# endregion
529525

530-
async def allow_join_requests(self, state: bool) -> None:
531-
"""Enable or disable Plugwise network."""
532-
request = CirclePlusAllowJoiningRequest(self._controller.send, state)
533-
if (response := await request.send()) is None:
534-
raise NodeError("No response for CirclePlusAllowJoiningRequest.")
535-
536-
if response.response_type not in (
537-
NodeResponseType.JOIN_ACCEPTED, NodeResponseType.CIRCLE_PLUS
538-
):
539-
raise MessageError(
540-
f"Unknown NodeResponseType '{response.response_type.name}' received"
541-
)
542-
543-
_LOGGER.debug("Sent AllowJoiningRequest to Circle+ with state=%s", state)
544-
self.accept_join_request = state
545-
546526
async def energy_reset_request(self, mac: str) -> None:
547527
"""Send an energy-reset to a Node."""
548528
self._validate_energy_node(mac)

0 commit comments

Comments
 (0)