committed by
Viacheslav Klimov
3 changed files with 44 additions and 2 deletions
@ -0,0 +1,20 @@ |
|||
// Encode downlink data from incoming Rule Engine message |
|||
|
|||
// msg - JSON message payload downlink message json |
|||
// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. |
|||
// metadata - list of key-value pairs with additional data about the message |
|||
// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter |
|||
|
|||
/** Encoder **/ |
|||
|
|||
// Publish the ThingsBoard message as JSON to the device command topic. |
|||
// metadata.topic is read by the integration when Downlink topic pattern is ${topic}. |
|||
var result = { |
|||
contentType: "JSON", |
|||
data: JSON.stringify(msg), |
|||
metadata: { |
|||
topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload' |
|||
} |
|||
}; |
|||
|
|||
return result; |
|||
@ -0,0 +1,20 @@ |
|||
// Encode downlink data from incoming Rule Engine message |
|||
|
|||
// msg - JSON message payload downlink message json |
|||
// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. |
|||
// metadata - list of key-value pairs with additional data about the message |
|||
// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter |
|||
|
|||
/** Encoder **/ |
|||
|
|||
// Publish the ThingsBoard message as JSON to the device command topic. |
|||
// metadata.topic is read by the integration when Downlink topic pattern is ${topic}. |
|||
var result = { |
|||
contentType: "JSON", |
|||
data: JSON.stringify(msg), |
|||
metadata: { |
|||
topic: metadata['deviceType'] + '/' + metadata['deviceName'] + '/upload' |
|||
} |
|||
}; |
|||
|
|||
return result; |
|||
Loading…
Reference in new issue