thingId

The optional "thingId" property associates a connector to a device or software application. 

  • In a request, the "thingName" and "thingId" properties are mutually exclusive.  
  • When a thing is assigned to a connector, both the "thingName" and "thingId" properties are included in a response.
  • Assigning a thing to each connector lets FairCom Edge track where collected values come from and are delivered.

See also "thingName".

Note a connector is created using the "createInput" or "createOutput" actions.

 

Example creating a thing, a tag, and an input that uses them

The following "createThing" action creates a thing named "PLC 74".

The response includes the "id" property, which uniquely identifies the thing. 

Assume this example returns 271 for the "id" property.

{
 "action": "createThing",
 "params": {
   "thingName": "PLC 74"
 },
 "authToken": "replaceWithAuthTokenFromCreateSession" 
}

The following "createTag" action creates a tag named "plc74_modbus_temperature" and maps it to the "celsius" property in the source_payload field and the "temperature_celsius" field in the "temperature" table.

{
 "api": "hub",
 "action": "createTag",
 "params": {
   "tagName": "plc74_modbus_temperature",
   "tableName": "temperature",
   "tagDataType": "number",

   "sourceFieldName": "temperature_celsius",
   "sourcePayloadPath": "celsius",

   "purpose": "Track Celsius Temperatures from devices"
 },
 "authToken": "replaceWithAuthTokenFromCreateSession"
}

The following "createInput" action creates an input connector that collects data from the thing id 271 and stores it in the temperature table. It also maps the data value from input register 2000 to the tag named "plc74_modbus_temperature", which defines where the data value is stored in the table. In this case, the tag stores the value in the "temperature_celsius" field and in the "celsius" property in the source_payload field.

{
 "action": "createInput",
 "params": {
   "inputName": "INPUT: PLC 74 & Modbus",
   "serviceName": "modbus",

   "thingId": 271,
   "tableName": "temperature",

   "settings": {
     "modbusProtocol": "TCP",
     "modbusServer": "127.0.0.1",
     "modbusServerPort": 502,
     "modbusDataCollectionIntervalMilliseconds": 15000,
     "propertyMapList": [
       {
         "tagName": "plc74_modbus_temperature",
         "modbusDataAddress": 2000,
         "modbusDataAccess": "inputRegister",
         "modbusUnitId": 5,
         "modbusDataLen": 1
       }
     ]
   }
 },
 "authToken": "replaceWithAuthTokenFromCreateSession"
}