Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use source_address in serial. #1699

Merged
merged 1 commit into from
Jul 25, 2023
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
6 changes: 5 additions & 1 deletion pymodbus/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,14 @@ def init_check_nullmodem(self) -> bool:
def init_setup_connect_listen(self) -> None:
"""Handle connect/listen handler."""
if self.comm_params.comm_type == CommType.SERIAL:
if self.is_server:
port = self.comm_params.source_address[0]
else:
port = self.comm_params.host
self.call_create = lambda: create_serial_connection(
self.loop,
self.handle_new_connection,
self.comm_params.host,
port,
baudrate=self.comm_params.baudrate,
bytesize=self.comm_params.bytesize,
parity=self.comm_params.parity,
Expand Down