{ "info": { "author": "Patrick McDonagh", "author_email": "patrickjmcd@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Pycomm Scanlist\n\nPython module for managing a list of tags being read from a Rockwell Automation PLC.\n\n## Scanlist Class\n\nThe module implements a `Scanlist` class with a required parameter of IP Address. Optionally, a `plc_type` and a `change_handler` parameter can be passed to the class.\n\n### `plc_type` parameter\n\nDue to different implementations within `pycomm` for Micro800 PLCs, in order to read from a Micro800 PLC, the value of `plc_type` must be `\"Micro800\"`. The default value for `plc_type` is `\"CLX\"` for ControlLogix/CompactLogix PLCs.\n\n### `change_handler` parameter\n\nThe `change_handler` should be a function with a required parameter `sender` and an optional parameter `eargs`. `sender` is a reference to the instance of `Tag` that has changed.\n\nThe default implementation of change_handler is:\n\n```Python\ndef change_handler(sender):\n \"\"\"Handle a tag value change.\"\"\"\n print(\"{} changed from {} to {}\".format(sender.tag_name, sender.last_value, sender.value))\n```\n\n### `Scanlist.add(tag_name)` function\n\n`Scanlist.add` takes one parameter `tag_name` and adds it to the list of tags to scan.\n\n### `Scanlist.remove(tag_name)` function\n\n`Scanlist.add` takes one parameter `tag_name` and removes it from the list of tags to scan.\n\n### `Scanlist.print_tag_names()` function\n\n`Scanlist.print_tag_names()` prints all tag names currently in the list of tags to scan.\n\n### `Scanlist.scan()` function\n\n`Scanlist.scan()` polls all tags in the list of tags to scan and runs the `change_handler` function if the tag value has changed.\n\n## Example\n\nThe following example creates two scanlists, one for the Micro800 PLC at 192.168.1.12 and another for the CLX PLC at 192.168.1.11. Each PLC has 4 tags in the scanlist.\n\n```Python\nimport time\nfrom pycomm_scanlist import Scanlist\n\ndef handle_tag_change(sender, eargs=None):\n \"\"\"Handle a tag value change.\"\"\"\n print(\"{} CHANGED FROM {} TO {}\".format(sender.tag_name, sender.last_value, sender.value))\n\nmicro_scan_list = Scanlist(\"192.168.1.12\", plc_type=\"Micro800\", change_handler=handle_tag_change)\nmicro_scan_list.add(\"pond1Volume\")\nmicro_scan_list.add(\"pond2Volume\")\nmicro_scan_list.add(\"pond3Volume\")\nmicro_scan_list.add(\"pond4Volume\")\n\nclx_scan_list = Scanlist(\"192.168.1.11\", change_handler=handle_tag_change)\nclx_scan_list.add(\"DH_Fluid_Level\")\nclx_scan_list.add(\"DH_IntakePressure\")\nclx_scan_list.add(\"DH_IntakeTemperature\")\nclx_scan_list.add(\"DH_MaxIntakePressure_Forever\")\n\nmicro_scan_list.print_tag_names()\nclx_scan_list.print_tag_names()\n\nwhile True:\n micro_scan_list.scan()\n clx_scan_list.scan()\n time.sleep(5)\n\n```\n\n## TODO\n\n- Add tests to increase coverage.\n- Per-tag handlers?\n- PyPi package\n\n## Contributors\n\n- Patrick McDonagh - [@patrickjmcd](http://github.com/patrickjmcd) - Owner\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/patrickjmcd/pycomm-scanlist", "keywords": "", "license": "GNU General Public License v3.0", "maintainer": "", "maintainer_email": "", "name": "pycomm-scanlist", "package_url": "https://pypi.org/project/pycomm-scanlist/", "platform": "", "project_url": "https://pypi.org/project/pycomm-scanlist/", "project_urls": { "Homepage": "https://github.com/patrickjmcd/pycomm-scanlist" }, "release_url": "https://pypi.org/project/pycomm-scanlist/0.1/", "requires_dist": [ "pycomm" ], "requires_python": "", "summary": "", "version": "0.1" }, "last_serial": 4118065, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "eed48467646001ad8a5f6c59300f3bf1", "sha256": "59adcbca316d82d0e4315755b1baa89c5e246b3a02f3490d3d14ba035299eab4" }, "downloads": -1, "filename": "pycomm_scanlist-0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "eed48467646001ad8a5f6c59300f3bf1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4895, "upload_time": "2018-07-30T22:11:34", "url": "https://files.pythonhosted.org/packages/3a/dd/6126b59266dbf16be87ce2ca90748d0b82098c29b46111ddb7302c399c74/pycomm_scanlist-0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9c2f977ef60aee49d9af4d4a4543441", "sha256": "af98a96515c0698b5c6948cb313903b0a3f6b1094815a1dbab08f4bdf41735b0" }, "downloads": -1, "filename": "pycomm-scanlist-0.1.tar.gz", "has_sig": false, "md5_digest": "a9c2f977ef60aee49d9af4d4a4543441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3834, "upload_time": "2018-07-30T22:11:35", "url": "https://files.pythonhosted.org/packages/5e/9e/c0ea2229a97f589338f2f25de2d3af6ea42983c7851bec359e9c94b6fb97/pycomm-scanlist-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eed48467646001ad8a5f6c59300f3bf1", "sha256": "59adcbca316d82d0e4315755b1baa89c5e246b3a02f3490d3d14ba035299eab4" }, "downloads": -1, "filename": "pycomm_scanlist-0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "eed48467646001ad8a5f6c59300f3bf1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4895, "upload_time": "2018-07-30T22:11:34", "url": "https://files.pythonhosted.org/packages/3a/dd/6126b59266dbf16be87ce2ca90748d0b82098c29b46111ddb7302c399c74/pycomm_scanlist-0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9c2f977ef60aee49d9af4d4a4543441", "sha256": "af98a96515c0698b5c6948cb313903b0a3f6b1094815a1dbab08f4bdf41735b0" }, "downloads": -1, "filename": "pycomm-scanlist-0.1.tar.gz", "has_sig": false, "md5_digest": "a9c2f977ef60aee49d9af4d4a4543441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3834, "upload_time": "2018-07-30T22:11:35", "url": "https://files.pythonhosted.org/packages/5e/9e/c0ea2229a97f589338f2f25de2d3af6ea42983c7851bec359e9c94b6fb97/pycomm-scanlist-0.1.tar.gz" } ] }