Skip to content

Reading a Optimized DB #877

Description

@gaurav041089

Hello,
Testing the S7commplus on following
PLC: 1212 Ver 4.0
PUT/GET is enabled.
DB is optimized. (Hence using s7commplus instead of snap7)

Using following code
from s7commplus import Client

PLC Connection Details (S7CommPlus does not take rack/slot)

PLC_IP = "192.4.0.102"

def read_optimized_symbol():
client = Client()

try:
print(f"Connecting via S7CommPlus to PLC at {PLC_IP}...")
# Pass only the IP address
client.connect(PLC_IP)

print("Connected! Browsing symbols to find DB3 and 'Sts_run_m'...")

# Browse the symbol tree to inspect available data blocks and tags
symbols = client.browse()
for symbol in symbols:
  print(symbol)

except Exception as e:
print(f"An error occurred: {e}")

finally:
try:
client.disconnect()
print("\nDisconnected from PLC.")
except Exception:
pass

if name == "main":
read_optimized_symbol()

IDLE Output
==== RESTART: C:\Users\Gaurav S Mithari\Desktop\Finolex\Cutter\1212Test5.py ====
Connecting via S7CommPlus to PLC at 192.4.0.102...
CreateObject returned non-zero 0xE022BD000190FF7A; continuing to parse the returned session data
PLC did not provide a usable ServerSessionVersion attribute; S7CommPlus session setup cannot continue. No automatic fallback to the classic PUT/GET protocol is performed.
Connected! Browsing symbols to find DB3 and 'Sts_run_m'...

Disconnected from PLC.

Wireshark dump between PLC and TIA Portal

1212TIA_to_PLC.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions