lora-modem-abz


Namelora-modem-abz JSON
Version 1.3.2 PyPI version JSON
download
home_pagehttps://github.com/hardwario/lora-modem-abz
SummaryPython library for the Murata TypeABZ LoRaWAN modem
upload_time2023-05-20 17:26:44
maintainer
docs_urlNone
authorJan Janak
requires_python
licenseBSD 3-Clause License
keywords iot lora lorawan lpwan lorawan-device firmware stm32
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python library for the Murata TypeABZ LoRa modem

This project provides a Python support library for working with the Murata TypeABZ LoRaWAN modem. The modem communicates with the host over an AT command interface. The Python library abstracts away the AT command interface and provides an easier to use high-level API. The library provides a Python module that can be embedded into a larger Python application and a command line tool called `lora` that can be used to manage the modem from the terminal. The Python module supports the original Murata Modem firmware shipped with some TypeABZ modules, as well as the open LoRaWAN firmware from the [lora-modem-abz](https://github.com/hardwario/lora-modem-abz) Github repository. The command line tool only works with the open firmware.

## Installation
You can install the library with pip from PyPI as follows:
```sh
pip install --upgrade lora-modem-abz
```
Alternatively, you can also install the library from the Github repository as follows:
```
git clone https://github.com/hardwario/lora-modem-abz
cd lora-modem-abz/python
pip install --editable .
```

## Usage from Python
The basic usage from a Python program looks as follows:
```python
from lora import TypeABZ, OpenLoRaModem, MurataModem

# Create an instance of the TypeABZ device
device = TypeABZ('/dev/ttyUSB0')

# Try to detect the serial port baud rate used by the device
baudrate = device.detect_baud_rate()
if baudrate is None:
    raise SystemExit('Could not detect modem baud rate')

# Open the serial port and connect to the TypeABZ device
device.open(baudrate)
try:
    # Create an API instance depending on the firmware
    # Use MurataModem instead if your module has the original firmware
    modem = OpenLoRaModem(device)

    # Show fimware version
    print(modem.version)

    # Send an unconfirmed uplink to the default port
    # The message must be a bytes value, not str
    modem.utx(b'ping')
finally:
    # Close the serial port
    device.close()
```
The class `TypeABZ` represents the physical modem device. The classes `OpenLoRaModem` and `MurataModem` then implement a particular version of the modem API. Tha class `OpenLoRaModem` has been designed for the open firmware from the [lora-modem-abz](https://github.com/hardwario/lora-modem-abz) Github. The class `MurataModem` has been designed for the original Murata Modem firmware pre-installed on some TypeABZ modules. Please refer to the documentation in `lora.py` for more information.

## Command Line Tool

*Note: The command line tool only works with the open modem firmware.*

The library provides a command line tool installed under the name `lora`. The tool can be used to interact with TypeABZ LoRaWAN modems from shell scripts and the terminal. To invoke the tool, pass the pathname to the modem's serial port either via the environment variable PORT, or via the command line option `-p`. Without any arguments, the tool displays information about the selected modem:
```
$ lora -p /dev/serial0
Device information for modem /dev/serial0:
+---------------------+-------------------------------------------------------------------+
| Port configuration  | 19200 8N1                                                         |
| Device model        | ABZ                                                               |
| Firmware version    | 1.1.1-43-gf86592d2 (modified) [LoRaMac-node 4.6.0-23-g50155c55]   |
| Data encoding       | binary                                                            |
| LoRaWAN version     | 1.1.1 / 1.0.4 (1.0.4 for ABP)                                     |
| Regional parameters | RP002-1.0.3                                                       |
| Supported regions   | AS923 AU915 CN470 CN779 EU433 EU868 IN865 KR920 RU864 US915       |
| Device EUI          | 323838377B308503                                                  |
+---------------------+-------------------------------------------------------------------+
Network activation information for modem /dev/serial0:
+------------------+------------------+
| Network type     | public           |
| Activation       | OTAA             |
| Network ID       | 00000013         |
| Join EUI         | 0101010101010101 |
| Protocol version | LoRaWAN 1.1.1    |
| Device address   | 260C56AC         |
+------------------+------------------+
Current state of modem /dev/serial0:
+---------------------------+-----------------------------------------------------------+
| Current region            | US915                                                     |
| LoRaWAN class             | A                                                         |
| Channel mask              | 00FF00000000000000000000                                  |
| Data rate                 | SF10_125                                                  |
| Maximum message size      | 11 B                                                      |
| RF power index            | 0                                                         |
| ADR enabled               | True                                                      |
| Duty cycling enabled      | False                                                     |
| Join duty cycling enabled | True                                                      |
| Maximum EIRP              | 32 dBm                                                    |
| Uplink frame counter      | 2                                                         |
| Downlink frame counter    | 0                                                         |
| Last downlink RSSI        | -105 dBm                                                  |
| Last downlink SNR         | -4 dB                                                     |
| RX1 window                | Delay: 5000 ms                                            |
| RX2 window                | Delay: 6000 ms, Frequency: 923.3 MHz, Data rate: SF12_500 |
| Join response windows     | RX1: 5000 ms, RX2: 6000 ms                                |
+---------------------------+-----------------------------------------------------------+
```
To see the full list of supported commands, run `lora --help`:
```
...
Commands:
  device   Show basic modem information.
  get      Retrieve modem setting(s).
  join     Perform a LoRaWAN OTAA Join.
  keygen   Generate new random LoRaWAN security keys.
  keys     Show current LoRaWAN security keys.
  link     Check the radio link.
  network  Show current network activation parameters.
  reboot   Restart the modem.
  reset    Reset the modem to factory defaults.
  set      Update modem setting.
  state    Show the current modem state.
  trx      Transmit and receive LoRaWAN messages.
```
Run `lora <command> --help` to see the built-in documentation for each command.

## License

The library is licensed under the terms of the Revised BSD License. See [LICENSE](https://github.com/hardwario/lora-modem-abz/blob/main/python/LICENSE) for full details.

Copyright (c) 2022 Jan Janak \<jan@janakj.org\>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hardwario/lora-modem-abz",
    "name": "lora-modem-abz",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "iot,lora,lorawan,lpwan,lorawan-device,firmware,stm32",
    "author": "Jan Janak",
    "author_email": "jan@janakj.org",
    "download_url": "https://files.pythonhosted.org/packages/4d/fe/0deb4ea4108ed473cb886bbe262c2ecd8bf7cbd9eee02d65cd3e75a1d262/lora-modem-abz-1.3.2.tar.gz",
    "platform": null,
    "description": "# Python library for the Murata TypeABZ LoRa modem\n\nThis project provides a Python support library for working with the Murata TypeABZ LoRaWAN modem. The modem communicates with the host over an AT command interface. The Python library abstracts away the AT command interface and provides an easier to use high-level API. The library provides a Python module that can be embedded into a larger Python application and a command line tool called `lora` that can be used to manage the modem from the terminal. The Python module supports the original Murata Modem firmware shipped with some TypeABZ modules, as well as the open LoRaWAN firmware from the [lora-modem-abz](https://github.com/hardwario/lora-modem-abz) Github repository. The command line tool only works with the open firmware.\n\n## Installation\nYou can install the library with pip from PyPI as follows:\n```sh\npip install --upgrade lora-modem-abz\n```\nAlternatively, you can also install the library from the Github repository as follows:\n```\ngit clone https://github.com/hardwario/lora-modem-abz\ncd lora-modem-abz/python\npip install --editable .\n```\n\n## Usage from Python\nThe basic usage from a Python program looks as follows:\n```python\nfrom lora import TypeABZ, OpenLoRaModem, MurataModem\n\n# Create an instance of the TypeABZ device\ndevice = TypeABZ('/dev/ttyUSB0')\n\n# Try to detect the serial port baud rate used by the device\nbaudrate = device.detect_baud_rate()\nif baudrate is None:\n    raise SystemExit('Could not detect modem baud rate')\n\n# Open the serial port and connect to the TypeABZ device\ndevice.open(baudrate)\ntry:\n    # Create an API instance depending on the firmware\n    # Use MurataModem instead if your module has the original firmware\n    modem = OpenLoRaModem(device)\n\n    # Show fimware version\n    print(modem.version)\n\n    # Send an unconfirmed uplink to the default port\n    # The message must be a bytes value, not str\n    modem.utx(b'ping')\nfinally:\n    # Close the serial port\n    device.close()\n```\nThe class `TypeABZ` represents the physical modem device. The classes `OpenLoRaModem` and `MurataModem` then implement a particular version of the modem API. Tha class `OpenLoRaModem` has been designed for the open firmware from the [lora-modem-abz](https://github.com/hardwario/lora-modem-abz) Github. The class `MurataModem` has been designed for the original Murata Modem firmware pre-installed on some TypeABZ modules. Please refer to the documentation in `lora.py` for more information.\n\n## Command Line Tool\n\n*Note: The command line tool only works with the open modem firmware.*\n\nThe library provides a command line tool installed under the name `lora`. The tool can be used to interact with TypeABZ LoRaWAN modems from shell scripts and the terminal. To invoke the tool, pass the pathname to the modem's serial port either via the environment variable PORT, or via the command line option `-p`. Without any arguments, the tool displays information about the selected modem:\n```\n$ lora -p /dev/serial0\nDevice information for modem /dev/serial0:\n+---------------------+-------------------------------------------------------------------+\n| Port configuration  | 19200 8N1                                                         |\n| Device model        | ABZ                                                               |\n| Firmware version    | 1.1.1-43-gf86592d2 (modified) [LoRaMac-node 4.6.0-23-g50155c55]   |\n| Data encoding       | binary                                                            |\n| LoRaWAN version     | 1.1.1 / 1.0.4 (1.0.4 for ABP)                                     |\n| Regional parameters | RP002-1.0.3                                                       |\n| Supported regions   | AS923 AU915 CN470 CN779 EU433 EU868 IN865 KR920 RU864 US915       |\n| Device EUI          | 323838377B308503                                                  |\n+---------------------+-------------------------------------------------------------------+\nNetwork activation information for modem /dev/serial0:\n+------------------+------------------+\n| Network type     | public           |\n| Activation       | OTAA             |\n| Network ID       | 00000013         |\n| Join EUI         | 0101010101010101 |\n| Protocol version | LoRaWAN 1.1.1    |\n| Device address   | 260C56AC         |\n+------------------+------------------+\nCurrent state of modem /dev/serial0:\n+---------------------------+-----------------------------------------------------------+\n| Current region            | US915                                                     |\n| LoRaWAN class             | A                                                         |\n| Channel mask              | 00FF00000000000000000000                                  |\n| Data rate                 | SF10_125                                                  |\n| Maximum message size      | 11 B                                                      |\n| RF power index            | 0                                                         |\n| ADR enabled               | True                                                      |\n| Duty cycling enabled      | False                                                     |\n| Join duty cycling enabled | True                                                      |\n| Maximum EIRP              | 32 dBm                                                    |\n| Uplink frame counter      | 2                                                         |\n| Downlink frame counter    | 0                                                         |\n| Last downlink RSSI        | -105 dBm                                                  |\n| Last downlink SNR         | -4 dB                                                     |\n| RX1 window                | Delay: 5000 ms                                            |\n| RX2 window                | Delay: 6000 ms, Frequency: 923.3 MHz, Data rate: SF12_500 |\n| Join response windows     | RX1: 5000 ms, RX2: 6000 ms                                |\n+---------------------------+-----------------------------------------------------------+\n```\nTo see the full list of supported commands, run `lora --help`:\n```\n...\nCommands:\n  device   Show basic modem information.\n  get      Retrieve modem setting(s).\n  join     Perform a LoRaWAN OTAA Join.\n  keygen   Generate new random LoRaWAN security keys.\n  keys     Show current LoRaWAN security keys.\n  link     Check the radio link.\n  network  Show current network activation parameters.\n  reboot   Restart the modem.\n  reset    Reset the modem to factory defaults.\n  set      Update modem setting.\n  state    Show the current modem state.\n  trx      Transmit and receive LoRaWAN messages.\n```\nRun `lora <command> --help` to see the built-in documentation for each command.\n\n## License\n\nThe library is licensed under the terms of the Revised BSD License. See [LICENSE](https://github.com/hardwario/lora-modem-abz/blob/main/python/LICENSE) for full details.\n\nCopyright (c) 2022 Jan Janak \\<jan@janakj.org\\>\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "Python library for the Murata TypeABZ LoRaWAN modem",
    "version": "1.3.2",
    "project_urls": {
        "Homepage": "https://github.com/hardwario/lora-modem-abz"
    },
    "split_keywords": [
        "iot",
        "lora",
        "lorawan",
        "lpwan",
        "lorawan-device",
        "firmware",
        "stm32"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bd523af6c00bfebc07f26414e2f84a10a8dcb6ba6add1a3d92bd0b7d112c846",
                "md5": "7dacd3f10412bad1264b701032f5cc2b",
                "sha256": "accebc81815acb656cd991cac3b045befab266af60804d62aeec8e0d4e958f6d"
            },
            "downloads": -1,
            "filename": "lora_modem_abz-1.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7dacd3f10412bad1264b701032f5cc2b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 48257,
            "upload_time": "2023-05-20T17:26:43",
            "upload_time_iso_8601": "2023-05-20T17:26:43.038554Z",
            "url": "https://files.pythonhosted.org/packages/0b/d5/23af6c00bfebc07f26414e2f84a10a8dcb6ba6add1a3d92bd0b7d112c846/lora_modem_abz-1.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4dfe0deb4ea4108ed473cb886bbe262c2ecd8bf7cbd9eee02d65cd3e75a1d262",
                "md5": "8e5d68cd390610bea1515f0c1bcb5f32",
                "sha256": "dbee751a31c5d074d353af2198a8dc88557bfe71b558ebf1ccefa650871e27af"
            },
            "downloads": -1,
            "filename": "lora-modem-abz-1.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8e5d68cd390610bea1515f0c1bcb5f32",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 49292,
            "upload_time": "2023-05-20T17:26:44",
            "upload_time_iso_8601": "2023-05-20T17:26:44.719747Z",
            "url": "https://files.pythonhosted.org/packages/4d/fe/0deb4ea4108ed473cb886bbe262c2ecd8bf7cbd9eee02d65cd3e75a1d262/lora-modem-abz-1.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-20 17:26:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hardwario",
    "github_project": "lora-modem-abz",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lora-modem-abz"
}
        
Elapsed time: 0.06915s