Skip to main content

version python license

This is a useful tool to test LoRa server.

To emulate end devices (a.k.a. Motes in LoRaWAN™ protocol)

Support LoRaWAN™ 1.0.2 & 1.1 protocol

Using Gateways from Semtech™

System Requirements

  • Ubuntu

  • Python(>=3.6, mandatory)

Installtion

PYPI

  • Use pip to install lora-mote-emulator:

    pip install lora-mote-emulator

MANUALLY

  • Use pip to install pipenv:

    pip install pipenv
  • Clone this repo into a directory:

    git clone https://github.com/houluy/lora-mote-emulator.git
  • Use pipenv to create a virtual Python environment and install all the dependencies:

    pipenv install
  • Build the project:

    python -m build

Here, if there is not Python 3.6 in your system, a warning will occur, and no package will be installed. It is perfect to install Python 3.6 from source. Otherwise, remove the Pipfile.lock and redo the above command.

  • Enter the virtual environment by pipenv shell

  • Run mote -h to see the help message

Usage

usage: mote [-h] [-v version] [-c CONFIG] [--model MODEL]
                        {join,app,pull,mac,rejoin,info,abp,create} ...

Tool to emulate LoRa mote (a.k.a end-device) and Gateway, supported command
list: ['join', 'app', 'pull', 'mac', 'rejoin', 'info', 'abp', 'create']

optional arguments:
  -h, --help            show this help message and exit
  -v version, --version version
                                                Choose LoRaWAN version, 1.0.2 or 1.1(default)
  -c CONFIG, --config CONFIG
                                                Specify the directory of config files, default
                                                './config'
  --model MODEL         Specify the directory to save the model file, default
                                                './models'

Supported commands:
  {join,app,pull,mac,rejoin,info,abp,create}
        join                Send join request.
        app                 Send application data.
        pull                Send PULL_DATA.
        mac                 Send MACCommand.
        rejoin              Send rejoin request.
        info                Show information of current mote.
        abp                 Initialize mote in ABP mode.
        create              Handle configurations.

Tutorial

  • First, we need to create configuration files by command mote create [-c ./config]. Mote will generate required config template JSON files in the ./config directory (default). In the directory, several JSON config files are included.

  • config.json: Basic configurations.

  • gateway.json: Gateway EUI.

  • device.json: Device parameters for OTAA mode.

  • abp.json: Device parameters for ABP mode.

OTAA

  • Modify device infomation in device.json copied. An example:

    {
        "Device": {
            "JoinEUI": "0000000000000000",
            "DevEUI": "0000000000000000"
        },
        "RootKeys": {
            "AppKey": "00000000000000000000000000000000",
            "NwkKey": "00000000000000000000000000000000"
        }
    }

NOTE: If you want to emulate LoRaWAN 1.0 device, first set JoinEUI equal to AppEUI and set NwkKey equal to AppKey.

ABP

  • Modify device activation information in abp.json. An example:

    {
        "deveui": "0000000000000000",
        "joineui": "0000000000000000",
        "devaddr": "00000000",
        "appkey": "00000000000000000000000000000000",
        "nwkkey": "00000000000000000000000000000000",
        "nwksenckey": "00000000000000000000000000000000",
        "snwksintkey": "00000000000000000000000000000000",
        "fnwksintkey": "00000000000000000000000000000000",
        "appskey": "00000000000000000000000000000000",
        "fcntup": 0,
        "version": "1.1"
    }
  • Currently, five kinds of message is supported: pull data, join request, rejoin request, confirmed (or unconfirmed) data up (with or without FOpts) and MAC Commands in FRMPayload field:

NOTE: Always remember to mote pull to keep the gateway alive in server.

mote info
mote pull
mote abp
mote join [-n]
mote rejoin 'rejointyp' (0, 1, 2)
mote app 'message' (uplink message, will be encoded by UTF-8) [-auf]
mote mac 'command' (MAC Commands in FRMPayload field)

Here is the example step of interaction with ChirpStack:

mote pull
mote join -n
mote app helloworld -f 0302
mote main.py mac 0302

Contribution

This repo is hosted on https://github.com/houluy/lora-motes-emulator and under MIT license, any contribution or suggestion is welcome. Just open an issue or send a pull request.

Metadata

Release files for lora-mote-emulator 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lora-mote-emulator 1.1.0
File Size Uploaded
lora-mote-emulator-1.1.0.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lora-mote-emulator 1.1.0
File Interpreter ABI Platform
lora_mote_emulator-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.0 kB

Release files / lora-mote-emulator-1.1.0.tar.gz

Download URL lora-mote-emulator-1.1.0.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ae5c1a1d76e5e9477c6849c0a5568c44ddab92f964b11c749e7ba1bf12e61725
BLAKE2b-256 checksum
How to use checksums
756dbdc771ccdae99af959ee5926e2589bcf9a420bdb14b86fd5c8d9ddce78df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

Release files / lora_mote_emulator-1.1.0-py3-none-any.whl

Download URL lora_mote_emulator-1.1.0-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e03f3c11373a5af33c3b144d992be71823edadb552de1c474d756e3ad7513907
BLAKE2b-256 checksum
How to use checksums
8c572c9a2aba2462540666675f8da58a1b3023caf6e4e75edc421e42071af386
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page