The optional "tagId" property assigns a tag to a value collected by a connector.
- The
"tagId"property goes in the"propertyMapList"object. - Using the tag's ID to specify a tag is a best practice for software.
- In a request,
"tagId","tagName", and"propertyPath"are mutually exclusive. - A response includes both the
"tagName"and"tagId"properties when a tag is assigned to a data value. - A response includes only
"propertyPath"property when a tag is not assigned to a data value. - It is a best practice to assign a tag to each collected value instead of the
"propertyPath"because it lets FairCom Edge track the value everywhere it is used. A tag also provides additional information about the collected value.
Note A connector is created using the
"createInput"or"createOutput"actions.
See also"tagName".
Example creating a tag and a thing an input connector that uses them
The following "createTag" action creates a tag named "plc74_modbus_temperature", which maps the tag to the "celsius" property in the source_payload field and the "temperature_celsius" field in the "temperature" table.
The response includes the "id" property, which uniquely identifies the tag.
Assume this example returns 23 for the "id" property.
{
"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 "createThing" action creates a thing named "plc74".
{
"action": "createThing",
"params": {
"name": "PLC 74"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}The following "createInput" action creates an input connector that collects data from the thing named "PLC 74" 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",
"thingName": "PLC 74",
"tableName": "temperature",
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"modbusDataCollectionIntervalMilliseconds": 15000,
"propertyMapList": [
{
"tagId": 23,
"modbusDataAddress": 2000,
"modbusDataAccess": "inputRegister",
"modbusUnitId": 5,
"modbusDataLen": 1
}
]
}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}