summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhasan.men <hasan.men@bosphorusiss.com>2020-11-17 17:22:07 +0300
committerKhem Raj <raj.khem@gmail.com>2020-11-17 15:04:43 -0800
commit4fb0fb993b482f13abd1294957afa03f421ebe74 (patch)
tree42a10b6a81918873d21b12e9a0e08f0f0b36f57b
parentc499aaeef80b5af8d20521658449c4148f3d0806 (diff)
downloadmeta-openembedded-4fb0fb993b482f13abd1294957afa03f421ebe74.tar.gz
thingsboard-gateway: Add recipe for v2.5.2
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/bacnet.json58
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/ble.json53
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/can.json89
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/custom_serial.json33
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/logs.conf77
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus.json169
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus_serial.json29
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/mqtt.json132
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/odbc.json54
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/opcua.json49
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/request.json146
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/rest.json152
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/snmp.json138
-rwxr-xr-xmeta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/tb_gateway.yaml66
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service13
-rw-r--r--meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_2.5.2.bb68
16 files changed, 1326 insertions, 0 deletions
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/bacnet.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/bacnet.json
new file mode 100644
index 0000000000..e36a2165d1
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/bacnet.json
@@ -0,0 +1,58 @@
1{
2 "general": {
3 "objectName": "TB_gateway",
4 "address": "192.168.188.181:1052",
5 "objectIdentifier": 599,
6 "maxApduLengthAccepted": 1024,
7 "segmentationSupported": "segmentedBoth",
8 "vendorIdentifier": 15
9 },
10 "devices": [
11 {
12 "deviceName": "BACnet Device ${objectName}",
13 "deviceType": "default",
14 "address": "192.168.188.181:10520",
15 "pollPeriod": 10000,
16 "attributes": [
17 {
18 "key": "temperature",
19 "type": "string",
20 "objectId": "analogOutput:1",
21 "propertyId": "presentValue"
22 }
23 ],
24 "timeseries": [
25 {
26 "key": "state",
27 "type": "bool",
28 "objectId": "binaryValue:1",
29 "propertyId": "presentValue"
30 }
31 ],
32 "attributeUpdates": [
33 {
34 "key": "brightness",
35 "requestType": "writeProperty",
36 "objectId": "analogOutput:1",
37 "propertyId": "presentValue"
38 }
39 ],
40 "serverSideRpc": [
41 {
42 "method": "set_state",
43 "requestType": "writeProperty",
44 "requestTimeout": 10000,
45 "objectId": "binaryOutput:1",
46 "propertyId": "presentValue"
47 },
48 {
49 "method": "get_state",
50 "requestType": "readProperty",
51 "requestTimeout": 10000,
52 "objectId": "binaryOutput:1",
53 "propertyId": "presentValue"
54 }
55 ]
56 }
57 ]
58 } \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/ble.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/ble.json
new file mode 100755
index 0000000000..2a5da3f41d
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/ble.json
@@ -0,0 +1,53 @@
1{
2 "name": "BLE Connector",
3 "rescanIntervalSeconds": 100,
4 "checkIntervalSeconds": 100,
5 "scanTimeSeconds": 5,
6 "passiveScanMode": true,
7 "devices": [
8 {
9 "name": "Temperature and humidity sensor",
10 "MACAddress": "4C:65:A8:DF:85:C0",
11 "addrType": "public",
12 "telemetry": [
13 {
14 "key": "temperature",
15 "method": "notify",
16 "characteristicUUID": "226CAA55-6476-4566-7562-66734470666D",
17 "byteFrom": 2,
18 "byteTo": 6
19 },
20 {
21 "key": "humidity",
22 "method": "notify",
23 "characteristicUUID": "226CAA55-6476-4566-7562-66734470666D",
24 "byteFrom": 9,
25 "byteTo": 13
26 }
27 ],
28 "attributes": [
29 {
30 "key": "name",
31 "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB",
32 "method": "read",
33 "byteFrom": 0,
34 "byteTo": -1
35 }
36 ],
37 "attributeUpdates": [
38 {
39 "attributeOnThingsBoard": "sharedName",
40 "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB"
41 }
42 ],
43 "serverSideRpc": [
44 {
45 "methodRPC": "rpcMethod1",
46 "withResponse": true,
47 "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB",
48 "methodProcessing": "read"
49 }
50 ]
51 }
52 ]
53} \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/can.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/can.json
new file mode 100644
index 0000000000..b5cec0045a
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/can.json
@@ -0,0 +1,89 @@
1{
2 "interface": "socketcan",
3 "channel": "vcan0",
4 "backend": {
5 "fd": true
6 },
7 "reconnectPeriod": 5,
8 "devices": [
9 {
10 "name": "Car",
11 "sendDataOnlyOnChange": false,
12 "enableUnknownRpc": true,
13 "strictEval": false,
14 "attributes": [
15 {
16 "key": "isDriverDoorOpened",
17 "nodeId": 41,
18 "command": "2:2:big:8717",
19 "value": "4:1:int",
20 "expression": "bool(value & 0b00000100)",
21 "polling": {
22 "type": "once",
23 "dataInHex": "AB CD AB CD"
24 }
25 }
26 ],
27 "timeseries": [
28 {
29 "key": "rpm",
30 "nodeId": 1918,
31 "isExtendedId": true,
32 "command": "2:2:big:48059",
33 "value": "4:2:big:int",
34 "expression": "value / 4",
35 "polling": {
36 "type": "always",
37 "period": 5,
38 "dataInHex": "aaaa bbbb aaaa bbbb"
39 }
40 },
41 {
42 "key": "milliage",
43 "nodeId": 1918,
44 "isExtendedId": true,
45 "value": "4:2:little:int",
46 "expression": "value * 10",
47 "polling": {
48 "type": "always",
49 "period": 30,
50 "dataInHex": "aa bb cc dd ee ff aa bb"
51 }
52 }
53 ],
54 "attributeUpdates": [
55 {
56 "attributeOnThingsBoard": "softwareVersion",
57 "nodeId": 64,
58 "isExtendedId": true,
59 "dataLength": 4,
60 "dataExpression": "value + 5",
61 "dataByteorder": "little"
62 }
63 ],
64 "serverSideRpc": [
65 {
66 "method": "sendSameData",
67 "nodeId": 4,
68 "isExtendedId": true,
69 "isFd": true,
70 "bitrateSwitch": true,
71 "dataInHex": "aa bb cc dd ee ff aa bb aa bb cc d ee ff"
72 },
73 {
74 "method": "setLightLevel",
75 "nodeId": 5,
76 "dataLength": 2,
77 "dataByteorder": "little",
78 "dataBefore": "00AA"
79 },
80 {
81 "method": "setSpeed",
82 "nodeId": 16,
83 "dataAfter": "0102",
84 "dataExpression": "userSpeed if maxAllowedSpeed > userSpeed else maxAllowedSpeed"
85 }
86 ]
87 }
88 ]
89 } \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/custom_serial.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/custom_serial.json
new file mode 100755
index 0000000000..0aee5cb765
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/custom_serial.json
@@ -0,0 +1,33 @@
1{
2 "name": "Custom serial connector",
3 "devices": [
4 {
5 "name": "CustomSerialDevice1",
6 "type": "default",
7 "port": "/dev/ttyUSB0",
8 "baudrate": 9600,
9 "converter": "CustomSerialUplinkConverter",
10 "telemetry": [
11 {
12 "type": "byte",
13 "key": "humidity",
14 "untilDelimiter": "\r"
15 }
16 ],
17 "attributes":[
18 {
19 "key": "SerialNumber",
20 "type": "string",
21 "fromByte": 4,
22 "toByte": -1
23 }
24 ],
25 "attributeUpdates": [
26 {
27 "attributeOnThingsBoard": "attr1",
28 "stringToDevice": "value = ${attr1}\n"
29 }
30 ]
31 }
32 ]
33} \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/logs.conf b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/logs.conf
new file mode 100755
index 0000000000..d66c2b84a8
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/logs.conf
@@ -0,0 +1,77 @@
1[loggers]
2keys=root, service, connector, converter, tb_connection, storage, extension
3[handlers]
4keys=consoleHandler, serviceHandler, connectorHandler, converterHandler, tb_connectionHandler, storageHandler, extensionHandler
5[formatters]
6keys=LogFormatter
7[logger_root]
8level=ERROR
9handlers=consoleHandler
10[logger_connector]
11level=INFO
12handlers=connectorHandler
13formatter=LogFormatter
14qualname=connector
15[logger_storage]
16level=INFO
17handlers=storageHandler
18formatter=LogFormatter
19qualname=storage
20[logger_tb_connection]
21level=INFO
22handlers=tb_connectionHandler
23formatter=LogFormatter
24qualname=tb_connection
25[logger_service]
26level=INFO
27handlers=serviceHandler
28formatter=LogFormatter
29qualname=service
30[logger_converter]
31level=INFO
32handlers=converterHandler
33formatter=LogFormatter
34qualname=converter
35[logger_extension]
36level=INFO
37handlers=connectorHandler
38formatter=LogFormatter
39qualname=extension
40[handler_consoleHandler]
41class=StreamHandler
42level=INFO
43formatter=LogFormatter
44args=(sys.stdout,)
45[handler_connectorHandler]
46level=INFO
47class=logging.handlers.TimedRotatingFileHandler
48formatter=LogFormatter
49args=("./logs/connector.log", "d", 1, 7,)
50[handler_storageHandler]
51level=INFO
52class=logging.handlers.TimedRotatingFileHandler
53formatter=LogFormatter
54args=("./logs/storage.log", "d", 1, 7,)
55[handler_serviceHandler]
56level=INFO
57class=logging.handlers.TimedRotatingFileHandler
58formatter=LogFormatter
59args=("./logs/service.log", "d", 1, 7,)
60[handler_converterHandler]
61level=INFO
62class=logging.handlers.TimedRotatingFileHandler
63formatter=LogFormatter
64args=("./logs/converter.log", "d", 1, 3,)
65[handler_extensionHandler]
66level=INFO
67class=logging.handlers.TimedRotatingFileHandler
68formatter=LogFormatter
69args=("./logs/extension.log", "d", 1, 3,)
70[handler_tb_connectionHandler]
71level=INFO
72class=logging.handlers.TimedRotatingFileHandler
73formatter=LogFormatter
74args=("./logs/tb_connection.log", "d", 1, 3,)
75[formatter_LogFormatter]
76format="%(asctime)s - %(levelname)s - [%(filename)s] - %(module)s - %(lineno)d - %(message)s"
77datefmt="%Y-%m-%d %H:%M:%S" \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus.json
new file mode 100755
index 0000000000..479d8aa4d0
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus.json
@@ -0,0 +1,169 @@
1{
2 "server": {
3 "type": "tcp",
4 "host": "127.0.0.1",
5 "port": 5020,
6 "timeout": 35,
7 "method": "socket",
8 "byteOrder": "BIG",
9 "devices": [
10 {
11 "unitId": 1,
12 "deviceName": "Temp Sensor",
13 "attributesPollPeriod": 5000,
14 "timeseriesPollPeriod": 5000,
15 "sendDataOnlyOnChange": true,
16 "attributes": [
17 {
18 "tag": "string_read",
19 "type": "string",
20 "functionCode": 4,
21 "objectsCount": 4,
22 "address": 1
23 },
24 {
25 "tag": "bits_read",
26 "type": "bits",
27 "functionCode": 4,
28 "objectsCount": 1,
29 "address": 5
30 },
31 {
32 "tag": "8int_read",
33 "type": "8int",
34 "functionCode": 4,
35 "objectsCount": 1,
36 "address": 6
37 },
38 {
39 "tag": "16int_read",
40 "type": "16int",
41 "functionCode": 4,
42 "objectsCount": 1,
43 "address": 7
44 },
45 {
46 "tag": "32int_read_divider",
47 "type": "32int",
48 "functionCode": 4,
49 "objectsCount": 2,
50 "address": 8,
51 "divider": 10
52 },
53 {
54 "tag": "8int_read_multiplier",
55 "type": "8int",
56 "functionCode": 4,
57 "objectsCount": 1,
58 "address": 10,
59 "multiplier": 10
60 },
61 {
62 "tag": "32int_read",
63 "type": "32int",
64 "functionCode": 4,
65 "objectsCount": 2,
66 "address": 11
67 },
68 {
69 "tag": "64int_read",
70 "type": "64int",
71 "functionCode": 4,
72 "objectsCount": 4,
73 "address": 13
74 }
75 ],
76 "timeseries": [
77 {
78 "tag": "8uint_read",
79 "type": "8uint",
80 "functionCode": 4,
81 "objectsCount": 1,
82 "address": 17
83 },
84 {
85 "tag": "16uint_read",
86 "type": "16uint",
87 "functionCode": 4,
88 "objectsCount": 2,
89 "address": 18
90 },
91 {
92 "tag": "32uint_read",
93 "type": "32uint",
94 "functionCode": 4,
95 "objectsCount": 4,
96 "address": 20
97 },
98 {
99 "tag": "64uint_read",
100 "type": "64uint",
101 "functionCode": 4,
102 "objectsCount": 1,
103 "address": 24
104 },
105 {
106 "tag": "16float_read",
107 "type": "16float",
108 "functionCode": 4,
109 "objectsCount": 1,
110 "address": 25
111 },
112 {
113 "tag": "32float_read",
114 "type": "32float",
115 "functionCode": 4,
116 "objectsCount": 2,
117 "address": 26
118 },
119 {
120 "tag": "64float_read",
121 "type": "64float",
122 "functionCode": 4,
123 "objectsCount": 4,
124 "address": 28
125 }
126 ],
127 "attributeUpdates": [
128 {
129 "tag": "shared_attribute_write",
130 "type": "32int",
131 "functionCode": 6,
132 "objectsCount": 2,
133 "address": 29
134 }
135 ],
136 "rpc": [
137 {
138 "tag": "setValue",
139 "type": "bits",
140 "functionCode": 5,
141 "objectsCount": 1,
142 "address": 31
143 },
144 {
145 "tag": "getValue",
146 "type": "bits",
147 "functionCode": 1,
148 "objectsCount": 1,
149 "address": 31
150 },
151 {
152 "tag": "setCPUFanSpeed",
153 "type": "32int",
154 "functionCode": 16,
155 "objectsCount": 2,
156 "address": 33
157 },
158 {
159 "tag":"getCPULoad",
160 "type": "32int",
161 "functionCode": 4,
162 "objectsCount": 2,
163 "address": 35
164 }
165 ]
166 }
167 ]
168 }
169}
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus_serial.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus_serial.json
new file mode 100755
index 0000000000..19b38e3f7b
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/modbus_serial.json
@@ -0,0 +1,29 @@
1{
2 "server": {
3 "name": "Modbus Default Server",
4 "type": "serial",
5 "method": "rtu",
6 "port": "/dev/ttyUSB0",
7 "baudrate": 19200,
8 "timeout": 35,
9 "devices": [
10 {
11 "unitId": 1,
12 "deviceName": "Temp Sensor",
13 "attributesPollPeriod": 5000,
14 "timeseriesPollPeriod": 5000,
15 "sendDataOnlyOnChange": true,
16 "attributes": [
17 {
18 "byteOrder": "BIG",
19 "tag": "test",
20 "type": "long",
21 "functionCode": 4,
22 "registerCount": 1,
23 "address": 4
24 }
25 ]
26 }
27 ]
28 }
29} \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/mqtt.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/mqtt.json
new file mode 100755
index 0000000000..6b78a7cec9
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/mqtt.json
@@ -0,0 +1,132 @@
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} \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/odbc.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/odbc.json
new file mode 100644
index 0000000000..c93992a262
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/odbc.json
@@ -0,0 +1,54 @@
1{
2 "connection": {
3 "str": "Driver={PostgreSQL};Server=localhost;Port=5432;Database=thingsboard;Uid=postgres;Pwd=postgres;",
4 "attributes": {
5 "autocommit": true,
6 "timeout": 0
7 },
8 "encoding": "utf-8",
9 "decoding": {
10 "char": "utf-8",
11 "wchar": "utf-8",
12 "metadata": "utf-16le"
13 },
14 "reconnect": true,
15 "reconnectPeriod": 60
16 },
17 "pyodbc": {
18 "pooling": false
19 },
20 "polling": {
21 "query": "SELECT bool_v, str_v, dbl_v, long_v, entity_id, ts FROM ts_kv WHERE ts > ? ORDER BY ts ASC LIMIT 10",
22 "period": 10,
23 "iterator": {
24 "column": "ts",
25 "query": "SELECT MIN(ts) - 1 FROM ts_kv",
26 "persistent": false
27 }
28 },
29 "mapping": {
30 "device": {
31 "type": "postgres",
32 "name": "'ODBC ' + entity_id"
33 },
34 "sendDataOnlyOnChange": false,
35 "attributes": "*",
36 "timeseries": [
37 {
38 "name": "value",
39 "value": "[i for i in [str_v, long_v, dbl_v,bool_v] if i is not None][0]"
40 }
41 ]
42 },
43 "serverSideRpc": {
44 "enableUnknownRpc": false,
45 "overrideRpcConfig": true,
46 "methods": [
47 "procedureOne",
48 {
49 "name": "procedureTwo",
50 "args": [ "One", 2, 3.0 ]
51 }
52 ]
53 }
54 } \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/opcua.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/opcua.json
new file mode 100755
index 0000000000..1deed7d524
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/opcua.json
@@ -0,0 +1,49 @@
1{
2 "server": {
3 "name": "OPC-UA Default Server",
4 "url": "localhost:4840/freeopcua/server/",
5 "timeoutInMillis": 5000,
6 "scanPeriodInMillis": 5000,
7 "disableSubscriptions":false,
8 "subCheckPeriodInMillis": 100,
9 "showMap": false,
10 "security": "Basic128Rsa15",
11 "identity": {
12 "type": "anonymous"
13 },
14 "mapping": [
15 {
16 "deviceNodePattern": "Root\\.Objects\\.Device1",
17 "deviceNamePattern": "Device ${Root\\.Objects\\.Device1\\.serialNumber}",
18 "attributes": [
19 {
20 "key": "temperature °C",
21 "path": "${ns=2;i=5}"
22 }
23 ],
24 "timeseries": [
25 {
26 "key": "humidity",
27 "path": "${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"
28 },
29 {
30 "key": "batteryLevel",
31 "path": "${Battery\\.batteryLevel}"
32 }
33 ],
34 "rpc_methods": [
35 {
36 "method": "multiply",
37 "arguments": [2, 4]
38 }
39 ],
40 "attributes_updates": [
41 {
42 "attributeOnThingsBoard": "deviceName",
43 "attributeOnDevice": "Root\\.Objects\\.Device1\\.serialNumber"
44 }
45 ]
46 }
47 ]
48 }
49} \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/request.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/request.json
new file mode 100644
index 0000000000..43237a7dc0
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/request.json
@@ -0,0 +1,146 @@
1"job": "leader"
2},
3"allowRedirects": true,
4"timeout": 0.5,
5"scanPeriod": 5,
6"converter": {
7 "type": "json",
8 "deviceNameJsonExpression": "SD8500",
9 "deviceTypeJsonExpression": "SD",
10 "attributes": [
11 {
12 "key": "serialNumber",
13 "type": "string",
14 "value": "${serial}"
15 }
16 ],
17 "telemetry": [
18 {
19 "key": "Maintainer",
20 "type": "string",
21 "value": "${Developer}"
22 }
23 ]
24}
25},
26{
27"url": "get_info",
28"httpMethod": "GET",
29"httpHeaders": {
30 "ACCEPT": "application/json"
31},
32"allowRedirects": true,
33"timeout": 0.5,
34"scanPeriod": 100,
35"converter": {
36 "type": "custom",
37 "deviceNameJsonExpression": "SD8500",
38 "deviceTypeJsonExpression": "SD",
39 "extension": "CustomRequestUplinkConverter",
40 "extension-config": [
41 {
42 "key": "Totaliser",
43 "type": "float",
44 "fromByte": 0,
45 "toByte": 4,
46 "byteorder": "big",
47 "signed": true,
48 "multiplier": 1
49 },
50 {
51 "key": "Flow",
52 "type": "int",
53 "fromByte": 4,
54 "toByte": 6,
55 "byteorder": "big",
56 "signed": true,
57 "multiplier": 0.01
58 },
59 {
60 "key": "Temperature",
61 "type": "int",
62 "fromByte": 8,
63 "toByte": 10,
64 "byteorder": "big",
65 "signed": true,
66 "multiplier": 0.01
67 },
68 {
69 "key": "Pressure",
70 "type": "int",
71 "fromByte": 12,
72 "toByte": 14,
73 "byteorder": "big",
74 "signed": true,
75 "multiplier": 0.01
76 },
77 {
78 "key": "deviceStatus",
79 "type": "int",
80 "byteAddress": 15,
81 "fromBit": 4,
82 "toBit": 8,
83 "byteorder": "big",
84 "signed": false
85 },
86 {
87 "key": "OUT2",
88 "type": "int",
89 "byteAddress": 15,
90 "fromBit": 1,
91 "toBit": 2,
92 "byteorder": "big"
93 },
94 {
95 "key": "OUT1",
96 "type": "int",
97 "byteAddress": 15,
98 "fromBit": 0,
99 "toBit": 1,
100 "byteorder": "big"
101 }
102 ]
103}
104}
105],
106"attributeUpdates": [
107{
108 "httpMethod": "POST",
109 "httpHeaders": {
110 "CONTENT-TYPE": "application/json"
111 },
112 "timeout": 0.5,
113 "tries": 3,
114 "allowRedirects": true,
115 "deviceNameFilter": "SD.*",
116 "attributeFilter": "send_data",
117 "requestUrlExpression": "sensor/${deviceName}/${attributeKey}",
118 "valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}"
119}
120],
121"serverSideRpc": [
122{
123"deviceNameFilter": ".*",
124"methodFilter": "echo",
125"requestUrlExpression": "sensor/${deviceName}/request/${methodName}/${requestId}",
126"responseTimeout": 1,
127"httpMethod": "GET",
128"valueExpression": "${params}",
129"timeout": 0.5,
130"tries": 3,
131"httpHeaders": {
132 "Content-Type": "application/json"
133}
134},
135{
136"deviceNameFilter": ".*",
137"methodFilter": "no-reply",
138"requestUrlExpression": "sensor/${deviceName}/request/${methodName}/${requestId}",
139"httpMethod": "POST",
140"valueExpression": "${params}",
141"httpHeaders": {
142 "Content-Type": "application/json"
143}
144}
145]
146} \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/rest.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/rest.json
new file mode 100644
index 0000000000..be6c6ff18e
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/rest.json
@@ -0,0 +1,152 @@
1{
2 "host": "127.0.0.1",
3 "port": "5000",
4 "mapping":[
5 {
6 "endpoint": "/device1",
7 "HTTPMethods": [
8 "POST"
9 ],
10 "security":
11 {
12 "type": "basic",
13 "username": "user",
14 "password": "passwd"
15 },
16 "converter": {
17 "type": "json",
18 "deviceNameExpression": "Device ${name}",
19 "deviceTypeExpression": "default",
20 "attributes": [
21 {
22 "type": "string",
23 "key": "model",
24 "value": "${sensorModel}"
25 }
26 ],
27 "timeseries": [
28 {
29 "type": "double",
30 "key": "${sensorModel}",
31 "value": "${temp}"
32 },
33 {
34 "type": "double",
35 "key": "humidity",
36 "value": "${hum}"
37 }
38 ]
39 }
40 },
41 {
42 "endpoint": "/anon1",
43 "HTTPMethods": [
44 "GET",
45 "POST"
46 ],
47 "security":
48 {
49 "type": "anonymous"
50 },
51 "converter": {
52 "type": "json",
53 "deviceNameExpression": "Device 2",
54 "deviceTypeExpression": "default",
55 "attributes": [
56 {
57 "type": "string",
58 "key": "model",
59 "value": "Model2"
60 }
61 ],
62 "timeseries": [
63 {
64 "type": "double",
65 "key": "temperature",
66 "value": "${temp}"
67 },
68 {
69 "type": "double",
70 "key": "humidity",
71 "value": "${hum}"
72 }
73 ]
74 }
75 },
76 {
77 "endpoint": "/anon2",
78 "HTTPMethods": [
79 "POST"
80 ],
81 "security":
82 {
83 "type": "anonymous"
84 },
85 "converter": {
86 "type": "custom",
87 "deviceNameExpression": "SuperAnonDevice",
88 "deviceTypeExpression": "default",
89 "extension": "CustomRestUplinkConverter",
90 "extension-config": [
91 {
92 "key": "Totaliser",
93 "datatype": "float",
94 "fromByte": 0,
95 "toByte": 4,
96 "byteorder": "big",
97 "signed": true,
98 "multiplier": 1
99 }]
100 }
101 }
102 ],
103 "attributeUpdates": [
104 {
105 "HTTPMethod": "POST",
106 "SSLVerify": false,
107 "httpHeaders": {
108 "CONTENT-TYPE": "application/json"
109 },
110 "security": {
111 "type": "basic",
112 "username": "user",
113 "password": "passwd"
114 },
115 "timeout": 0.5,
116 "tries": 3,
117 "allowRedirects": true,
118 "deviceNameFilter": ".*REST$",
119 "attributeFilter": "data",
120 "requestUrlExpression": "sensor/${deviceName}/${attributeKey}",
121 "valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}"
122 }
123 ],
124 "serverSideRpc": [
125 {
126 "deviceNameFilter": ".*",
127 "methodFilter": "echo",
128 "requestUrlExpression": "http://127.0.0.1:5001/${deviceName}",
129 "responseTimeout": 1,
130 "HTTPMethod": "GET",
131 "valueExpression": "${params}",
132 "timeout": 0.5,
133 "tries": 3,
134 "httpHeaders": {
135 "Content-Type": "application/json"
136 },
137 "security": {
138 "type": "anonymous"
139 }
140 },
141 {
142 "deviceNameFilter": ".*",
143 "methodFilter": "no-reply",
144 "requestUrlExpression": "sensor/${deviceName}/request/${methodName}/${requestId}",
145 "HTTPMethod": "POST",
146 "valueExpression": "${params}",
147 "httpHeaders": {
148 "Content-Type": "application/json"
149 }
150 }
151 ]
152 } \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/snmp.json b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/snmp.json
new file mode 100644
index 0000000000..b4ddb42645
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/snmp.json
@@ -0,0 +1,138 @@
1{
2 "devices": [
3 {
4 "deviceName": "SNMP router",
5 "deviceType": "snmp",
6 "ip": "snmp.live.gambitcommunications.com",
7 "port": 161,
8 "pollPeriod": 5000,
9 "community": "public",
10 "attributes": [
11 {
12 "key": "ReceivedFromGet",
13 "method": "get",
14 "oid": "1.3.6.1.2.1.1.1.0",
15 "timeout": 6
16 },
17 {
18 "key": "ReceivedFromMultiGet",
19 "method": "multiget",
20 "oid": [
21 "1.3.6.1.2.1.1.1.0",
22 "1.3.6.1.2.1.1.2.0"
23 ],
24 "timeout": 6
25 },
26 {
27 "key": "ReceivedFromGetNext",
28 "method": "getnext",
29 "oid": "1.3.6.1.2.1.1.1.0",
30 "timeout": 6
31 },
32 {
33 "key": "ReceivedFromMultiWalk",
34 "method": "multiwalk",
35 "oid": [
36 "1.3.6.1.2.1.1.1.0",
37 "1.3.6.0.1.2.1"
38 ]
39 },
40 {
41 "key": "ReceivedFromBulkWalk",
42 "method": "bulkwalk",
43 "oid": [
44 "1.3.6.1.2.1.1.1.0",
45 "1.3.6.1.2.1.1.2.0"
46 ]
47 },
48 {
49 "key": "ReceivedFromBulkGet",
50 "method": "bulkget",
51 "scalarOid": [
52 "1.3.6.1.2.1.1.1.0",
53 "1.3.6.1.2.1.1.2.0"
54 ],
55 "repeatingOid": [
56 "1.3.6.1.2.1.1.1.0",
57 "1.3.6.1.2.1.1.2.0"
58 ],
59 "maxListSize": 10
60 }
61 ],
62 "telemetry": [
63 {
64 "key": "ReceivedFromWalk",
65 "community": "private",
66 "method": "walk",
67 "oid": "1.3.6.1.2.1.1.1.0"
68 },
69 {
70 "key": "ReceivedFromTable",
71 "method": "table",
72 "oid": "1.3.6.1.2.1.1"
73 }
74 ],
75 "attributeUpdateRequests": [
76 {
77 "attributeFilter": "dataToSet",
78 "method": "set",
79 "oid": "1.3.6.1.2.1.1.1.0"
80 },
81 {
82 "attributeFilter": "dataToMultiSet",
83 "method": "multiset",
84 "mappings": {
85 "1.2.3": "10",
86 "2.3.4": "${attribute}"
87 }
88 }
89 ],
90 "serverSideRpcRequests": [
91 {
92 "requestFilter": "setData",
93 "method": "set",
94 "oid": "1.3.6.1.2.1.1.1.0"
95 },
96 {
97 "requestFilter": "multiSetData",
98 "method": "multiset"
99 },
100 {
101 "requestFilter": "getData",
102 "method": "get",
103 "oid": "1.3.6.1.2.1.1.1.0"
104 },
105 {
106 "requestFilter": "runBulkWalk",
107 "method": "bulkwalk",
108 "oid": [
109 "1.3.6.1.2.1.1.1.0",
110 "1.3.6.1.2.1.1.2.0"
111 ]
112 }
113 ]
114 },
115 {
116 "deviceName": "SNMP router",
117 "deviceType": "snmp",
118 "ip": "127.0.0.1",
119 "pollPeriod": 5000,
120 "community": "public",
121 "converter": "CustomSNMPConverter",
122 "attributes": [
123 {
124 "key": "ReceivedFromGetWithCustomConverter",
125 "method": "get",
126 "oid": "1.3.6.1.2.1.1.1.0"
127 }
128 ],
129 "telemetry": [
130 {
131 "key": "ReceivedFromTableWithCustomConverter",
132 "method": "table",
133 "oid": "1.3.6.1.2.1.1.1.0"
134 }
135 ]
136 }
137 ]
138 } \ No newline at end of file
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/tb_gateway.yaml b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/tb_gateway.yaml
new file mode 100755
index 0000000000..e3eb8f1fc7
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/tb_gateway.yaml
@@ -0,0 +1,66 @@
1thingsboard:
2 host: demo.thingsboard.io
3 port: 1883
4 remoteConfiguration: false
5 security:
6 accessToken: PUT_YOUR_GW_ACCESS_TOKEN_HERE
7storage:
8 type: memory
9 read_records_count: 100
10 max_records_count: 100000
11# type: file
12# data_folder_path: ./data/
13# max_file_count: 10
14# max_read_records_count: 10
15# max_records_per_file: 10000
16connectors:
17 -
18 name: MQTT Broker Connector
19 type: mqtt
20 configuration: mqtt.json
21
22# -
23# name: Modbus Connector
24# type: modbus
25# configuration: modbus.json
26#
27# -
28# name: Modbus Connector
29# type: modbus
30# configuration: modbus_serial.json
31#
32# -
33# name: OPC-UA Connector
34# type: opcua
35# configuration: opcua.json
36#
37# -
38# name: BLE Connector
39# type: ble
40# configuration: ble.json
41#
42# -
43# name: REQUEST Connector
44# type: request
45# configuration: request.json
46#
47# -
48# name: CAN Connector
49# type: can
50# configuration: can.json
51#
52# -
53# name: BACnet Connector
54# type: bacnet
55# configuration: bacnet.json
56#
57# -
58# name: ODBC Connector
59# type: odbc
60# configuration: odbc.json
61#
62# -
63# name: Custom Serial Connector
64# type: serial
65# configuration: custom_serial.json
66# class: CustomSerialConnector
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service
new file mode 100644
index 0000000000..5dd352a553
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service
@@ -0,0 +1,13 @@
1[Unit]
2Description = Systemd service for Thingsboard Gateway
3After = network.target
4
5[Service]
6ExecStart = /usr/bin/python3 /usr/bin/thingsboard-gateway
7ExecStop = /bin/kill -INT $MAINPID
8ExecReload = /bin/kill -TERM $MAINPID
9Restart = always
10Type = simple
11
12[Install]
13WantedBy=multi-user.target
diff --git a/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_2.5.2.bb b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_2.5.2.bb
new file mode 100644
index 0000000000..2f0ef16c80
--- /dev/null
+++ b/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_2.5.2.bb
@@ -0,0 +1,68 @@
1SUMMARY = "Open-source IoT platform for data collection, processing, visualization, and device management"
2DESCRIPTION = "\
3The Thingsboard IoT Gateway is an open-source solution that allows you \
4to integrate devices connected to legacy and third-party systems with Thingsboard."
5HOMEPAGE = "https://thingsboard.io/"
6
7LICENSE = "Apache-2.0"
8LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
9
10SRC_URI[md5sum] = "469c8b5cd1c16c20ef40f0a97a3a0fda"
11SRC_URI[sha256sum] = "b328f4e315c3541ac80a4931974a34a81afe4d1f382f48e8604669a55816c0d7"
12
13inherit pypi setuptools3
14
15PYPI_PACKAGE = "thingsboard-gateway"
16
17RDEPENDS_${PN} += " python3-jsonpath-rw \
18 python3-regex \
19 python3-paho-mqtt \
20 python3-pyyaml \
21 python3-simplejson \
22 python3-requests \
23 python3-pip \
24 python3-pyrsistent \
25"
26
27SRC_URI += "file://bacnet.json \
28 file://ble.json \
29 file://can.json \
30 file://custom_serial.json \
31 file://modbus.json \
32 file://modbus_serial.json \
33 file://mqtt.json \
34 file://opcua.json \
35 file://odbc.json \
36 file://request.json \
37 file://rest.json \
38 file://snmp.json \
39 file://tb_gateway.yaml \
40 file://logs.conf \
41 file://thingsboard-gateway.service \
42 "
43
44
45inherit systemd
46
47SYSTEMD_PACKAGES = "${PN}"
48SYSTEMD_SERVICE_${PN} = "thingsboard-gateway.service"
49
50FILES_${PN} += "/etc \
51 /lib \
52 /usr \
53"
54
55do_install_append(){
56
57 install -d ${D}${sysconfdir}/thingsboard-gateway/config
58
59 for file in $(find ${WORKDIR} -maxdepth 1 -type f -name *.json); do
60 install -m 0644 "$file" ${D}${sysconfdir}/thingsboard-gateway/config
61 done
62
63 install -m 0644 ${WORKDIR}/tb_gateway.yaml ${D}${sysconfdir}/thingsboard-gateway/config
64 install -m 0644 ${WORKDIR}/logs.conf ${D}${sysconfdir}/thingsboard-gateway/config
65
66 install -d ${D}${systemd_unitdir}/system/
67 install -m 0644 ${WORKDIR}/thingsboard-gateway.service ${D}${systemd_system_unitdir}/thingsboard-gateway.service
68} \ No newline at end of file