diff --git a/plugwise_usb/__init__.py b/plugwise_usb/__init__.py index c69fce361..2e37b5be0 100644 --- a/plugwise_usb/__init__.py +++ b/plugwise_usb/__init__.py @@ -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: @@ -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 @@ -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 @@ -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, )