Package: lora-mote-emulator
This is a useful tool to test LoRa server.To emulate end devices (a.k.a. Motes in LoRaWAN™ protocol)SupportLoRaWAN™1.0.2 & 1.1 protocolUsing Gateways fromSemtech™System RequirementsUbuntuPython(>=3.6, mandatory)InstalltionPYPIUsepipto installlora-mote-emulator:pip install lora-mote-emulatorMANUALLYUsepipto installpipenv:pip install pipenvClone this repo into a directory:git clone https://github.com/houluy/lora-mote-emulator.gitUsepipenvto create a virtual Python environment and install all the dependencies:pipenv installBuild the project:python -m buildHere, 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 fromsource. Otherwise, remove thePipfile.lockand redo the above command.Enter the virtual environment bypipenv shellRunmote-hto see the help messageUsageusage: 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.TutorialFirst, we need to create configuration files by commandmote create[-c./config]. Mote will generate required config template JSON files in the./configdirectory (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.OTAAModify device infomation indevice.jsoncopied. An example:{
    "Device": {
        "JoinEUI": "0000000000000000",
        "DevEUI": "0000000000000000"
    },
    "RootKeys": {
        "AppKey": "00000000000000000000000000000000",
        "NwkKey": "00000000000000000000000000000000"
    }
}NOTE: If you want to emulate LoRaWAN 1.0 device, first setJoinEUIequal toAppEUIand setNwkKeyequal toAppKey.ABPModify device activation information inabp.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 tomote pullto 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 withChirpStack:mote pull
mote join -n
mote app helloworld -f 0302
mote main.py mac 0302ContributionThis repo is hosted onhttps://github.com/houluy/lora-motes-emulatorand under MIT license, any contribution or suggestion is welcome. Just open an issue or send a pull request.