# fins-driver
FINS (Factory Interface Network Service) Python driver for Omron PLC.
## Installation
Install the latest version from PyPI by typing this command:
pip install -U fins-driver
## Usage
Below is an example on how to use the client class.
```python
from fins import FinsClient
client = FinsClient(host='192.168.250.1', port=9600)
response = client.memory_area_read('D0')
print(response.data)
client.close()
```
## Memory Area Read
`.memory_area_read(address: str | bytes, num_items: int = 1) -> Response[bytes]`
Examples:
Read DM area at word 0.
```python
response = client.memory_area_read('D0')
```
Read CIO area at word 100 and bit 01.
```python
response = client.memory_area_read('CIO100.01')
```
## Memory Area Write
`.memory_area_write(address: str | bytes, data: bytes, num_items: int = 1) -> Response[bytes]`
Examples:
Write to CIO area at word 100. It will turn on CIO100.00 and CIO100.01. Hex
value \x00\x03 is translated to 0000 0000 0000 0011 in binary.
```python
response = client.memory_area_write("CIO100", b"\x00\x03")
```
Write to CIO area at word 100 and bit 01. We only need to provide 1 bytes data
to write bit status. Hex value \x01 is translated to ON, while \x00 is
translated to OFF.
```python
response = client.memory_area_write("CIO100.01", b"\x01")
```
## Memory Area Fill
`.memory_area_fill(address: str | bytes, data: bytes, num_items: int = 1) -> Response[bytes]`
Examples:
Fill DM area word with \x00\x03.
```python
response = client.memory_area_fill("D0", b"\x00\x03")
```
## Multiple Memory Area Read
`.multiple_memory_area_read(*addresses: str | bytes) -> Response[List[bytes]]`
Examples:
Read multiple memory area words.
```python
response = client.multiple_memory_area_read("D0", "D1")
```
Read multiple memory area bits.
```python
response = client.multiple_memory_area_read("CIO100.00", "CIO100.01")
```
## Memory Area Transfer
`.memory_area_transfer(source_address: str | bytes, dest_address: str | bytes, num_items: int = 1) -> Response[bytes]`
Examples:
Transfer memory area word from D0 to D1.
```python
response = client.memory_area_transfer("D0", "D1")
```
## Run
`.run(mode: debug | monitor | run = "monitor", program_number: bytes = b"\xff\xff") -> Response[bytes]`
Examples:
Change PLC to run in monitor mode.
```python
response = client.run("monitor")
```
## Stop
`.stop() -> Response[bytes]`
Examples:
Stop PLC device.
```python
response = client.stop()
```
## Forced Set/Reset
`.forced_set_reset(*specs: SetResetSpec) -> Response[bytes]`
Examples:
Force-set ON the CIO0.01.
```python
from fins import SetResetSpecCode, SetResetSpec
response = client.forced_set_reset(SetResetSpec(SetResetSpecCode.FORCE_SET, "CIO0.01"))
```
## Forced Set/Reset Cancel
`.forced_set_reset_cancel() -> Response[bytes]`
Examples:
Cancel all bits that have been forced ON or OFF.
```python
response = client.forced_set_reset_cancel()
```
## Memory Areas
Below is supported memory areas prefix.
| Prefix | Description |
| ------ | ---------------- |
| CIO | Core IO area |
| W | Work area |
| H | Holding area |
| A | Auxiliary area |
| D | Data Memory area |
For the core IO area, you can omit the prefix. For example, address `100.01` is
the same as `CIO100.01`.
## Response Object
| Property/Method | Type | Description |
| --------------- | --------- | ------------------------------------------------------ |
| data | `T` | Response data. Refer to each command to see data type. |
| code | `bytes` | Response code, primarily \x00\x00 if it's OK. |
| status_text | `str` | Textual description of the response code. |
| ok | `bool` | True if request was OK (Normal completion). |
| raw_data | `bytes` | Original unparsed response data. |
| raw | `bytes` | The overall raw content of response. |
| header | `Header` | Response header data. |
| command | `Command` | The request command that was sent to the device. |
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/indrarudianto/fins-driver",
"name": "fins-driver",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "FINS, Omron, PLC, driver",
"author": "Indra Rudianto",
"author_email": "indrarudianto.official@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/98/8b/ffeb06b1445be599cda7b81d3f26cd67a472de363c6eb74054c78377b24f/fins_driver-0.3.1.tar.gz",
"platform": null,
"description": "# fins-driver\n\nFINS (Factory Interface Network Service) Python driver for Omron PLC.\n\n## Installation\n\nInstall the latest version from PyPI by typing this command:\n\n pip install -U fins-driver\n\n## Usage\n\nBelow is an example on how to use the client class.\n\n```python\nfrom fins import FinsClient\n\nclient = FinsClient(host='192.168.250.1', port=9600)\nresponse = client.memory_area_read('D0')\nprint(response.data)\nclient.close()\n```\n\n## Memory Area Read\n\n`.memory_area_read(address: str | bytes, num_items: int = 1) -> Response[bytes]`\n\nExamples:\n\nRead DM area at word 0.\n\n```python\nresponse = client.memory_area_read('D0')\n```\n\nRead CIO area at word 100 and bit 01.\n\n```python\nresponse = client.memory_area_read('CIO100.01')\n```\n\n## Memory Area Write\n\n`.memory_area_write(address: str | bytes, data: bytes, num_items: int = 1) -> Response[bytes]`\n\nExamples:\n\nWrite to CIO area at word 100. It will turn on CIO100.00 and CIO100.01. Hex\nvalue \\x00\\x03 is translated to 0000 0000 0000 0011 in binary.\n\n```python\nresponse = client.memory_area_write(\"CIO100\", b\"\\x00\\x03\")\n```\n\nWrite to CIO area at word 100 and bit 01. We only need to provide 1 bytes data\nto write bit status. Hex value \\x01 is translated to ON, while \\x00 is\ntranslated to OFF.\n\n```python\nresponse = client.memory_area_write(\"CIO100.01\", b\"\\x01\")\n```\n\n## Memory Area Fill\n\n`.memory_area_fill(address: str | bytes, data: bytes, num_items: int = 1) -> Response[bytes]`\n\nExamples:\n\nFill DM area word with \\x00\\x03.\n\n```python\nresponse = client.memory_area_fill(\"D0\", b\"\\x00\\x03\")\n```\n\n## Multiple Memory Area Read\n\n`.multiple_memory_area_read(*addresses: str | bytes) -> Response[List[bytes]]`\n\nExamples:\n\nRead multiple memory area words.\n\n```python\nresponse = client.multiple_memory_area_read(\"D0\", \"D1\")\n```\n\nRead multiple memory area bits.\n\n```python\nresponse = client.multiple_memory_area_read(\"CIO100.00\", \"CIO100.01\")\n```\n\n## Memory Area Transfer\n\n`.memory_area_transfer(source_address: str | bytes, dest_address: str | bytes, num_items: int = 1) -> Response[bytes]`\n\nExamples:\n\nTransfer memory area word from D0 to D1.\n\n```python\nresponse = client.memory_area_transfer(\"D0\", \"D1\")\n```\n\n## Run\n\n`.run(mode: debug | monitor | run = \"monitor\", program_number: bytes = b\"\\xff\\xff\") -> Response[bytes]`\n\nExamples:\n\nChange PLC to run in monitor mode.\n\n```python\nresponse = client.run(\"monitor\")\n```\n\n## Stop\n\n`.stop() -> Response[bytes]`\n\nExamples:\n\nStop PLC device.\n\n```python\nresponse = client.stop()\n```\n\n## Forced Set/Reset\n\n`.forced_set_reset(*specs: SetResetSpec) -> Response[bytes]`\n\nExamples:\n\nForce-set ON the CIO0.01.\n\n```python\nfrom fins import SetResetSpecCode, SetResetSpec\n\nresponse = client.forced_set_reset(SetResetSpec(SetResetSpecCode.FORCE_SET, \"CIO0.01\"))\n```\n\n## Forced Set/Reset Cancel\n\n`.forced_set_reset_cancel() -> Response[bytes]`\n\nExamples:\n\nCancel all bits that have been forced ON or OFF.\n\n```python\nresponse = client.forced_set_reset_cancel()\n```\n\n## Memory Areas\n\nBelow is supported memory areas prefix.\n\n| Prefix | Description |\n| ------ | ---------------- |\n| CIO | Core IO area |\n| W | Work area |\n| H | Holding area |\n| A | Auxiliary area |\n| D | Data Memory area |\n\nFor the core IO area, you can omit the prefix. For example, address `100.01` is\nthe same as `CIO100.01`.\n\n## Response Object\n\n| Property/Method | Type | Description |\n| --------------- | --------- | ------------------------------------------------------ |\n| data | `T` | Response data. Refer to each command to see data type. |\n| code | `bytes` | Response code, primarily \\x00\\x00 if it's OK. |\n| status_text | `str` | Textual description of the response code. |\n| ok | `bool` | True if request was OK (Normal completion). |\n| raw_data | `bytes` | Original unparsed response data. |\n| raw | `bytes` | The overall raw content of response. |\n| header | `Header` | Response header data. |\n| command | `Command` | The request command that was sent to the device. |\n\n## License\n\nMIT\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python FINS driver for Omron PLC",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/indrarudianto/fins-driver",
"Repository": "https://github.com/indrarudianto/fins-driver"
},
"split_keywords": [
"fins",
" omron",
" plc",
" driver"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c913f08e544ebeabccb7c2df41fbfe303614b143284e75c6a49df6e69fcd95ea",
"md5": "cd97cdff592e3f307d41b0ae64695009",
"sha256": "89c94d462757dc059718df70aeac371234184a97c8a62e09a19f8ee06241ca45"
},
"downloads": -1,
"filename": "fins_driver-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cd97cdff592e3f307d41b0ae64695009",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 12039,
"upload_time": "2024-12-05T07:19:52",
"upload_time_iso_8601": "2024-12-05T07:19:52.944714Z",
"url": "https://files.pythonhosted.org/packages/c9/13/f08e544ebeabccb7c2df41fbfe303614b143284e75c6a49df6e69fcd95ea/fins_driver-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "988bffeb06b1445be599cda7b81d3f26cd67a472de363c6eb74054c78377b24f",
"md5": "a4eb77f469fd8196130846856827f0eb",
"sha256": "20c8119117fd566b42b1c4bc61f19836ab3c322ba855df4d910f83f2b406415f"
},
"downloads": -1,
"filename": "fins_driver-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "a4eb77f469fd8196130846856827f0eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 10663,
"upload_time": "2024-12-05T07:19:54",
"upload_time_iso_8601": "2024-12-05T07:19:54.069035Z",
"url": "https://files.pythonhosted.org/packages/98/8b/ffeb06b1445be599cda7b81d3f26cd67a472de363c6eb74054c78377b24f/fins_driver-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-05 07:19:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "indrarudianto",
"github_project": "fins-driver",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "fins-driver"
}