Thing Description ABP Device
Example Thing Description
See Things documentation on how to manage Things in Altair IoT Studio.
A Thing for this device driver uses a schema as described on this page.
Once it exists in Studio it can be synced to the cluster (asset) as shown on the Sync Things page.
{ "@type": [ "swx:lorawan,devEUI=,deviceProfileID=" ], "id": "", "title": "LoRaWAN Test Device", "properties": { "myReadProperty": { "title": "My Read Property", "type": "number", "readOnly": true }, "myWriteProperty": { "title": "My Write Property", "type": "number", "@type": [ "swx:lorawan,f_port=1" ], "readOnly": false }, "enabled": { "title": "Enabled", "type": "boolean", "readOnly": false } }, "actions": { "getActivation": { "title": "Get activation", "description": "Get activation details for device" }, "activate": { "title": "Activate", "description": "Activate ABP device", "input": { "type": "object", "properties": { "dev_addr": { "type": "string" }, "app_s_key": { "type": "string" }, "nwk_s_key": { "type": "string" } } } }, "deactivate": { "title": "Deactivate", "description": "Deactivate ABP device" }, "listDeviceQueueItems": { "title": "List deviceQueue items", "description": "List deviceQueue items", "input": { "type": "object", "properties": { "countOnly": { "type": "boolean" } } } }, "flushDeviceQueue": { "title": "Flush deviceQueue", "description": "Flush deviceQueue" }, "enqueue": { "title": "Add item to deviceQueue", "description": "Add item to deviceQueue", "input": { "type": "object", "properties": { "f_port": { "type": "integer" }, "data": { "type": "string" }, "jsonObject": { "type": "string" } } } } }, "events": { "getActivation": { "title": "getActivation request is done", "description": "response of getActivation request", "data": { "type": "object" } }, "activate": { "title": "activate request is done", "description": "response of activate request", "data": { "type": "object" } }, "listDeviceQueueItems": { "title": "listDeviceQueueItems request is done", "description": "response of listDeviceQueueItems request", "data": { "type": "object" } }, "enqueue": { "title": "enqueue request is done", "description": "response of enqueue request", "data": { "type": "object" } } } }
The device profile has the flag to mark it as an ABP device.
Configuration Using the "@type"
"@type"
is used to set two required configuration parameters:devEUI
deviceProfileID
The devEUI
is a 64-bit globally-unique Extended Unique Identifier (EUI-64)
assigned by the manufacturer, or the owner, of the end-device. It should be set in the
"@type"
of the Thing.
The deviceProfileID
is the unique identifier for the device profile
specific for this device (class). Device profiles can be managed through the API. See the
appropriate help page.
There is an optional applicationID
parameter. If omitted it will use the
default generated application (highly recommended). However, applications can be managed
through the device driver API and the Thing description can be set to use a specific
application.
Available Actions
- activate
- An ABP device needs to have
DevAddr
,AppSKey
andNwkSKey
set in both the LoRa Server Stack and the device to allow join and activation. TheDevAddr
,AppSKey
andNwkSKey
can be set (create or update) using theactivate
Action. - deactivate
- The
deactivate
Action will deactivate the device. - getActivation
- The activation details can be retrieved using the
getActivation
Action. - enqueue
- Messages to be sent to the end-device can be added to the queue by running this action.
- listDeviceQueueItems
- This will list all outstanding, queued items.
- flushDeviceQueue
- This will flush (delete) all outstanding, queued items.
Writeable Property
LoRaWAN does not have the notion of writing/setting a property (or running an action, for that matter); it is only possible to enqueue a message that then need to be processed by the device.
There is already a (generic) action on the Thing description to enqueue a message. Apart
from the message body itself (either as binary data (i.e., base64 encoded), or as a JSON
object (only if the device profile has a codec set)) this requires an fPort
to be specified.
The device driver has "setProperty"
functionality using the "enqueue"
mechanism. Since this needs an fPort
, it is possible to specify the
fPort
in the "@type"
of the property itself. If not set,
a default value of 1 is used. It is up to the end device to use (validate/verify) the
fPort
value.
Example of property definition:
"thermostat": { "title": "Thermostat", "type": "number", "@type": [ "swx:lorawan,f_port=1" ], "readOnly": false },