emodbus


Nameemodbus JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/estaleiroweb/mandrake
SummaryAll Magic Methods Implement. You can easyly to implement all magic methods or part of them
upload_time2023-03-19 02:04:06
maintainer
docs_urlNone
authorHelbert Braga Fernandes
requires_python>=2.0
licenseMIT License
keywords magic methods class
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Description

> Version: 0.0.1
> python 2.x,3.x

Project easy Modbus.

In this package you can connect in TCP, RTU or ASC mode in modbus usign a mask to collect everything from your device

## Donate

**PIX**: +55 31 99101-8619

## Contact

**URL**: [http://estaleiroweb.com.br](http://estaleiroweb.com.br)

**GIT**: [https://github.com/estaleiroweb/emodbus](https://github.com/estaleiroweb/emodbus)

# Instalation

> pip install emodbus

# Upgrade

> pip install emodbus -upgrade

# Use

```python
import emodbus as emb

# connect to bus of devices
tcp = emb.ConnTCP('192.168.1.45')
rtu = emb.ConnRTU('COM4')

# define default MIB
# {name: (Address:int,functionCode:int,callbackFunction_modbustype:'None|str|tuple|list'),....},
addrs = {
    'Temperature': [1, 4, ('Dec', {'dec': 1})],
    'Humidy': [2, 4, ['Dec', {'dec': 1}]],
    'TemperatureRaw': [1, 4],
    'HumidyRaw': [2, 4],
}
emb.Conn.defSlave(1, addrs)

# Read MIB of any slave of the connection
print('TCP MIB Slave 1', tcp.slave(1)(), sep=':')
print()

# define MIB of connection/slave
tcp.slave(1, addrs)
# read all MIB
slaves = [1]
for slave in slaves:
    print('Read All Slave ', slave)
    print('TCP',tcp.read(slave), sep=':')
    print('RTU',rtu.read(slave), sep=':')
print()

# read only some address
addr = ['Temperature', 'xxxxxxxxxx', 'Humidy']
for slave in slaves:
    print('Read Slave '+str(slave), addr, sep=':')
    print('TCP',tcp.read(slave, addr), sep=':')
    print('RTU',rtu.read(slave, addr), sep=':')
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/estaleiroweb/mandrake",
    "name": "emodbus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.0",
    "maintainer_email": "",
    "keywords": "magic methods class",
    "author": "Helbert Braga Fernandes",
    "author_email": "helbertfernandes@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# Description\r\n\r\n> Version: 0.0.1\r\n> python 2.x,3.x\r\n\r\nProject easy Modbus.\r\n\r\nIn this package you can connect in TCP, RTU or ASC mode in modbus usign a mask to collect everything from your device\r\n\r\n## Donate\r\n\r\n**PIX**: +55 31 99101-8619\r\n\r\n## Contact\r\n\r\n**URL**: [http://estaleiroweb.com.br](http://estaleiroweb.com.br)\r\n\r\n**GIT**: [https://github.com/estaleiroweb/emodbus](https://github.com/estaleiroweb/emodbus)\r\n\r\n# Instalation\r\n\r\n> pip install emodbus\r\n\r\n# Upgrade\r\n\r\n> pip install emodbus -upgrade\r\n\r\n# Use\r\n\r\n```python\r\nimport emodbus as emb\r\n\r\n# connect to bus of devices\r\ntcp = emb.ConnTCP('192.168.1.45')\r\nrtu = emb.ConnRTU('COM4')\r\n\r\n# define default MIB\r\n# {name: (Address:int,functionCode:int,callbackFunction_modbustype:'None|str|tuple|list'),....},\r\naddrs = {\r\n    'Temperature': [1, 4, ('Dec', {'dec': 1})],\r\n    'Humidy': [2, 4, ['Dec', {'dec': 1}]],\r\n    'TemperatureRaw': [1, 4],\r\n    'HumidyRaw': [2, 4],\r\n}\r\nemb.Conn.defSlave(1, addrs)\r\n\r\n# Read MIB of any slave of the connection\r\nprint('TCP MIB Slave 1', tcp.slave(1)(), sep=':')\r\nprint()\r\n\r\n# define MIB of connection/slave\r\ntcp.slave(1, addrs)\r\n# read all MIB\r\nslaves = [1]\r\nfor slave in slaves:\r\n    print('Read All Slave ', slave)\r\n    print('TCP',tcp.read(slave), sep=':')\r\n    print('RTU',rtu.read(slave), sep=':')\r\nprint()\r\n\r\n# read only some address\r\naddr = ['Temperature', 'xxxxxxxxxx', 'Humidy']\r\nfor slave in slaves:\r\n    print('Read Slave '+str(slave), addr, sep=':')\r\n    print('TCP',tcp.read(slave, addr), sep=':')\r\n    print('RTU',rtu.read(slave, addr), sep=':')\r\n```\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "All Magic Methods Implement. You can easyly to implement all magic methods or part of them",
    "version": "0.0.5",
    "split_keywords": [
        "magic",
        "methods",
        "class"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4a163fd9c0ce295aa3e34418a3c5cbeee1ec2c815243a4f407a27e2749c5b44",
                "md5": "8c0d38db000cb9302bf4439ac9a4b961",
                "sha256": "adfe42bbd4851cb9b5c1f2c17e55bef5a9bc54d6ede8b177d8552f66bf52c436"
            },
            "downloads": -1,
            "filename": "emodbus-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c0d38db000cb9302bf4439ac9a4b961",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=2.0",
            "size": 8530,
            "upload_time": "2023-03-19T02:04:06",
            "upload_time_iso_8601": "2023-03-19T02:04:06.467313Z",
            "url": "https://files.pythonhosted.org/packages/e4/a1/63fd9c0ce295aa3e34418a3c5cbeee1ec2c815243a4f407a27e2749c5b44/emodbus-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-19 02:04:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "estaleiroweb",
    "github_project": "mandrake",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "emodbus"
}
        
Elapsed time: 0.06551s