-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1357 from samson0v/master
Updated MQTT connector (new config format)
- Loading branch information
Showing
19 changed files
with
870 additions
and
74 deletions.
There are no files selected for viewing
Empty file.
36 changes: 36 additions & 0 deletions
36
tests/unit/connectors/mqtt/data/attribute_requests/new_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"dataMapping": [], | ||
"requestsMapping": { | ||
"serverSideRpc": {}, | ||
"connectRequests": {}, | ||
"disconnectRequests": {}, | ||
"attributeRequests": [ | ||
{ | ||
"retain": false, | ||
"topicFilter": "v1/devices/me/attributes/request", | ||
"deviceInfo": { | ||
"deviceNameExpressionSource": "message", | ||
"deviceNameExpression": "${serialNumber}" | ||
}, | ||
"attributeNameExpressionSource": "message", | ||
"attributeNameExpression": "${versionAttribute}, ${pduAttribute}", | ||
"topicExpression": "devices/${deviceName}/attrs", | ||
"valueExpression": "${attributeKey}: ${attributeValue}" | ||
} | ||
], | ||
"attributeUpdates": {} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/unit/connectors/mqtt/data/attribute_requests/old_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"mapping": [], | ||
"attributeRequests": [ | ||
{ | ||
"retain": false, | ||
"topicFilter": "v1/devices/me/attributes/request", | ||
"deviceNameJsonExpression": "${serialNumber}", | ||
"attributeNameJsonExpression": "${versionAttribute}, ${pduAttribute}", | ||
"topicExpression": "devices/${deviceName}/attrs", | ||
"valueExpression": "${attributeKey}: ${attributeValue}" | ||
} | ||
] | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/unit/connectors/mqtt/data/attribute_updates/new_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"dataMapping": [], | ||
"requestsMapping": { | ||
"serverSideRpc": {}, | ||
"connectRequests": {}, | ||
"disconnectRequests": {}, | ||
"attributeRequests": {}, | ||
"attributeUpdates": [ | ||
{ | ||
"retain": true, | ||
"deviceNameFilter": ".*", | ||
"attributeFilter": "uploadFrequency", | ||
"topicExpression": "sensor/${deviceName}/${attributeKey}", | ||
"valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}" | ||
} | ||
] | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/unit/connectors/mqtt/data/attribute_updates/old_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"mapping": [], | ||
"attributeUpdates": [ | ||
{ | ||
"retain": true, | ||
"deviceNameFilter": ".*", | ||
"attributeFilter": "uploadFrequency", | ||
"topicExpression": "sensor/${deviceName}/${attributeKey}", | ||
"valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}" | ||
} | ||
] | ||
} |
38 changes: 38 additions & 0 deletions
38
tests/unit/connectors/mqtt/data/connect_requests/new_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"dataMapping": [], | ||
"requestsMapping": { | ||
"serverSideRpc": {}, | ||
"connectRequests": [ | ||
{ | ||
"topicFilter": "sensor/connect", | ||
"deviceInfo": { | ||
"deviceNameExpressionSource": "message", | ||
"deviceNameExpression": "${serialNumber}" | ||
} | ||
}, | ||
{ | ||
"topicFilter": "sensor/+/connect", | ||
"deviceInfo": { | ||
"deviceNameExpressionSource": "topic", | ||
"deviceNameExpression": "(?<=sensor/)(.*?)(?=/connect)" | ||
} | ||
} | ||
], | ||
"disconnectRequests": {}, | ||
"attributeRequests": {}, | ||
"attributeUpdates": {} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/unit/connectors/mqtt/data/connect_requests/old_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"mapping": [], | ||
"connectRequests": [ | ||
{ | ||
"topicFilter": "sensor/connect", | ||
"deviceNameJsonExpression": "${serialNumber}" | ||
}, | ||
{ | ||
"topicFilter": "sensor/+/connect", | ||
"deviceNameTopicExpression": "(?<=sensor/)(.*?)(?=/connect)" | ||
} | ||
] | ||
} |
38 changes: 38 additions & 0 deletions
38
tests/unit/connectors/mqtt/data/disconnect_requests/new_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"dataMapping": [], | ||
"requestsMapping": { | ||
"serverSideRpc": {}, | ||
"connectRequests": {}, | ||
"disconnectRequests": [ | ||
{ | ||
"topicFilter":"sensor/disconnect", | ||
"deviceInfo":{ | ||
"deviceNameExpressionSource":"message", | ||
"deviceNameExpression":"${serialNumber}" | ||
} | ||
}, | ||
{ | ||
"topicFilter":"sensor/+/disconnect", | ||
"deviceInfo":{ | ||
"deviceNameExpressionSource":"topic", | ||
"deviceNameExpression":"(?<=sensor/)(.*?)(?=/disconnect)" | ||
} | ||
} | ||
], | ||
"attributeRequests": {}, | ||
"attributeUpdates": {} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/unit/connectors/mqtt/data/disconnect_requests/old_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"broker": { | ||
"name": "Default Local Broker", | ||
"host": "127.0.0.1", | ||
"port": 1883, | ||
"clientId": "ThingsBoard_gateway", | ||
"version": 5, | ||
"maxMessageNumberPerWorker": 10, | ||
"maxNumberOfWorkers": 100, | ||
"sendDataOnlyOnChange": false, | ||
"security": { | ||
"type": "anonymous" | ||
} | ||
}, | ||
"mapping": [], | ||
"disconnectRequests": [ | ||
{ | ||
"topicFilter": "sensor/disconnect", | ||
"deviceNameJsonExpression": "${serialNumber}" | ||
}, | ||
{ | ||
"topicFilter": "sensor/+/disconnect", | ||
"deviceNameTopicExpression": "(?<=sensor/)(.*?)(?=/disconnect)" | ||
} | ||
] | ||
} |
Oops, something went wrong.