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

Update modbus.go #9916

Closed
wants to merge 1 commit into from
Closed

Update modbus.go #9916

wants to merge 1 commit into from

Conversation

meimz
Copy link

@meimz meimz commented Oct 13, 2021

More slave_id repair the same serial port name problem

--- PASS: TestRetrySuccessful (0.00s)
=== RUN TestRetryFailExhausted
2021/10/13 17:24:46 D! [] trying to read coil@0[1]...
2021/10/13 17:24:46 I! [] Device busy! Retrying 2 more time(s)...
2021/10/13 17:24:46 D! [] trying to read coil@0[1]...
2021/10/13 17:24:46 I! [] Device busy! Retrying 1 more time(s)...
2021/10/13 17:24:46 D! [] trying to read coil@0[1]...
--- PASS: TestRetryFailExhausted (0.00s)
=== RUN TestRetryFailIllegal
2021/10/13 17:24:46 D! [] trying to read coil@0[1]...
--- PASS: TestRetryFailIllegal (0.00s)
PASS
ok github.com/influxdata/telegraf/plugins/inputs/modbus 0.647s

Required for all PRs:

resolves #

More slave_id repair the same serial port name problem
@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Oct 13, 2021
@meimz
Copy link
Author

meimz commented Oct 13, 2021

!signed-cla

@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@meimz
Copy link
Author

meimz commented Oct 13, 2021

Thanks so much for the pull request! 🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

!signed-cla

@srebhan
Copy link
Member

srebhan commented Oct 13, 2021

@meimz what are you trying to fix with this PR?

@srebhan srebhan self-assigned this Oct 13, 2021
@meimz
Copy link
Author

meimz commented Oct 13, 2021

@meimz what are you trying to fix with this PR?

The same serial port name whith different slave_id

image

image

@meimz what are you trying to fix with this PR?

@srebhan
Copy link
Member

srebhan commented Oct 13, 2021

There already is PR #9279 which adds this feature. Is this what you are looking for?

@meimz
Copy link
Author

meimz commented Oct 14, 2021

There already is PR #9279 which adds this feature. Is this what you are looking for?

Yes,That is right!But PR #9279 is not solve different configuration node use the same contorller .

`[[inputs.modbus]]
interval = "1s"
name = "Temperature Humidity"
slave_id = 2
timeout = "1s"
controller = "file:///dev/ttyU1"
baud_rate = 9600
data_bits = 8
parity = "N"
stop_bits = 1
transmission_mode = "RTU"
input_registers = [
{ name = "temperature", byte_order = "AB", data_type = "INT16", scale=1.0, address = [0]},
{ name = "humidity", byte_order = "AB", data_type = "INT16", scale=1.0, address = [1]},
]

[[inputs.modbus]]
interval = "1s"
name = "Temperature Humidity"
slave_id = 1
timeout = "1s"
controller = "file:///dev/ttyU1"
baud_rate = 9600
data_bits = 8
parity = "N"
stop_bits = 1
transmission_mode = "RTU"
input_registers = [
{ name = "temperature", byte_order = "AB", data_type = "INT16", scale=1.0, address = [0]},
{ name = "humidity", byte_order = "AB", data_type = "INT16", scale=1.0, address = [1]},
]
`

@meimz meimz closed this Oct 14, 2021
@meimz
Copy link
Author

meimz commented Oct 14, 2021

  1. I want one device one configuration node.
  2. RS485 modbus devices can in series .

image

`[[inputs.modbus]]
interval = "1s"
name = "Temperature Humidity"
slave_id = 2
timeout = "1s"
controller = "file:///dev/ttyU1"
baud_rate = 9600
data_bits = 8
parity = "N"
stop_bits = 1
transmission_mode = "RTU"
input_registers = [
{ name = "temperature", byte_order = "AB", data_type = "INT16", scale=1.0, address = [0]},
{ name = "humidity", byte_order = "AB", data_type = "INT16", scale=1.0, address = [1]},
]

[[inputs.modbus]]
interval = "1s"
name = "Temperature Humidity"
slave_id = 1
timeout = "1s"
controller = "file:///dev/ttyU1"
baud_rate = 9600
data_bits = 8
parity = "N"
stop_bits = 1
transmission_mode = "RTU"
input_registers = [
{ name = "temperature", byte_order = "AB", data_type = "INT16", scale=1.0, address = [0]},
{ name = "humidity", byte_order = "AB", data_type = "INT16", scale=1.0, address = [1]},
]`

3.Do not modify the configuration file above and this PR can run.

@meimz meimz reopened this Oct 14, 2021
@srebhan
Copy link
Member

srebhan commented Oct 14, 2021

@meimz I understand your point, but I think we should not support this. With your PR you add a state to the plugin which in turn adds complexity such as caches etc. Imaging one plugin now disconnects or sets different parameters for the same interface (e.g. different timeout, baud rate, transmission mode)... Right now (and I also think with #9279) the program flow is easy to follow and robust which will change with this PR.

@srebhan srebhan closed this Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants