Add Device Models to Oracle IoT Cloud Service

You need to add device models before registering devices in Oracle IoT Cloud Service. To add device models, use the REST API, POST /iot/api/v2/deviceModels.

Parameters Description

Uniform Resource Name (URN)

A device model uses the URN as its unique ID.

Name

Specify a descriptive name for the device.

Description

Enter a device description.

Attributes

A device model’s attributes represent the basic variables that the device supports.

The following code snippet gives an example of a JSON message structure for adding device models:

{
   "urn":"urn:acao:codemax:box22",
   "name":"Codemax 1.1",
   "description":"This device model matches the Codemax specs v20160513 limited to temp, hygr, lux, noiseAvg and noiseMax. No feedback support yet.",
   "system":false,
   "attributes":[
      {
         "name":"temp",
         "description":"",
         "type":"NUMBER",
         "range":"0.0,50.0",
         "alias":"Temperature",
         "writable":false
      },
      {
         "name":"hygr",
         "description":"",
         "type":"NUMBER",
         "range":"5.0,85.0",
         "alias":"Hygrometry",
         "writable":false
      },
      {
         "name":"lux",
         "description":"",
         "type":"NUMBER",
         "range":"0.0,10000.0",
         "alias":"Luminosity",
         "writable":false
      },
      {
         "name":"noiseAvg",
         "description":"",
         "type":"NUMBER",
         "range":"0.0,100.0",
         "alias":"Noise_Avg",
         "writable":false
      },
      {
         "name":"noiseMax",
         "description":"",
         "type":"NUMBER",
         "range":"0.0,100.0",
         "alias":"Noise_Max",
         "writable":false
      }
   ],
   "actions":[

   ],
   "formats":[

   ]
}

Note:

The above JSON structure does not contain alerts for out of range values sent by devices. The structure ignores messages with incorrect values and does not send them to the Oracle IoT Cloud Service.

This table lists the fields required to specify an attribute within a device model:

Attributes Required Description

Name

Yes

Specify the name of the attribute.

Description

No

Enter a description.

Type

Yes

Specify the type of data represented by the attribute.

Range

No

Specify the minimum and maximum range.

writeable

No

By default, device model attributes cannot be modified from Oracle IoT Cloud Service.