1.1.8 • Published 8 days ago

node-red-contrib-boolean-logic-ultimate v1.1.8

Weekly downloads
408
License
MIT
Repository
github
Last release
8 days ago

node-red-contrib-boolean-logic-ultimate

Sample Node

NPM version NPM downloads per month NPM downloads total MIT License JavaScript Style Guide Donate via PayPal youtube

A set of Node-RED enhanced boolean logic and utility nodes, with persistent values after reboot. Compatible also with Homeassistant values.

CHANGELOG

  • See here the changelog

HOME ASSISTANT COMPATIBLES INPUT VALUES

Other than true/false, all nodes accepts Homeassistant output strings.
You can even add your own input translation word list, thanks to the translator-config node.

BOOLEAN LOGIC

The node performs Boolean logic on the incoming payloads. The node expects a fixed number of topics (configured in the settings) on which it will operate. It will only output a value when it has seen the expected number of topics. If it ever sees more than the configured number of topics it will log a message then reset its state and start over. The input message is preserved and passed to the output, changing only the topic and the payload.

The node performs some checks on the incoming boolean payloads and outputs all results at the same time, as follow:

  • Output "AND": true or false
  • Output "OR": true or false
  • Output "XOR": true or false

If you need "NAND" or "NOR" gate, just put an InvertUltimate node respectively after the "AND" or "OR" output.

The node can have a persistent input: the input values are retained after a node-red reboot. That means, that if you reboot your node-red, you don't need to wait all inputs to arrive and initialize the node, before the node can output a payload. You can also set the default values of the topic inputs. The node can convert arbitrary input values to true/false. It supports Homeassistant string to boolean conversion as well. For enabling auto conversion, please be sure to disable Reject non boolean (true/false) input values

NODE CONFIGURATION

PropertyDescription
Inputs countSet the number of different topics to be evaluated. The node will output a message to the flow, after this number of different topics arrives. Remember: each input topic must be different. For example, if you set this field to 3, the node expects 3 different topics.
EvaluateIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"
Filter outputOutput both 'true' and 'false' results: Standard behaviour, the node will output true and false whenever it receives an input and calculate the boolean logics as output. Output only 'true' results: whenever the node receives an input, it outputs a payload true only if the result of the logic is true. False results are filtered out.
Trigger modeAll topics: standard behaviour, the node will evaluate each input topic and ouputs the values. At each input change, it will output a msg on the flow. Single topic + eval other inputs: the node evaluates all the input topics, but only whenever it receives a msg input with the specified topic, it outputs a msg to the flow.
If input states are undefinedEvery time you create a node or modify the node, all inputs are set to undefined. This means that the node will wait the arrive of all topics (for example 3 topics, if you've selected 3 topics in the option), before it can output a payload. This can be a problem if your logic must be operative as soon as you deploy the flow. To overcome this problem, you can "initialize" all the undefined inputs with True or False. Leave undefined: Standard behaviour, the node will wait all the "undefined" topics to arrive, then starts a flow with the result. True or False: The node is immediately operative, by force the initialization of the "undefined" inputs with "true" or "false".
Remember latest input values after rebootIf checked, the input values are retained after a node-red reboot. That means, that if you reboot your node-red, you don't need to wait all inputs to arrive and initialize the node, before the node can output a payload. Every time you modify the node's config, the retained values are cleared.
Reject non boolean (true/false) input valuesIf checked, the node will accept only boolean true/false values. Otherwise, it will try to convert the payload value to a logic true/false boolean.
Delay evaluation (ms)Delays the evaluation until this time (in milliseconds) is elapsed. Each time a message or "topic trigger message" (see Trigger mode) arrives, the delay is restarted. This option is useful for debouncing pourposes or simply for adding some delay. For example, you can turn on a light if the room is occupied for a long time, allowing people to fast transit repeatedly, without the need of turning the light on. Another example, if you have many sensors changing state rapidly, you can wait until these sensor reach a quiet state, then evaluate the inputs.

INPUT MSG TO THE NODE

Input msgDescription
msg.reset = trueResets all saved input values to undefined
msg.inputcountChanges the inputs count property. For example, msg.inputcount = 3 Whenever you lower the inputcount from a higher number to a lower one, for example from 3 to 2, it's suggested to do a msg.reset=true to reset all stored input values.

INTERRUPT FLOWS ULTIMATE

The interrupt flows is able to stop the input messages to exiting the node.

NODE CONFIGURATION

PropertyDescription
Trigger by topicWhenever the node receives a payload = false from this topic,it stops output messages to the flow. As soon it receives payload = true from this topic, the output messages start to flow out again. The node will output the current stored message plus an added property "isReplay = true", as soon as it receives a msg.play = true from this topic. The node will clear the current stored message, as soon as it receives a msg.reset = true from this topic.
With InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"
ThenThis property, allow you to auto toggle the selected start state (pass or block) after a timer has elapsed. You can choose from some pre-defined delays. If you have, for example, an Homekit-Bridged nodeset with a thermostat node or security system node in your flow, once node-red restarts, these homekit nodes output a default message to the flow. Just put an InterruptFlow node with a "block at start" behaviour and a toggle delay enabled behind homekit nodes, to temporary stop the chained nodes to receive the unwanted startup message.

INPUT MSG WITH "TRIGGER" TOPIC

Pass msg.payload = true to allow messages to pass through Pass msg.payload = false to prevent messages from passing through Pass msg.play = true from a message having the "trigger" topic, to replay the last stored message Pass msg.reset = true from a message having the "trigger" topic, to clear the last stored message

See the example below.

In this other example, you can see the property "play" in action. This property allow you to replay the last previously stored message. This allow to save the state of a node and then replay it back whenever you want.

INVERT ULTIMATE

Outputs the inverted input. For example true -> false The input message is preserved and passed to the output, changing only the topic and the payload. If the input message has it's own topic, it'll be preserved as well.

NODE CONFIGURATION

PropertyDescription
InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"

FILTER ULTIMATE

This node has 2 outputs. If the input payload is true, the node will send true on output 1 and nothing on output 2 If the input payload is false, the node will send nothing on output 1 and false on output 2 The input message is preserved and passed to the output, changing only the topic and the payload. If the input message has it's own topic, it'll be preserved as well.

NODE CONFIGURATION

PropertyDescription
InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"

BLINKER ULTIMATE

The pourpose of this node is to blink a led or something. output1 : outputs the value true/false output2 : outputs the inverted value false/true

NODE CONFIGURATION

PropertyDescription
InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"

Pass msg.payload = true to start blinking Pass msg.payload = false to stop blinking Pass msg.interval = 2000 to change the blinking interval

  • output1 stop behavior : when the blinker receives the stop message, you can select the behavior of the output1
  • output2 stop behavior : when the blinker receives the stop message, you can select the behavior of the output2

SIMPLE OUTPUT ULTIMATE

The pourpose of this node is to send a message with payload TRUE on the first output and FALSE on second output, independently from the msg input. This is useful if you need to simply send a true or false payload.

NODE CONFIGURATION

PropertyDescription
InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"

INJECT ULTIMATE

The pourpose of this node is to send a message with payload TRUE on the first output, FALSE on second output and a TOGGLE (true/false) on the third output, by pressing the pushbutton. This is useful if you need to simply test your flow.

STATUS ULTIMATE

The pourpose of this node is to show a status of the passingthrough message.

Show msg.

  • Write here the property you want to get the status from. For example, "payload", "mycar.color", etc.

IMPULSE ULTIMATE

The pourpose of this node is to send a sequence of pulsed commands to for example, open a garage door or to command an appliance requiring a set of timed commands.

NODE CONFIGURATION

PropertyDescription
InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"

Avaiable Commands Commands are to be wrote in the format: command:value. For example send:200, wait:2000. Each row represents a command. send sends a value. For example: send:true or send:100 or send:Hello wait wait for specified time (in milliseconds). For example wait:500 waits for 500 milliseconds restart Restart the sequence from the beginning. Use restart alone, without : and extra value. For example restart // comment. For example: // This opens the garage. The comment are ignored, so you can write what you want.

Pass msg.payload = true to the node to start the sequence Pass msg.payload = false to the node to stop the running sequence

  • Output: the node outputs a message you specified in the command textbox

MATH ULTIMATE

The pourpose of this node is to do maths on the incoming values. Each incoming message MUST HAVE OWN TOPIC.

NODE CONFIGURATION

PropertyDescription
InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"

INPUT

msg.reset resets the values to zero.

  • Output: the node outputs a message as follows:

br/>

TOGGLE ULTIMATE

The pourpose of this node is to toggle between true/false, everytime an inboud message arrives.

NODE CONFIGURATION

PropertyDescription
InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"

INPUT

Any message that arrives on input, will be passwd through to the output with the payload toggled between true and false.

RAILWAY SWITCH ULTIMATE

The railway switcher, switches the input msg flow to one ot the two outputs (upper or lower).

NODE CONFIGURATION

PropertyDescription
Switcher topicWhenever the node receives a payload from this topic, it switches the input messages to an output.
With InputIt's the msg property to be evaluated. By default, it is "payload", but you can also specify other properties, for example "payload.value"
ThenThis property, allow you to auto toggle the selected start state after some time.

INPUT MSG WITH "TRIGGER" TOPIC

Pass msg.payload = false switches the msg input to the UPPER output Pass msg.payload = true switches the msg input to the LOWER output

See the example below.

Copy and paste it into your flow

[{"id":"a6993d5187f05c0a","type":"RailwaySwitchUltimate","z":"e5b506b72b42922e","name":"Railway Switch","triggertopic":"trigger","initializewith":"0","autoToggle":"0","x":490,"y":180,"wires":[["51e7df8da0bd8d67"],["7f33b14e12c91744"]]},{"id":"2e3014226290f678","type":"InjectUltimate","z":"e5b506b72b42922e","name":"Sample message","topic":"Train","curVal":true,"x":180,"y":140,"wires":[["a6993d5187f05c0a"],[],[]]},{"id":"f6f80cd77a65073e","type":"InjectUltimate","z":"e5b506b72b42922e","name":"Railway switcher","topic":"trigger","curVal":true,"x":180,"y":220,"wires":[[],[],["a6993d5187f05c0a"]]},{"id":"51e7df8da0bd8d67","type":"debug","z":"e5b506b72b42922e","name":"Upper railway","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"topic","statusType":"msg","x":720,"y":140,"wires":[]},{"id":"7f33b14e12c91744","type":"debug","z":"e5b506b72b42922e","name":"Lower railway","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"topic","statusType":"msg","x":720,"y":220,"wires":[]},{"id":"8716120e94a7b6ee","type":"comment","z":"e5b506b72b42922e","name":"Switch between railways","info":"","x":190,"y":80,"wires":[]}]
1.1.8

8 days ago

1.1.7

27 days ago

1.1.6

27 days ago

1.1.5

27 days ago

1.1.4

27 days ago

1.1.3

1 month ago

1.1.2

4 months ago

1.1.1

6 months ago

1.1.0

8 months ago

1.0.63

8 months ago

1.0.62

9 months ago

1.0.61

10 months ago

1.0.60

1 year ago

1.0.59

1 year ago

1.0.58

1 year ago

1.0.57

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.56

2 years ago

1.0.52

2 years ago

1.0.51

2 years ago

1.0.40

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.49

2 years ago

1.0.50

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.33

3 years ago

1.0.34

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago