wirepas-dlms-tool


Namewirepas-dlms-tool JSON
Version 1.0rc1 PyPI version JSON
download
home_page
SummaryTool to validate the integration of Wirepas dlms app
upload_time2024-02-02 15:52:14
maintainer
docs_urlNone
authorWirepas Ltd
requires_python
licenseApache-2
keywords wirepas dlms hes testing meters
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Wirepas DLMS tool

This repository contains tools to validate the integration of Wirepas dlms app.


## Wirepas DLMS Tool library

The purpose of the [Wirepas DLMS Integration Tool Python library](./wirepas_dlms_tool/) is to provide tools to validate the DLMS app and the meter compatibility. It is not designed to be used as a HES.<br>
It works as an interface to both the Gurux Python library (to read DLMS/COSEM compatible meters) and the Wirepas MQTT library, and including the specifications of the DLMS app environment.


## Installation

### Install from PyPi

This package is available from [PyPi](https://pypi.org/project/wirepas-dlms-tool/).

```
pip install wirepas-dlms-tool
```

### Install from the source

This wheel can be install from source directly if you need modifications.

pip install -e .


## Main principles

The library contains modules to abstract the meters and their NIC in a Wirepas network in order to listen to their traffic and to exchange messages with them from a HES perspective.

In fact, the DLMSNetworkInterface class provides a network interface to communicate with the NIC through the NIC server or directly with the meters in pass-through inside a Wirepas network.
Especially, it redirects the messages from gateways to the corresponding meter objects representing the meters themselves with their NIC.
Futhermore, it also updates locally their network informations (gateway and sink ids) when receiving a message so that meters are always up-to-date.

When a DLMS message is received from an unknown node, the associated meter object is created automatically before redirecting its message.
Put together, it means that it is possible to wait for meters first messages to generate their related meter object.
However, in the case of a proactive communication (requesting the meter), it is still possible to reference the meters manually, as having to wait for a first message for their network information can take unecessary time if we already know their node id, gateway id, sink id.

When requesting a meter, the associated meter object request methods must be used. A response object containing the response error code, the meter response payload, the value that was queried and the xml representation of the response message is returned when the physical meter answers.


When a message is received from the physical meter, the message is either:
* An unencrypted NIC status word message asserting a sink route change or a provisioning request.
* An encrypted data notification.
* A response to a request.
* Something that couldn't be parsed for various reasons (wrong credentials, malformed DLMS packets, ...).

And, in both cases, the message is returned in a different function called by the associated meter object, in order to separate the use cases of the user.


## Examples

Example of an on-demand request to a meter:
```
# Use for connection to the MQTT.
wni = WirepasNetworkInterface(<mqtt informations>)

# Our network interface to communication with meters.
dni = DLMSNetworkInterface(wni)

# Creation of a meter object.
my_meter = dni.create_meter(node_id=12345678, meter_configuration=my_meter_configuration,
                            gateway="my_gw", sink="my_sink")

# Get meter response of a get device ID request in pass-through in US association.
response = my_meter.get_meter_device_ID(AssociationLevelEnum.US_ASSOCIATION)

# Verification of the correctness of the response with the error code.
assert response.error_code == ErrorCodeEnum.RES_OK

# We can print the response message as a xml string and also its device ID we requested.
print(response.xml)
print(f"The device ID of the meter is {response.value}")
```

Example of listening to unknown meters for its notifications:
```
# Function to be used when receiving a notification from meters.
def default_notification_cb(meter, notification):
    print(f"A notification has been received from {meter.node_id}:")
    print(notification.xml)

# Function to be used when a message could not be parsed.
def unparsed_cb(meter, payload: bytes):
    print(f"An unknown DLMS message has been received from {meter.node_id} "
          "in {meter.gateway_id}/{meter.sink_id}.")

# Use for connection to the MQTT.
wni = WirepasNetworkInterface(<mqtt informations>)

# Our network interface to communication with meters.
dni = DLMSNetworkInterface(wni, default_notification_cb=default_notification_cb,
                           default_unparsed_cb=unparsed_cb)

# Creation of a meter objects that handles the real meter messages.
dni.create_meter(node_id=12345678, meter_configuration=my_meter_configuration,
                 gateway="my_gw", sink="my_sink")
```


License
-------

Licensed under the Apache License, Version 2.0.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "wirepas-dlms-tool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Wirepas DLMS HES testing meters",
    "author": "Wirepas Ltd",
    "author_email": "opensource@wirepas.com",
    "download_url": "https://files.pythonhosted.org/packages/0e/b4/7b21f620264d407ab91619d5e1e474108f0721672fd924e91effbb98c411/wirepas_dlms_tool-1.0rc1.tar.gz",
    "platform": null,
    "description": "# Wirepas DLMS tool\n\nThis repository contains tools to validate the integration of Wirepas dlms app.\n\n\n## Wirepas DLMS Tool library\n\nThe purpose of the [Wirepas DLMS Integration Tool Python library](./wirepas_dlms_tool/) is to provide tools to validate the DLMS app and the meter compatibility. It is not designed to be used as a HES.<br>\nIt works as an interface to both the Gurux Python library (to read DLMS/COSEM compatible meters) and the Wirepas MQTT library, and including the specifications of the DLMS app environment.\n\n\n## Installation\n\n### Install from PyPi\n\nThis package is available from [PyPi](https://pypi.org/project/wirepas-dlms-tool/).\n\n```\npip install wirepas-dlms-tool\n```\n\n### Install from the source\n\nThis wheel can be install from source directly if you need modifications.\n\npip install -e .\n\n\n## Main principles\n\nThe library contains modules to abstract the meters and their NIC in a Wirepas network in order to listen to their traffic and to exchange messages with them from a HES perspective.\n\nIn fact, the DLMSNetworkInterface class provides a network interface to communicate with the NIC through the NIC server or directly with the meters in pass-through inside a Wirepas network.\nEspecially, it redirects the messages from gateways to the corresponding meter objects representing the meters themselves with their NIC.\nFuthermore, it also updates locally their network informations (gateway and sink ids) when receiving a message so that meters are always up-to-date.\n\nWhen a DLMS message is received from an unknown node, the associated meter object is created automatically before redirecting its message.\nPut together, it means that it is possible to wait for meters first messages to generate their related meter object.\nHowever, in the case of a proactive communication (requesting the meter), it is still possible to reference the meters manually, as having to wait for a first message for their network information can take unecessary time if we already know their node id, gateway id, sink id.\n\nWhen requesting a meter, the associated meter object request methods must be used. A response object containing the response error code, the meter response payload, the value that was queried and the xml representation of the response message is returned when the physical meter answers.\n\n\nWhen a message is received from the physical meter, the message is either:\n* An unencrypted NIC status word message asserting a sink route change or a provisioning request.\n* An encrypted data notification.\n* A response to a request.\n* Something that couldn't be parsed for various reasons (wrong credentials, malformed DLMS packets, ...).\n\nAnd, in both cases, the message is returned in a different function called by the associated meter object, in order to separate the use cases of the user.\n\n\n## Examples\n\nExample of an on-demand request to a meter:\n```\n# Use for connection to the MQTT.\nwni = WirepasNetworkInterface(<mqtt informations>)\n\n# Our network interface to communication with meters.\ndni = DLMSNetworkInterface(wni)\n\n# Creation of a meter object.\nmy_meter = dni.create_meter(node_id=12345678, meter_configuration=my_meter_configuration,\n                            gateway=\"my_gw\", sink=\"my_sink\")\n\n# Get meter response of a get device ID request in pass-through in US association.\nresponse = my_meter.get_meter_device_ID(AssociationLevelEnum.US_ASSOCIATION)\n\n# Verification of the correctness of the response with the error code.\nassert response.error_code == ErrorCodeEnum.RES_OK\n\n# We can print the response message as a xml string and also its device ID we requested.\nprint(response.xml)\nprint(f\"The device ID of the meter is {response.value}\")\n```\n\nExample of listening to unknown meters for its notifications:\n```\n# Function to be used when receiving a notification from meters.\ndef default_notification_cb(meter, notification):\n    print(f\"A notification has been received from {meter.node_id}:\")\n    print(notification.xml)\n\n# Function to be used when a message could not be parsed.\ndef unparsed_cb(meter, payload: bytes):\n    print(f\"An unknown DLMS message has been received from {meter.node_id} \"\n          \"in {meter.gateway_id}/{meter.sink_id}.\")\n\n# Use for connection to the MQTT.\nwni = WirepasNetworkInterface(<mqtt informations>)\n\n# Our network interface to communication with meters.\ndni = DLMSNetworkInterface(wni, default_notification_cb=default_notification_cb,\n                           default_unparsed_cb=unparsed_cb)\n\n# Creation of a meter objects that handles the real meter messages.\ndni.create_meter(node_id=12345678, meter_configuration=my_meter_configuration,\n                 gateway=\"my_gw\", sink=\"my_sink\")\n```\n\n\nLicense\n-------\n\nLicensed under the Apache License, Version 2.0.\n",
    "bugtrack_url": null,
    "license": "Apache-2",
    "summary": "Tool to validate the integration of Wirepas dlms app",
    "version": "1.0rc1",
    "project_urls": null,
    "split_keywords": [
        "wirepas",
        "dlms",
        "hes",
        "testing",
        "meters"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b3d8ceee8b35c099326cb58f340b68e3ec551c30af82cac65924526eac32ae9",
                "md5": "e9b7d657928abe30ae30724cc1d4be63",
                "sha256": "c81d146bc03b4e39f15255cf35be94b637a5014465cd4922e0a58498941cddfd"
            },
            "downloads": -1,
            "filename": "wirepas_dlms_tool-1.0rc1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e9b7d657928abe30ae30724cc1d4be63",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 35505,
            "upload_time": "2024-02-02T15:52:13",
            "upload_time_iso_8601": "2024-02-02T15:52:13.522189Z",
            "url": "https://files.pythonhosted.org/packages/4b/3d/8ceee8b35c099326cb58f340b68e3ec551c30af82cac65924526eac32ae9/wirepas_dlms_tool-1.0rc1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0eb47b21f620264d407ab91619d5e1e474108f0721672fd924e91effbb98c411",
                "md5": "229f4c8b707860e973ae9d2981a4e2bc",
                "sha256": "7bbb97e0595045a77470ca88b74c1d42c4e19f7fd13304791963df9d1174ac8f"
            },
            "downloads": -1,
            "filename": "wirepas_dlms_tool-1.0rc1.tar.gz",
            "has_sig": false,
            "md5_digest": "229f4c8b707860e973ae9d2981a4e2bc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 32376,
            "upload_time": "2024-02-02T15:52:14",
            "upload_time_iso_8601": "2024-02-02T15:52:14.479389Z",
            "url": "https://files.pythonhosted.org/packages/0e/b4/7b21f620264d407ab91619d5e1e474108f0721672fd924e91effbb98c411/wirepas_dlms_tool-1.0rc1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-02 15:52:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wirepas-dlms-tool"
}
        
Elapsed time: 0.18623s