{"id":13750661,"url":"https://github.com/ruscito/pycomm","last_synced_at":"2026-03-17T22:36:06.453Z","repository":{"id":24929633,"uuid":"28346826","full_name":"ruscito/pycomm","owner":"ruscito","description":"pycomm is a package that includes a collection of modules used to communicate with PLCs","archived":false,"fork":false,"pushed_at":"2019-09-07T03:54:36.000Z","size":202,"stargazers_count":140,"open_issues_count":29,"forks_count":85,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-11-07T08:16:27.081Z","etag":null,"topics":["automation","ethernet-ip","plc","python","rockwell"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruscito.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-22T16:20:17.000Z","updated_at":"2024-10-15T19:44:30.000Z","dependencies_parsed_at":"2022-08-18T17:51:03.940Z","dependency_job_id":null,"html_url":"https://github.com/ruscito/pycomm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruscito%2Fpycomm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruscito%2Fpycomm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruscito%2Fpycomm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruscito%2Fpycomm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruscito","download_url":"https://codeload.github.com/ruscito/pycomm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224869032,"owners_count":17383306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","ethernet-ip","plc","python","rockwell"],"created_at":"2024-08-03T08:00:43.752Z","updated_at":"2025-12-14T12:47:20.525Z","avatar_url":"https://github.com/ruscito.png","language":"Python","funding_links":[],"categories":["Controls"],"sub_categories":[],"readme":"pycomm\n======\npycomm is a package that includes a collection of modules used to communicate with PLCs.\nAt the moment the first module in the package is ab_comm.\n\nTest\n~~~~\nThe library is currently test on Python 2.6, 2.7.\n\n.. image:: https://travis-ci.org/ruscito/pycomm.svg?branch=master\n    :target: https://travis-ci.org/ruscito/pycomm\n\nSetup\n~~~~~\nThe package can be installed from\n\nGitHub:\n::\n\n    git clone https://github.com/ruscito/pycomm.git\n    cd pycomm\n    sudo python setup.py install\n\n\nPyPi:\n::\n\n    pip install pycomm\n\nab_comm\n~~~~~~~\nab_comm is a module that contains a set of classes used to interface Rockwell PLCs using Ethernet/IP protocol.\nThe \"clx\" class can be used to communicate with Compactlogix, Controllogix PLCs\nThe \"slc\" can be used to communicate with Micrologix or SLC PLCs\n\nI tried to followCIP specifications volume 1 and 2 as well as `Rockwell Automation Publication 1756-PM020-EN-P - November 2012`_ .\n\n.. _Rockwell Automation Publication 1756-PM020-EN-P - November 2012: http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm020_-en-p.pdf\n\nSee the following snippet for communication with a Controllogix PLC:\n\n::\n\n    from pycomm.ab_comm.clx import Driver as ClxDriver\n    import logging\n\n\n    if __name__ == '__main__':\n        logging.basicConfig(\n            filename=\"ClxDriver.log\",\n            format=\"%(levelname)-10s %(asctime)s %(message)s\",\n            level=logging.DEBUG\n        )\n        c = ClxDriver()\n\n        if c.open('172.16.2.161'):\n\n            print(c.read_tag(['ControlWord']))\n            print(c.read_tag(['parts', 'ControlWord', 'Counts']))\n\n            print(c.write_tag('Counts', -26, 'INT'))\n            print(c.write_tag(('Counts', 26, 'INT')))\n            print(c.write_tag([('Counts', 26, 'INT')]))\n            print(c.write_tag([('Counts', -26, 'INT'), ('ControlWord', -30, 'DINT'), ('parts', 31, 'DINT')]))\n\n            # To read an array\n            r_array = c.read_array(\"TotalCount\", 1750)\n            for tag in r_array:\n                print (tag)\n\n\n            # To read string\n            c.write_string('TEMP_STRING', 'my_value')\n            c.read_string('TEMP_STRING')\n\n            # reset tha array to all 0\n            w_array = []\n            for i in xrange(1750):\n                w_array.append(0)\n            c.write_array(\"TotalCount\", w_array, \"SINT\")\n\n            c.close()\n\n\n\n\nSee the following snippet for communication with a  Micrologix PLC:\n\n\n::\n\n    from pycomm.ab_comm.slc import Driver as SlcDriver\n    import logging\n\n\n    if __name__ == '__main__':\n        logging.basicConfig(\n            filename=\"SlcDriver.log\",\n            format=\"%(levelname)-10s %(asctime)s %(message)s\",\n            level=logging.DEBUG\n        )\n        c = SlcDriver()\n        if c.open('172.16.2.160'):\n\n            print c.read_tag('S:1/5')\n            print c.read_tag('S:60', 2)\n\n            print c.write_tag('N7:0', [-30, 32767, -32767])\n            print c.write_tag('N7:0', 21)\n            print c.read_tag('N7:0', 10)\n\n            print c.write_tag('F8:0', [3.1, 4.95, -32.89])\n            print c.write_tag('F8:0', 21)\n            print c.read_tag('F8:0', 3)\n\n            print c.write_tag('B3:100', [23, -1, 4, 9])\n            print c.write_tag('B3:100', 21)\n            print c.read_tag('B3:100', 4)\n\n            print c.write_tag('T4:3.PRE', 431)\n            print c.read_tag('T4:3.PRE')\n            print c.write_tag('C5:0.PRE', 501)\n            print c.read_tag('C5:0.PRE')\n            print c.write_tag('T4:3.ACC', 432)\n            print c.read_tag('T4:3.ACC')\n            print c.write_tag('C5:0.ACC', 502)\n            print c.read_tag('C5:0.ACC')\n\n            c.write_tag('T4:2.EN', 0)\n            c.write_tag('T4:2.TT', 0)\n            c.write_tag('T4:2.DN', 0)\n            print c.read_tag('T4:2.EN', 1)\n            print c.read_tag('T4:2.TT', 1)\n            print c.read_tag('T4:2.DN',)\n\n            c.write_tag('C5:0.CU', 1)\n            c.write_tag('C5:0.CD', 0)\n            c.write_tag('C5:0.DN', 1)\n            c.write_tag('C5:0.OV', 0)\n            c.write_tag('C5:0.UN', 1)\n            c.write_tag('C5:0.UA', 0)\n            print c.read_tag('C5:0.CU')\n            print c.read_tag('C5:0.CD')\n            print c.read_tag('C5:0.DN')\n            print c.read_tag('C5:0.OV')\n            print c.read_tag('C5:0.UN')\n            print c.read_tag('C5:0.UA')\n\n            c.write_tag('B3:100', 1)\n            print c.read_tag('B3:100')\n\n            c.write_tag('B3/3955', 1)\n            print c.read_tag('B3/3955')\n\n            c.write_tag('N7:0/2', 1)\n            print c.read_tag('N7:0/2')\n\n            print c.write_tag('O:0.0/4', 1)\n            print c.read_tag('O:0.0/4')\n\n        c.close()\n\n\nThe Future\n~~~~~~~~~~\nThis package is under development.\nThe modules _ab_comm.clx_ and _ab_comm.slc_ are completed at  moment but other drivers will be added in the future.\n\nThanks\n~~~~~~\nThanks to patrickjmcd_ for the help with the Direct Connections and thanks in advance to anyone for feedback and suggestions.\n\n.. _patrickjmcd: https://github.com/patrickjmcd\n\nLicense\n~~~~~~~\npycomm is distributed under the MIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruscito%2Fpycomm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruscito%2Fpycomm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruscito%2Fpycomm/lists"}