Shelly LoRa Add-On
Shelly LoRa add-on provides two way RF communication using LoRa radio protocol.
LoRa.SetConfig
to update the the component's configurationLoRa.GetConfig
to obtain the the component's configurationLoRa.GetStatus
to obtain the the component's statusLoRa.SendBytes
to send data over LoRA RF sendbytes
Methods
LoRa.SetConfig
Find more about the config properties in config section
LoRa.GetConfig
Find the response properties in config section
LoRa.GetStatus
Find the response properties in status section
LoRa.SendBytes
Find more about send data properties in sendbytes section
Configuration
LoRa add-on can be enabled or disabled by setting device.addon_type
parameter in Sys config. To enable Shelly LoRa Add-on, addon_type
must be set to "LoRa"
. When add-on is enabled, device must be restarted and all related API will be accessible. To disable Shelly LoRa Add-on, parameter device.addon_type
must be set to null
, after disable device must be restarted as well.
The configuration of the LoRa component shows the current settings of the LoRa add-on.
Properties:
Property | Type | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | ID of the LoRa component instance | ||||||||||||||
| number | Frequency in Hz, possible values:
| ||||||||||||||
| number | Bandwidth in kHz, for possible values see the table below | ||||||||||||||
| number | Data rate (or spreading factor), possible values: [7, 12] | ||||||||||||||
| number | Coding rate, possible values: [5, 8], corresponding to coding rates:[“4:5”, “4:8”] | ||||||||||||||
| number | Preamble length, possible values: [6, 65535] | ||||||||||||||
| number | Transmit power in dBm, possible values: [0, 14] | ||||||||||||||
| boolean | Enable/disable reception over RF( |
Possible bandwidth
values depend on RF region.
RF Region | EU |
---|---|
Bandwidth | 125 and 250 |
SetConfig:
GetConfig:
Status
The status of the LoRa add-on component contains the following properties:
Properties:
Property | Type | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | ID of the LoRa component instance | ||||||||||||||||||||||
| number | Number of bytes sent over LoRa RF channel | ||||||||||||||||||||||
| number | Number of bytes received over LoRa RF channel | ||||||||||||||||||||||
| number | Time in milliseconds of the transmission time in the last 60 minutes | ||||||||||||||||||||||
| number | Number of failed transmissions | ||||||||||||||||||||||
| string | Firmware version | ||||||||||||||||||||||
| object | Information about available updates(empty object, if no updates available). This information is automatically updated every 24 hours.
| ||||||||||||||||||||||
| object | Provides details of the active OTA update, if any. See the Note bellow
| ||||||||||||||||||||||
| array of strings | Informational flags if any. Currently the following flag is supported:
| ||||||||||||||||||||||
| array of strings | Error if any. Currently the following errors are supported:
|
Note:
Object update
is presented in the status only during active OTA update.
GetStatus: LoRa.GetStatus Example
Send
Sends data over LoRa RF.
Properties:
Property | Type | Description |
---|---|---|
| number | ID of the LoRa component instance |
| string | Data to be sent. (remark: data should be encoded in 'base64') |
Send: LoRa.SendBytes Example
Notifications
This notification is triggered when data is received over LoRa RF.
method
: "NotifyEvent"Property Type Description data
string
Received data (remark: encoded in 'base64')
rssi
number
RSSI of the received packet
snr
number
SNR (signal / noise ratio) of the received packet
tsu
number
LoRa add-on uptime in ms
Example Notification
Examples
Enable / Disable LoRa Add-on examples
Enable LoRa Add-on
- Sys.SetConfig HTTP GET Request
- Sys.SetConfig Curl Request
- Sys.SetConfig Mos Request
http://192.168.33.1/rpc/Sys.SetConfig?config={"device":{"addon_type":"LoRa"}}
curl -X POST -d '{"id":1,"method":"Sys.SetConfig","params":{"config":{"device":{"addon_type":"LoRa"}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Sys.SetConfig '{"config":{"device":{"addon_type":"LoRa"}}}'
Response
- Sys.SetConfig HTTP GET Response
- Sys.SetConfig Curl Response
- Sys.SetConfig Mos Response
{
"restart_required": true
}
{
"id": 1,
"src": "shelly1pmg3-dcda0ce0d36c",
"params": {
"restart_required": true
}
}
{
"restart_required": true
}
Disable LoRa Add-on
- Sys.SetConfig HTTP GET Request
- Sys.SetConfig Curl Request
- Sys.SetConfig Mos Request
http://192.168.33.1/rpc/Sys.SetConfig?config={"device":{"addon_type":null}}
curl -X POST -d '{"id":1,"method":"Sys.SetConfig","params":{"config":{"device":{"addon_type":null}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Sys.SetConfig '{"config":{"device":{"addon_type":null}}}'
Response
- Sys.SetConfig HTTP GET Response
- Sys.SetConfig Curl Response
- Sys.SetConfig Mos Response
{
"restart_required": true
}
{
"id": 1,
"src": "shelly1pmg3-dcda0ce0d36c",
"params": {
"restart_required": true
}
}
{
"restart_required": true
}
LoRa.SetConfig example
- LoRa.SetConfig HTTP GET Request
- LoRa.SetConfig Curl Request
- LoRa.SetConfig Mos Request
http://192.168.33.1/rpc/LoRa.SetConfig?id=100&config={"txp":12}
curl -X POST -d '{"id":1,"method":"LoRa.SetConfig","params":{"id":100,"config":{"txp":12}}}' http://${SHELLY}/rpc
mos --port ${PORT} call LoRa.SetConfig '{"id":100,"config":{"txp":12}}'
Response
- LoRa.SetConfig HTTP GET Response
- LoRa.SetConfig Curl Response
- LoRa.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shelly1pmg3-dcda0ce0d36c",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
LoRa.GetConfig example
- LoRa.GetConfig HTTP GET Request
- LoRa.GetConfig Curl Request
- LoRa.GetConfig Mos Request
http://192.168.33.1/rpc/LoRa.GetConfig?id=100
curl -X POST -d '{"id":1,"method":"LoRa.GetConfig","params":{"id":100}}' http://${SHELLY}/rpc
mos --port ${PORT} call LoRa.GetConfig '{"id":100}'
Response
- LoRa.GetConfig HTTP GET Response
- LoRa.GetConfig Curl Response
- LoRa.GetConfig Mos Response
{
"id": 100,
"freq": 865000000,
"bw": 12,
"dr": 5,
"plen": 8,
"txp": 14
}
{
"id": 1,
"src": "shelly1pmg3-dcda0ce0d36c",
"params": {
"id": 100,
"freq": 865000000,
"bw": 12,
"dr": 5,
"plen": 8,
"txp": 14
}
}
{
"id": 100,
"freq": 865000000,
"bw": 12,
"dr": 5,
"plen": 8,
"txp": 14
}
LoRa.GetStatus example
- LoRa.GetStatus HTTP GET Request
- LoRa.GetStatus Curl Request
- LoRa.GetStatus Mos Request
http://192.168.33.1/rpc/LoRa.GetStatus?id=100
curl -X POST -d '{"id":1,"method":"LoRa.GetStatus","params":{"id":100}}' http://${SHELLY}/rpc
mos --port ${PORT} call LoRa.GetStatus '{"id":100}'
Response
- LoRa.GetStatus HTTP GET Response
- LoRa.GetStatus Curl Response
- LoRa.GetStatus Mos Response
{
"id": 100,
"bytes_sent": 69280,
"bytes_recd": 44,
"air_time_hr_ms": 893342,
"send_fails": 0,
"fw_version": "1.11.1",
"available_updates": {
"stable": {
"version": "1.11.2"
}
},
"update": {
"progress": 95,
"state": "updating",
"ts": 1739763916.762901
},
"errors": [
"addon_update_required"
]
}
{
"id": 1,
"src": "shelly1pmg3-dcda0ce0d36c",
"params": {
"id": 100,
"bytes_sent": 69280,
"bytes_recd": 44,
"air_time_hr_ms": 893342,
"send_fails": 0,
"fw_version": "1.11.1",
"available_updates": {
"stable": {
"version": "1.11.2"
}
},
"update": {
"progress": 95,
"state": "updating",
"ts": 1739763916.762901
},
"errors": [
"addon_update_required"
]
}
}
{
"id": 100,
"bytes_sent": 69280,
"bytes_recd": 44,
"air_time_hr_ms": 893342,
"send_fails": 0,
"fw_version": "1.11.1",
"available_updates": {
"stable": {
"version": "1.11.2"
}
},
"update": {
"progress": 95,
"state": "updating",
"ts": 1739763916.762901
},
"errors": [
"addon_update_required"
]
}
LoRa.SendBytes example
- LoRa.SendBytes HTTP GET Request
- LoRa.SendBytes Curl Request
- LoRa.SendBytes Mos Request
http://192.168.33.1/rpc/LoRa.SendBytes?id=100&data="MDEyMzQ1Njc4OQ=="
curl -X POST -d '{"id":1,"method":"LoRa.SendBytes","params":{"id":100,"data":"MDEyMzQ1Njc4OQ=="}}' http://${SHELLY}/rpc
mos --port ${PORT} call LoRa.SendBytes '{"id":100,"data":"MDEyMzQ1Njc4OQ=="}'
Response
- LoRa.SendBytes HTTP GET Response
- LoRa.SendBytes Curl Response
- LoRa.SendBytes Mos Response
null
{
"id": 1,
"src": "shelly1pmg3-dcda0ce0d36c",
"params": null
}
null
Notifications example
When data is received over LoRa RF:
{
"src": "shelly1pmg3-dcda0ce0d36c",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266595.43,
"events": [
{
"component": "lora:100",
"id": 100,
"event": "lora",
"ts": 1631266595.43,
"info": {
"data": "MDEyMzQ1Njc4OQ==",
"rssi": -70,
"snr": 8,
"tsu": 16212139809
}
],
}
]
}
}