volttron-lib-modbus-driver


Namevolttron-lib-modbus-driver JSON
Version 0.2.1rc0 PyPI version JSON
download
home_pagehttps://github.com/VOLTTRON/volttron-lib-modbus-driver
SummaryModbus driver supported and maintained by the Volttron team.
upload_time2023-05-12 16:54:17
maintainer
docs_urlNone
authorMark Bonicillo
requires_python>=3.10,<4.0
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # volttron-lib-modbus-driver

[![Eclipse VOLTTRON™](https://img.shields.io/badge/Eclips%20VOLTTRON--red.svg)](https://volttron.readthedocs.io/en/latest/)
![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)
![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)
![Passing?](https://github.com/VOLTTRON/volttron-lib-modbus-driver/actions/workflows/run-tests.yml/badge.svg)
[![pypi version](https://img.shields.io/pypi/v/volttron-lib-modbus-driver.svg)](https://pypi.org/project/volttron-lib-modbus-driver/)

> **Note**
> VOLTTRON’s modbus driver supports the Modbus over TCP/IP protocol only.


## Requires

* python >=3.10
* volttron-lib-base-driver
* pymodbus >= 2.3.5


# Documentation
More detailed documentation can be found on [ReadTheDocs](https://volttron.readthedocs.io/en/modular/). The RST source
of the documentation for this component is located in the "docs" directory of this repository.


# Installation

Before installing, VOLTTRON should be installed and running.  Its virtual environment should be active.
Information on how to install of the VOLTTRON platform can be found
[here](https://github.com/eclipse-volttron/volttron-core).

1. If it is not already, install the VOLTTRON Platform Driver Agent:

    ```shell
    vctl install volttron-platform-driver --vip-identity platform.driver --start
    ```

2. Install the volttron-lib-modbus-driver library.

    ```shell
    pip install volttron-lib-modbus-driver
    ```

3. Store device and registry files for the Modbus device to the Platform Driver configuration store:

    Create a driver configuration file called `modbus.config`. There are three arguments for the driver_config section of the device configuration file:

    * device_address:  IP Address of the device.

    * port: Port the device is listening on. Defaults to 502 which is the standard port for Modbus devices.

    * slave_id:  Slave ID of the device. Defaults to 0. Use 0 for no slave.

    This repo provides an example configuration in the file "modbus_example.config".

    Here is an example device configuration file:

    ```json
    {
        "driver_config": {"device_address": "10.0.0.4"},
        "driver_type": "modbus",
        "registry_config":"config://catalyst371.csv",
        "interval": 120,
        "timezone": "UTC",
        "campus": "campus",
        "building": "building",
        "unit": "modbus1",
        "heart_beat_point": "ESMMode"
    }
    ```

    Create another file called `mobus.csv`. This CSV file will be your modbus registry configuration file. Each row configures a point on the device.

    The following columns are required for each row:

    * Volttron Point Name - The name by which the platform and agents will refer to this point.

    * Units - Used for meta data when creating point information on the historian.

    * Modbus Register - A string representing how to interpret the binary format of the data register. The string takes two forms:

        * “BOOL” for coils and discrete inputs.

        * A format string for the Python struct module. See the [Python3 Struct docs](http://docs.python.org/3/library/struct.html) for full documentation. The supplied format string must only represent one value. See the documentation of your device to determine how to interpret the registers. Some Examples:

        * “>f” - A big endian 32-bit floating point number.

        * “<H” - A little endian 16-bit unsigned integer.

        * “>l” - A big endian 32-bit integer.

    * Writable - Either TRUE or FALSE. Determines if the point can be written to.

    * Point Address - Modbus address of the point. Cannot include any offset value, it must be the exact value of the address.

    * Mixed Endian - (Optional) Either TRUE or FALSE. For mixed endian values. This will reverse the order of the Modbus registers that make up this point before parsing the value or writing it out to the device. Has no effect on bit values.

    The following column is optional:

    * Default Value - The default value for the point. When the point is reverted by an agent it will change back to this value. If this value is missing it will revert to the last known value not set by an agent.

    Any additional columns will be ignored. It is common practice to include a Point Name or Reference Point Name to include the device documentation’s name for the point and Notes and Unit Details for additional information about a point.

    The following is an example of a Modbus registry configuration file:

    ```csv
    Reference Point Name,Volttron Point Name,Units,Units Details,Modbus Register,Writable,Point Address,Default Value,Notes
    CO2Sensor,ReturnAirCO2,PPM,0.00-2000.00,>f,FALSE,1001,,CO2 Reading 0.00-2000.0 ppm
    CO2Stpt,ReturnAirCO2Stpt,PPM,1000.00 (default),>f,TRUE,1011,1000,Setpoint to enable demand control ventilation
    Cool1Spd,CoolSupplyFanSpeed1,%,0.00 to 100.00 (75 default),>f,TRUE,1005,75,Fan speed on cool 1 call
    Cool2Spd,CoolSupplyFanSpeed2,%,0.00 to 100.00 (90 default),>f,TRUE,1007,90,Fan speed on Cool2 Call
    Damper,DamperSignal,%,0.00 - 100.00,>f,FALSE,1023,,Output to the economizer damper
    DaTemp,DischargeAirTemperature,F,(-)39.99 to 248.00,>f,FALSE,1009,,Discharge air reading
    ESMEconMin,ESMDamperMinPosition,%,0.00 to 100.00 (5 default),>f,TRUE,1013,5,Minimum damper position during the energy savings mode
    FanPower,SupplyFanPower, kW,0.00 to 100.00,>f,FALSE,1015,,Fan power from drive
    FanSpeed,SupplyFanSpeed,%,0.00 to 100.00,>f,FALSE,1003,,Fan speed from drive
    HeatCall1,HeatCall1,On / Off,on/off,BOOL,FALSE,1113,,Status indicator of heating stage 1 need
    HeartBeat,heartbeat,On / Off,on/off,BOOL,FALSE,1114,,Status indicator of heating stage 2 need
    ```

    Add modbus.csv and modbus.config to the configuration store:

    ```
    vctl config store platform.driver devices/campus/building/modbus modbus.config
    vctl config store platform.driver modbus.csv modbus.csv --csv
    ```

4. Observe Data

    To see data being published to the bus, install a [Listener Agent](https://pypi.org/project/volttron-listener/):

    ```
    vctl install volttron-listener --start
    ```

    Once installed, you should see the data being published by viewing the Volttron logs file that was created in step 2.
    To watch the logs, open a separate terminal and run the following command:

    ```
    tail -f <path to folder containing volttron.log>/volttron.log
    ```

# Development

Please see the following for contributing guidelines [contributing](https://github.com/eclipse-volttron/volttron-core/blob/develop/CONTRIBUTING.md).

Please see the following helpful guide about [developing modular VOLTTRON agents](https://github.com/eclipse-volttron/volttron-core/blob/develop/DEVELOPING_ON_MODULAR.md)


# Disclaimer Notice

This material was prepared as an account of work sponsored by an agency of the
United States Government.  Neither the United States Government nor the United
States Department of Energy, nor Battelle, nor any of their employees, nor any
jurisdiction or organization that has cooperated in the development of these
materials, makes any warranty, express or implied, or assumes any legal
liability or responsibility for the accuracy, completeness, or usefulness or any
information, apparatus, product, software, or process disclosed, or represents
that its use would not infringe privately owned rights.

Reference herein to any specific commercial product, process, or service by
trade name, trademark, manufacturer, or otherwise does not necessarily
constitute or imply its endorsement, recommendation, or favoring by the United
States Government or any agency thereof, or Battelle Memorial Institute. The
views and opinions of authors expressed herein do not necessarily state or
reflect those of the United States Government or any agency thereof.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/VOLTTRON/volttron-lib-modbus-driver",
    "name": "volttron-lib-modbus-driver",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Mark Bonicillo",
    "author_email": "volttron@pnnl.gov",
    "download_url": "https://files.pythonhosted.org/packages/37/7c/7e804892457048c5b524eae5dc139255a1d09322e9afee05470196f3297b/volttron_lib_modbus_driver-0.2.1rc0.tar.gz",
    "platform": null,
    "description": "# volttron-lib-modbus-driver\n\n[![Eclipse VOLTTRON\u2122](https://img.shields.io/badge/Eclips%20VOLTTRON--red.svg)](https://volttron.readthedocs.io/en/latest/)\n![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)\n![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)\n![Passing?](https://github.com/VOLTTRON/volttron-lib-modbus-driver/actions/workflows/run-tests.yml/badge.svg)\n[![pypi version](https://img.shields.io/pypi/v/volttron-lib-modbus-driver.svg)](https://pypi.org/project/volttron-lib-modbus-driver/)\n\n> **Note**\n> VOLTTRON\u2019s modbus driver supports the Modbus over TCP/IP protocol only.\n\n\n## Requires\n\n* python >=3.10\n* volttron-lib-base-driver\n* pymodbus >= 2.3.5\n\n\n# Documentation\nMore detailed documentation can be found on [ReadTheDocs](https://volttron.readthedocs.io/en/modular/). The RST source\nof the documentation for this component is located in the \"docs\" directory of this repository.\n\n\n# Installation\n\nBefore installing, VOLTTRON should be installed and running.  Its virtual environment should be active.\nInformation on how to install of the VOLTTRON platform can be found\n[here](https://github.com/eclipse-volttron/volttron-core).\n\n1. If it is not already, install the VOLTTRON Platform Driver Agent:\n\n    ```shell\n    vctl install volttron-platform-driver --vip-identity platform.driver --start\n    ```\n\n2. Install the volttron-lib-modbus-driver library.\n\n    ```shell\n    pip install volttron-lib-modbus-driver\n    ```\n\n3. Store device and registry files for the Modbus device to the Platform Driver configuration store:\n\n    Create a driver configuration file called `modbus.config`. There are three arguments for the driver_config section of the device configuration file:\n\n    * device_address:  IP Address of the device.\n\n    * port: Port the device is listening on. Defaults to 502 which is the standard port for Modbus devices.\n\n    * slave_id:  Slave ID of the device. Defaults to 0. Use 0 for no slave.\n\n    This repo provides an example configuration in the file \"modbus_example.config\".\n\n    Here is an example device configuration file:\n\n    ```json\n    {\n        \"driver_config\": {\"device_address\": \"10.0.0.4\"},\n        \"driver_type\": \"modbus\",\n        \"registry_config\":\"config://catalyst371.csv\",\n        \"interval\": 120,\n        \"timezone\": \"UTC\",\n        \"campus\": \"campus\",\n        \"building\": \"building\",\n        \"unit\": \"modbus1\",\n        \"heart_beat_point\": \"ESMMode\"\n    }\n    ```\n\n    Create another file called `mobus.csv`. This CSV file will be your modbus registry configuration file. Each row configures a point on the device.\n\n    The following columns are required for each row:\n\n    * Volttron Point Name - The name by which the platform and agents will refer to this point.\n\n    * Units - Used for meta data when creating point information on the historian.\n\n    * Modbus Register - A string representing how to interpret the binary format of the data register. The string takes two forms:\n\n        * \u201cBOOL\u201d for coils and discrete inputs.\n\n        * A format string for the Python struct module. See the [Python3 Struct docs](http://docs.python.org/3/library/struct.html) for full documentation. The supplied format string must only represent one value. See the documentation of your device to determine how to interpret the registers. Some Examples:\n\n        * \u201c>f\u201d - A big endian 32-bit floating point number.\n\n        * \u201c<H\u201d - A little endian 16-bit unsigned integer.\n\n        * \u201c>l\u201d - A big endian 32-bit integer.\n\n    * Writable - Either TRUE or FALSE. Determines if the point can be written to.\n\n    * Point Address - Modbus address of the point. Cannot include any offset value, it must be the exact value of the address.\n\n    * Mixed Endian - (Optional) Either TRUE or FALSE. For mixed endian values. This will reverse the order of the Modbus registers that make up this point before parsing the value or writing it out to the device. Has no effect on bit values.\n\n    The following column is optional:\n\n    * Default Value - The default value for the point. When the point is reverted by an agent it will change back to this value. If this value is missing it will revert to the last known value not set by an agent.\n\n    Any additional columns will be ignored. It is common practice to include a Point Name or Reference Point Name to include the device documentation\u2019s name for the point and Notes and Unit Details for additional information about a point.\n\n    The following is an example of a Modbus registry configuration file:\n\n    ```csv\n    Reference Point Name,Volttron Point Name,Units,Units Details,Modbus Register,Writable,Point Address,Default Value,Notes\n    CO2Sensor,ReturnAirCO2,PPM,0.00-2000.00,>f,FALSE,1001,,CO2 Reading 0.00-2000.0 ppm\n    CO2Stpt,ReturnAirCO2Stpt,PPM,1000.00 (default),>f,TRUE,1011,1000,Setpoint to enable demand control ventilation\n    Cool1Spd,CoolSupplyFanSpeed1,%,0.00 to 100.00 (75 default),>f,TRUE,1005,75,Fan speed on cool 1 call\n    Cool2Spd,CoolSupplyFanSpeed2,%,0.00 to 100.00 (90 default),>f,TRUE,1007,90,Fan speed on Cool2 Call\n    Damper,DamperSignal,%,0.00 - 100.00,>f,FALSE,1023,,Output to the economizer damper\n    DaTemp,DischargeAirTemperature,F,(-)39.99 to 248.00,>f,FALSE,1009,,Discharge air reading\n    ESMEconMin,ESMDamperMinPosition,%,0.00 to 100.00 (5 default),>f,TRUE,1013,5,Minimum damper position during the energy savings mode\n    FanPower,SupplyFanPower, kW,0.00 to 100.00,>f,FALSE,1015,,Fan power from drive\n    FanSpeed,SupplyFanSpeed,%,0.00 to 100.00,>f,FALSE,1003,,Fan speed from drive\n    HeatCall1,HeatCall1,On / Off,on/off,BOOL,FALSE,1113,,Status indicator of heating stage 1 need\n    HeartBeat,heartbeat,On / Off,on/off,BOOL,FALSE,1114,,Status indicator of heating stage 2 need\n    ```\n\n    Add modbus.csv and modbus.config to the configuration store:\n\n    ```\n    vctl config store platform.driver devices/campus/building/modbus modbus.config\n    vctl config store platform.driver modbus.csv modbus.csv --csv\n    ```\n\n4. Observe Data\n\n    To see data being published to the bus, install a [Listener Agent](https://pypi.org/project/volttron-listener/):\n\n    ```\n    vctl install volttron-listener --start\n    ```\n\n    Once installed, you should see the data being published by viewing the Volttron logs file that was created in step 2.\n    To watch the logs, open a separate terminal and run the following command:\n\n    ```\n    tail -f <path to folder containing volttron.log>/volttron.log\n    ```\n\n# Development\n\nPlease see the following for contributing guidelines [contributing](https://github.com/eclipse-volttron/volttron-core/blob/develop/CONTRIBUTING.md).\n\nPlease see the following helpful guide about [developing modular VOLTTRON agents](https://github.com/eclipse-volttron/volttron-core/blob/develop/DEVELOPING_ON_MODULAR.md)\n\n\n# Disclaimer Notice\n\nThis material was prepared as an account of work sponsored by an agency of the\nUnited States Government.  Neither the United States Government nor the United\nStates Department of Energy, nor Battelle, nor any of their employees, nor any\njurisdiction or organization that has cooperated in the development of these\nmaterials, makes any warranty, express or implied, or assumes any legal\nliability or responsibility for the accuracy, completeness, or usefulness or any\ninformation, apparatus, product, software, or process disclosed, or represents\nthat its use would not infringe privately owned rights.\n\nReference herein to any specific commercial product, process, or service by\ntrade name, trademark, manufacturer, or otherwise does not necessarily\nconstitute or imply its endorsement, recommendation, or favoring by the United\nStates Government or any agency thereof, or Battelle Memorial Institute. The\nviews and opinions of authors expressed herein do not necessarily state or\nreflect those of the United States Government or any agency thereof.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Modbus driver supported and maintained by the Volttron team.",
    "version": "0.2.1rc0",
    "project_urls": {
        "Homepage": "https://github.com/VOLTTRON/volttron-lib-modbus-driver",
        "Repository": "https://github.com/VOLTTRON/volttron-lib-modbus-driver"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "abc29022378a3319ff0241becd6d92b15e0c1867817cb651313361379dabc74c",
                "md5": "7f13be37c8f2d23bf49dc2658deaff02",
                "sha256": "43b0daf0a72fc68a1cf5df1ef0b5b9610da00fbd96450b8ca65c3ac2b1e2540e"
            },
            "downloads": -1,
            "filename": "volttron_lib_modbus_driver-0.2.1rc0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f13be37c8f2d23bf49dc2658deaff02",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 12782,
            "upload_time": "2023-05-12T16:54:16",
            "upload_time_iso_8601": "2023-05-12T16:54:16.291763Z",
            "url": "https://files.pythonhosted.org/packages/ab/c2/9022378a3319ff0241becd6d92b15e0c1867817cb651313361379dabc74c/volttron_lib_modbus_driver-0.2.1rc0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "377c7e804892457048c5b524eae5dc139255a1d09322e9afee05470196f3297b",
                "md5": "9f4381751ff14b9bb359fbe4ef44d45e",
                "sha256": "088be2740354f16d83ff1299bf4deee3447c796bea70cba2a5101c1b695dab69"
            },
            "downloads": -1,
            "filename": "volttron_lib_modbus_driver-0.2.1rc0.tar.gz",
            "has_sig": false,
            "md5_digest": "9f4381751ff14b9bb359fbe4ef44d45e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 14601,
            "upload_time": "2023-05-12T16:54:17",
            "upload_time_iso_8601": "2023-05-12T16:54:17.392479Z",
            "url": "https://files.pythonhosted.org/packages/37/7c/7e804892457048c5b524eae5dc139255a1d09322e9afee05470196f3297b/volttron_lib_modbus_driver-0.2.1rc0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 16:54:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VOLTTRON",
    "github_project": "volttron-lib-modbus-driver",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "volttron-lib-modbus-driver"
}
        
Elapsed time: 0.69351s