2.1.0 • Published 1 year ago

@mschaeffler/node-red-init v2.1.0

Weekly downloads
-
License
LGPL-2.1
Repository
github
Last release
1 year ago

@mschaeffler/node-red-format

Node for initialisation of context storages.

The reason behind this node is: If you initialize a flow or global context variable in the startup code of a function node, it is possible, that other nodes already access the variable before the startup code is executed! So with this node, you do not get this race conditions.

At the start of a NodeRed flow, a flow or global contaxt variable can be initalized with a defined value, if is not already defined. With input messages it can also be set or reseted to the initalisation value.

image of nodes

Install

$ npm install @mschaeffler/node-red-init

init

initialises a flow or global context variable.

Input

If the msg property invalid is present in the message, the message is ignored.

If msg.reset is set or msg.topic==="init", the variable is set to the initialisation value.

Otherwise the variable is set to msg.payload.

Parameters

configtypedescription
Namestringname of the variable
Valuestr,num,bool,jsoninitialisation value
globalbooleanset in global context
forcebooleanset at every startup, even if variable is already set

Example Flow

example flow

Author

Mathias Schäffler

License

LGPL-2.1

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago