Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions plugwise_usb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,8 @@ def port(self, port: str) -> None:
raise StickError(
"Unable to change port while connected. Disconnect first"
)
if self._port is None:
self._port = port
if port != self._port:
self._port = port

self._port = port

@property
def accept_join_request(self) -> bool | None:
Expand All @@ -201,7 +199,7 @@ async def set_accept_join_request(self, state: bool) -> bool:
if self._network is None or not self._network.is_running:
raise StickError(
"Cannot accept joining node"
+ "without node discovery be activated. Call discover() first."
+ " without node discovery be activated. Call discover() first."
)

# Observation: joining is only temporarily possible after a HA (re)start or
Expand Down Expand Up @@ -278,6 +276,7 @@ async def connect(self, port: str | None = None) -> None:
f"Already connected to {self._port}, " +
"Close existing connection before (re)connect."
)

if port is not None:
self._port = port

Expand All @@ -286,6 +285,7 @@ async def connect(self, port: str | None = None) -> None:
"Unable to connect. " +
"Path to USB-Stick is not defined, set port property first"
)

await self._controller.connect_to_stick(
self._port,
)
Expand Down
Loading