Gateway TLG8411V1 User Manual V1.0.0
42
July 2020
At first, dragging
inject
,
function
,
debug
and
lora
(from output) to
Flow 1
and connecting
these nodes as Figure 4-9. Then, a dialog, Figure 4-10, pops up by double-clicking
inject
node. Choose string type and fill string in
Payload
field.
Figure 4-10 Edit Inject Node
Next step is double-clicking
function
node and input following JavaScript code in the node,
as shown in Figure 4-11. Then, deploy this flow and clicking left part of
inject
node triggers a
packet sent out each time.
var send_string = new Buffer(msg.payload).toString('Base64');
var send_json = '{' +
'"imme":true, ' +
'"freq": 915.5, ' +
'"rfch": 0, ' +
'"powe": 14, ' +
'"modu": "LORA", ' +
'"datr": "SF11BW125", ' +
'"codr": "4/6", ' +
'"ipol": false, ' +
'"size": ' + msg.payload. ', ' +
'"data": "' + send_ '"' +
'}';
msg.payload = send_json;
return msg;