...
Note |
---|
The applicable and possible downlinks depend on the device and the firmware version. The described examples do not claim to be complete and are used at your own risk. |
Remote Configuration
IoT devices are often installed at places that are difficult to reach. If you need to change the settings of such a device it is often not easily possible to get physical access to attach a config adapter.
...
Changing configuration does nothing until you save the changes and reboot the device. The device has a safety feature that prevents configurations that make the device unusable. A new configuration is tested in the first run after rebooting. Only after the device reaches a stable state will the configuration be adopted and used permanently. If a problem occurs the device will restore its last stable connection and reboot. If the device uses OTAA (which we recommend) the device will only adopt the new configuration only after a join request is accepted, to make sure the LoRaWAN parameters are correct. After a few failed attempts it will restore the previous configuration. This can take up to about 10 minutes.
Downlink Messages (Port 128)
Responses are sent as uplinks on port 128 and 129-131 for long responses.
...
Note |
---|
Depending on the firmware version not all commands might be supported on all devices. Please reffer to the manual of your product for more details. |
Char | Command | Parameter | Hex | Comment |
---|---|---|---|---|
? | Request firmware and version | None | 3F | |
g | Get config parameter value | Name of parameter | 67 | |
r | Reset config parameter value | Name of parameter | 72 | |
s | Set config parameter value | <name>=<value> | 73 | |
S | Set config parameter value + Save and reboot | <name>=<value> | 53 | Not supported on all devices |
a | Append to config parameter value | <name>=<value> | 61 | |
b | Reboot device without saving | None | 62 | |
w | Save config and reboot device | None | 77 |
?
Request firmware and version. This command triggers the device to send what firmware it is running and in which version. This can be used to test if the remote configuration is working.
...
Warning | ||
---|---|---|
| ||
Do not use |
Example: changing configuration
The following is a short example of how you can update two configuration values remotely (that includes rebooting the device).
...
After sending the final command, the device will reboot and try the new configuration. If the boot process and the connection to the network are successful, the device will make the changes permanent. If there is a problem (if you accidentally set an invalid value, e.g. sADR=flase
or if you changed your AppKey
to wrong value and your OTAA fails), the device will revert to the previous configuration.
Downlinks on TTN
How you sent your downlinks depends on the LoRaWAN Network Server you use to connect your devices. You will most likely need to convert the commands (that are all ASCII) to some different representation, e.g. Hex or Base64.
...
You will have to encode the commands in hex. In the screenshot you see 73 54 69 6d 65 53 79 6e 63 3d 31 30
as the message to send; that is the hex representation of sTimeSync=10
. The Port used for remote configuration for our devices is 128. When you enter multiple messages to send, be sure to set the correct scheduling (last
). The preselected replace
will overwrite your previously enqueued messages.
Example 1: Getting the firmware version:
Example to do this over TTN Console:
On your TTN Console choose your Application and your Device, Messaging:
The downlink and response can be viewed in "live data":
The result of the converted HEX to ASCII is:
Example 2: Change Configuration Pressure and Temperature Sensor via Script:
Transform:
Code Block |
---|
SMbCmd=0 0/10 * * * *:R,9600,8N1:010300160002,010300260002,fa0400050001 |
...
Code Block |
---|
U01iQ21kPTAgMC8xMCAqICogKiAqOlIsOTYwMCw4TjE6MDEwMzAwMTYwMDAyLDAxMDMwMDI2MDAwMixmYTA0MDAwNTAwMDE= |
Example for TTN:
The downlink via a script via TTN would then look like this:
...
TTN Documentation scheduling-downlinks
Example for Chirpstack:
The downlink via a script via Chirpstack would then look like this:
...