Changes for page ThingsBoard

Last modified by Dilisi S on 2025/04/02 02:09

<
From version < 178.1 >
edited by Dilisi S
on 2025/03/27 01:16
To version < 179.1 >
edited by Dilisi S
on 2025/03/27 01:21
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -209,9 +209,26 @@
209 209  
210 210  Click on the **TBEL** button if it has not been selected by default.
211 211  
212 -The default TBEL function is shown below.
212 +Modify the default TBEL function to match with your device as described below:
213 213  
214 214  
215 +~1. Uncomment line 11:
216 +
217 +var data = decodeToJson(payload)
218 +
219 +[[image:Screenshot 2025-03-26 at 18.15.08.png||height="219" width="500"]]
220 +
221 +
222 +3. Modify the telemetry section to allow parsed data to be assigned to the fields.
223 +
224 +telemetry: {
225 + temperature: data.temperature,
226 + humidity: data.humidity,
227 + rawData: payloadStr
228 + }
229 +
230 +
231 +
215 215  {{code language="JavaScript"}}
216 216  // Decode an uplink message from a buffer
217 217  // payload - array of bytes
... ... @@ -223,9 +223,9 @@
223 223  var payloadStr = decodeToString(payload);
224 224  
225 225  // decode payload to JSON
226 -// var data = decodeToJson(payload);
243 +var data = decodeToJson(payload);
227 227  
228 -var deviceName = 'Device A';
245 +var deviceName = 'Device B';
229 229  var deviceType = 'thermostat';
230 230  var customerName = 'Customer C';
231 231  var groupName = 'thermostat devices';
... ... @@ -251,8 +251,8 @@
251 251   manufacturer: manufacturer
252 252   },
253 253   telemetry: {
254 - temperature: 42,
255 - humidity: 80,
271 + temperature: data.temperature,
272 + humidity: data.humidity,
256 256   rawData: payloadStr
257 257   }
258 258  };
Copyright ©2010-2024 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0