Skip to content

feat(inputs.s7comm): Add optional connection type setting #15000

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

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

Hongliukai
Copy link
Contributor

@Hongliukai Hongliukai commented Mar 15, 2024

Summary

When we use the S7 protocol to access the PLC, we can do so by modifying the
the third byte in the Called (Dst) TSAP (in COTP) to select whether to connect as PG( a program) or OP ( monitor.....) or S7_basic_communication.

But the existing S7Comm plugin can only be used as a PG connection because of this parameter fixed in the robinson/gos7 NewTCPClientHandler() function。

I often encountered when using telegraf to connect to Siemens PLCs that the PLC supports fewer PG connections and more OP connections, so I'd like to add a parameter to change this connect parameter.

In order to be able to change this connect_type when connecting again I've submitted the new connection function NewTCPClientHandlerWithConnectType to robinson/gos7 and have merged the
robinson/gos7#67

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #14994

@telegraf-tiger telegraf-tiger bot added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Mar 15, 2024
@Hongliukai Hongliukai closed this Mar 15, 2024
@Hongliukai Hongliukai force-pushed the feature-s7comm-connectType branch from 6b3ce17 to 70e2ab6 Compare March 15, 2024 09:15
@Hongliukai Hongliukai reopened this Mar 15, 2024
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hongliukai thank you very much for your contribution! IMO we should make the config option more speaking by actually using the common abbreviations or even words instead of numbers... What do you think?

@srebhan srebhan self-assigned this Mar 15, 2024
@srebhan srebhan added the area/iot New plugins or features relating to IoT monitoring label Mar 15, 2024
@srebhan srebhan changed the title feat(inputs.s7comm): Optional connect_type in S7 Connections Mar 15, 2024
@Hongliukai
Copy link
Contributor Author

Hi srebhan! @srebhan Thanks for the correction, you're right, using abbreviations and a map is more readable .

srebhan
srebhan previously approved these changes Mar 15, 2024
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hongliukai just two more newline removals, then we are good to go.

@srebhan srebhan dismissed their stale review March 15, 2024 13:30

Fix myself...

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @Hongliukai! I'll take the liberty to remove the newlines...

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Mar 15, 2024
@srebhan srebhan assigned powersj and mstrandboge and unassigned srebhan Mar 15, 2024
@powersj powersj removed their assignment Mar 15, 2024
@mstrandboge mstrandboge merged commit a2ec012 into influxdata:master Mar 15, 2024
@github-actions github-actions bot added this to the v1.31.0 milestone Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/iot New plugins or features relating to IoT monitoring feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
4 participants