Stand with Ukraine flag
Pricing Try it now
Community Edition
Getting Started Documentation Devices Library Guides Installation Architecture API FAQ

generator

Since TB Version 2.0

image

Generates Messages with configurable period. JavaScript function is used for message generation.

Node Configuration:

  • Message generation frequency in seconds
  • Message originator
  • JavaScript function that will generate the actual message.

JavaScript function receive 3 input parameters:

  • prevMsg - is a previously generated Message payload.
  • prevMetadata - is a previously generated Message metadata.
  • prevMsgType - is a previously generated Message type.

Script should return the following structure:

1
2
3
4
5
{   
msg: new payload,
metadata: new metadata,
msgType: new msgType
}

image

All fields in resulting object are optional and will be taken from previously generated Message if not specified.

Outbound Message from this Node will be new Message that was constructed using configured JavaScript function.

JavaScript generator function can be verified using Test JavaScript function.

This node can be used for Rule Chain debugging purposes.