Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame^] | 1 | { |
| 2 | "broker": { |
| 3 | "name":"Default Local Broker", |
| 4 | "host":"127.0.0.1", |
| 5 | "port":1883, |
| 6 | "clientId": "ThingsBoard_gateway", |
| 7 | "security": { |
| 8 | "type": "basic", |
| 9 | "username": "user", |
| 10 | "password": "password" |
| 11 | } |
| 12 | }, |
| 13 | "mapping": [ |
| 14 | { |
| 15 | "topicFilter": "/sensor/data", |
| 16 | "converter": { |
| 17 | "type": "json", |
| 18 | "deviceNameJsonExpression": "${serialNumber}", |
| 19 | "deviceTypeJsonExpression": "${sensorType}", |
| 20 | "timeout": 60000, |
| 21 | "attributes": [ |
| 22 | { |
| 23 | "type": "string", |
| 24 | "key": "model", |
| 25 | "value": "${sensorModel}" |
| 26 | }, |
| 27 | { |
| 28 | "type": "string", |
| 29 | "key": "${sensorModel}", |
| 30 | "value": "on" |
| 31 | } |
| 32 | ], |
| 33 | "timeseries": [ |
| 34 | { |
| 35 | "type": "double", |
| 36 | "key": "temperature", |
| 37 | "value": "${temp}" |
| 38 | }, |
| 39 | { |
| 40 | "type": "double", |
| 41 | "key": "humidity", |
| 42 | "value": "${hum}" |
| 43 | } |
| 44 | ] |
| 45 | } |
| 46 | }, |
| 47 | { |
| 48 | "topicFilter": "/sensor/+/data", |
| 49 | "converter": { |
| 50 | "type": "json", |
| 51 | "deviceNameTopicExpression": "(?<=sensor\/)(.*?)(?=\/data)", |
| 52 | "deviceTypeTopicExpression": "Thermometer", |
| 53 | "timeout": 60000, |
| 54 | "attributes": [ |
| 55 | { |
| 56 | "type": "string", |
| 57 | "key": "model", |
| 58 | "value": "${sensorModel}" |
| 59 | } |
| 60 | ], |
| 61 | "timeseries": [ |
| 62 | { |
| 63 | "type": "double", |
| 64 | "key": "temperature", |
| 65 | "value": "${temp}" |
| 66 | }, |
| 67 | { |
| 68 | "type": "double", |
| 69 | "key": "humidity", |
| 70 | "value": "${hum}" |
| 71 | } |
| 72 | ] |
| 73 | } |
| 74 | }, |
| 75 | { |
| 76 | "topicFilter": "/custom/sensors/+", |
| 77 | "converter": { |
| 78 | "type": "custom", |
| 79 | "extension": "CustomMqttUplinkConverter", |
| 80 | "extension-config": { |
| 81 | "temperatureBytes" : 2, |
| 82 | "humidityBytes" : 2, |
| 83 | "batteryLevelBytes" : 1 |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | ], |
| 88 | "connectRequests": [ |
| 89 | { |
| 90 | "topicFilter": "sensor/connect", |
| 91 | "deviceNameJsonExpression": "${SerialNumber}" |
| 92 | }, |
| 93 | { |
| 94 | "topicFilter": "sensor/+/connect", |
| 95 | "deviceNameTopicExpression": "(?<=sensor\/)(.*?)(?=\/connect)" |
| 96 | } |
| 97 | ], |
| 98 | "disconnectRequests": [ |
| 99 | { |
| 100 | "topicFilter": "sensor/disconnect", |
| 101 | "deviceNameJsonExpression": "${SerialNumber}" |
| 102 | }, |
| 103 | { |
| 104 | "topicFilter": "sensor/+/disconnect", |
| 105 | "deviceNameTopicExpression": "(?<=sensor\/)(.*?)(?=\/disconnect)" |
| 106 | } |
| 107 | ], |
| 108 | "attributeUpdates": [ |
| 109 | { |
| 110 | "deviceNameFilter": "SmartMeter.*", |
| 111 | "attributeFilter": "uploadFrequency", |
| 112 | "topicExpression": "sensor/${deviceName}/${attributeKey}", |
| 113 | "valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}" |
| 114 | } |
| 115 | ], |
| 116 | "serverSideRpc": [ |
| 117 | { |
| 118 | "deviceNameFilter": ".*", |
| 119 | "methodFilter": "echo", |
| 120 | "requestTopicExpression": "sensor/${deviceName}/request/${methodName}/${requestId}", |
| 121 | "responseTopicExpression": "sensor/${deviceName}/response/${methodName}/${requestId}", |
| 122 | "responseTimeout": 10000, |
| 123 | "valueExpression": "${params}" |
| 124 | }, |
| 125 | { |
| 126 | "deviceNameFilter": ".*", |
| 127 | "methodFilter": "no-reply", |
| 128 | "requestTopicExpression": "sensor/${deviceName}/request/${methodName}/${requestId}", |
| 129 | "valueExpression": "${params}" |
| 130 | } |
| 131 | ] |
| 132 | } |