Skip to content

Commit 1050630

Browse files
committed
And implement
1 parent e90fa5d commit 1050630

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

plugwise_usb/network/__init__.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -270,22 +270,22 @@ async def node_rejoin_message(self, response: PlugwiseResponse) -> bool:
270270
f"Invalid response message type ({response.__class__.__name__}) received, expected NodeRejoinResponse"
271271
)
272272
mac = response.mac_decoded
273-
if (address := self._register.network_address(mac)) is not None:
274-
if self._nodes.get(mac) is None:
275-
if self._discover_sed_tasks.get(mac) is None:
276-
self._discover_sed_tasks[mac] = create_task(
277-
self._discover_battery_powered_node(address, mac)
278-
)
279-
elif self._discover_sed_tasks[mac].done():
280-
self._discover_sed_tasks[mac] = create_task(
281-
self._discover_battery_powered_node(address, mac)
282-
)
283-
else:
284-
_LOGGER.debug("duplicate awake discovery for %s", mac)
285-
return True
286-
else:
287-
raise NodeError(f"Unknown network address for node {mac}")
288-
return True
273+
if (address := self._register.network_address(mac)) is None:
274+
if (address := self.register_rejoined_node(mac)) is None:
275+
raise NodeError(f"Failed to obtain address for node {mac}")
276+
277+
if self._nodes.get(mac) is None:
278+
if self._discover_sed_tasks.get(mac) is None:
279+
self._discover_sed_tasks[mac] = create_task(
280+
self._discover_battery_powered_node(address, mac)
281+
)
282+
elif self._discover_sed_tasks[mac].done():
283+
self._discover_sed_tasks[mac] = create_task(
284+
self._discover_battery_powered_node(address, mac)
285+
)
286+
else:
287+
_LOGGER.debug("duplicate awake discovery for %s", mac)
288+
return True
289289

290290
def _unsubscribe_to_protocol_events(self) -> None:
291291
"""Unsubscribe to events from protocol."""

0 commit comments

Comments
 (0)