Skip to content

Getting started with Echo #323

Description

@jorge-sepulveda

Hello!

I came across this library and wanted to see if I can talk to Echo PLC's. This is what I currently have in place. Running studio 5000 version 37 and trying to talk to an Emulate 5580 that is running in echo.

from pycomm3 import LogixDriver
import logging
logging.basicConfig(level=logging.DEBUG)
# Connect to the PLC
with LogixDriver("10.0.0.10",slot=1) as plc:

    value = plc.read("LI_210006")  # Replace with your tag name
    if value is not None:
        print(f"Tag Value: {value.value}")
    else:
        print("Failed to read tag.")

This is what I'm getting for the output. It seems pycomm can identify what it's trying to connect to but fails to connect.

DEBUG:pycomm3.cip_driver.CIPDriver:Opening connection to 10.0.0.10
DEBUG:pycomm3.cip_driver.CIPDriver:Sent: RegisterSessionRequestPacket(message=[b'\x01\x00', b'\x00\x00'])
DEBUG:pycomm3.cip_driver.CIPDriver:Received: RegisterSessionResponsePacket(session=1073741930, error=None)
INFO:pycomm3.cip_driver.CIPDriver:Session=1073741930 has been registered.
INFO:pycomm3.logix_driver.LogixDriver:Initializing driver...
DEBUG:pycomm3.cip_driver.CIPDriver:Sent: ListIdentityRequestPacket(message=[])
DEBUG:pycomm3.cip_driver.CIPDriver:Received: ListIdentityResponsePacket(identity={'encap_protocol_version': 1, 'ip_address': '10.0.0.10', 'vendor': 'Rockwell Automation/Allen-Bradley', 'product_type': 'Programmable Logic Controller', 'product_code': 288, 'revision': {'major': 37, 'minor': 11}, 'status': b'p0', 'serial': '601fcb77', 'product_name': 'Emulate 5580 Controller', 'state': 3}, error=None)
DEBUG:pycomm3.logix_driver.LogixDriver:Identified target: {'encap_protocol_version': 1, 'ip_address': '10.0.0.10', 'vendor': 'Rockwell Automation/Allen-Bradley', 'product_type': 'Programmable Logic Controller', 'product_code': 288, 'revision': {'major': 37, 'minor': 11}, 'status': b'p0', 'serial': '601fcb77', 'product_name': 'Emulate 5580 Controller', 'state': 3}
INFO:pycomm3.cip_driver.CIPDriver:Sending generic message: get_plc_info
DEBUG:pycomm3.cip_driver.CIPDriver:Sent: GenericUnconnectedRequestPacket(message=[b'R\x02 \x06$...1\x00\x01\x00'])
DEBUG:pycomm3.cip_driver.CIPDriver:Received: GenericUnconnectedResponsePacket(service=b'R', command=b'o\x00', error='Connection failure (see extended status) - Unconnected message timeout  (01, 204)')
ERROR:pycomm3.cip_driver.CIPDriver:Generic message 'get_plc_info' failed: Connection failure (see extended status) - Unconnected message timeout  (01, 204)
Traceback (most recent call last):
  File "C:\Users\bxg\Documents\repos\simpy\venv\Lib\site-packages\pycomm3\logix_driver.py", line 328, in get_plc_info
    raise ResponseError(f"get_plc_info did not return valid data - {response.error}")
pycomm3.exceptions.ResponseError: get_plc_info did not return valid data - Connection failure (see extended status) - Unconnected message timeout  (01, 204)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\bxg\Documents\repos\simpy\main.py", line 5, in <module>
    with LogixDriver("10.0.0.10",timeout=10) as plc:  # Replace with your PLC's IP
         ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bxg\Documents\repos\simpy\venv\Lib\site-packages\pycomm3\cip_driver.py", line 144, in __enter__
    self.open()
    ~~~~~~~~~^^
  File "C:\Users\bxg\Documents\repos\simpy\venv\Lib\site-packages\pycomm3\logix_driver.py", line 165, in open
    self._initialize_driver(**self._init_args)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bxg\Documents\repos\simpy\venv\Lib\site-packages\pycomm3\logix_driver.py", line 174, in _initialize_driver
    self._info = self.get_plc_info()
                 ~~~~~~~~~~~~~~~~~^^
  File "C:\Users\bxg\Documents\repos\simpy\venv\Lib\site-packages\pycomm3\logix_driver.py", line 336, in get_plc_info
    raise ResponseError("Failed to get PLC info") from err
pycomm3.exceptions.ResponseError: Failed to get PLC info

Any suggestions would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions