aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/rest.json
blob: be6c6ff18eccd7ca205f5ea53a1af892ddd65897 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{
    "host": "127.0.0.1",
    "port": "5000",
    "mapping":[
      {
        "endpoint": "/device1",
        "HTTPMethods": [
          "POST"
        ],
        "security":
        {
          "type": "basic",
          "username": "user",
          "password": "passwd"
        },
        "converter": {
          "type": "json",
          "deviceNameExpression": "Device ${name}",
          "deviceTypeExpression": "default",
          "attributes": [
            {
              "type": "string",
              "key": "model",
              "value": "${sensorModel}"
            }
          ],
          "timeseries": [
            {
              "type": "double",
              "key": "${sensorModel}",
              "value": "${temp}"
            },
            {
              "type": "double",
              "key": "humidity",
              "value": "${hum}"
            }
          ]
        }
      },
      {
        "endpoint": "/anon1",
        "HTTPMethods": [
          "GET",
          "POST"
        ],
        "security":
        {
          "type": "anonymous"
        },
        "converter": {
          "type": "json",
          "deviceNameExpression": "Device 2",
          "deviceTypeExpression": "default",
          "attributes": [
            {
              "type": "string",
              "key": "model",
              "value": "Model2"
            }
          ],
          "timeseries": [
            {
              "type": "double",
              "key": "temperature",
              "value": "${temp}"
            },
            {
              "type": "double",
              "key": "humidity",
              "value": "${hum}"
            }
          ]
        }
      },
      {
        "endpoint": "/anon2",
        "HTTPMethods": [
          "POST"
        ],
        "security":
        {
          "type": "anonymous"
        },
        "converter": {
          "type": "custom",
          "deviceNameExpression": "SuperAnonDevice",
          "deviceTypeExpression": "default",
          "extension": "CustomRestUplinkConverter",
          "extension-config": [
            {
            "key": "Totaliser",
            "datatype": "float",
            "fromByte": 0,
            "toByte": 4,
            "byteorder": "big",
            "signed": true,
            "multiplier": 1
            }]
        }
      }
    ],
    "attributeUpdates": [
        {
          "HTTPMethod": "POST",
          "SSLVerify": false,
          "httpHeaders": {
            "CONTENT-TYPE": "application/json"
          },
          "security": {
            "type": "basic",
            "username": "user",
            "password": "passwd"
          },
          "timeout": 0.5,
          "tries": 3,
          "allowRedirects": true,
          "deviceNameFilter": ".*REST$",
          "attributeFilter": "data",
          "requestUrlExpression": "sensor/${deviceName}/${attributeKey}",
          "valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}"
        }
    ],
    "serverSideRpc": [
      {
        "deviceNameFilter": ".*",
        "methodFilter": "echo",
        "requestUrlExpression": "http://127.0.0.1:5001/${deviceName}",
        "responseTimeout": 1,
        "HTTPMethod": "GET",
        "valueExpression": "${params}",
        "timeout": 0.5,
        "tries": 3,
        "httpHeaders": {
          "Content-Type": "application/json"
        },
        "security": {
          "type": "anonymous"
        }
      },
      {
        "deviceNameFilter": ".*",
        "methodFilter": "no-reply",
        "requestUrlExpression": "sensor/${deviceName}/request/${methodName}/${requestId}",
        "HTTPMethod": "POST",
        "valueExpression": "${params}",
        "httpHeaders": {
          "Content-Type": "application/json"
        }
      }
    ]
  }