
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
node-red-contrib-automation-controller
Advanced tools
The automation controller is used to help out with home automation in mind, but has other purposes as well. The main idea is to keep multiple inputs for the same external component to be handled within this node and output a generic result.
For the easiest example: A button! Click, Double click, Hold/Release are states that the same component reports. This node enables all these states to be handled inside it and outputs a customized result. For more complex usage, the JavaScript field type can be used on multiple fields to enable more comprehensive tasks.
I was making a test with home automation where an IKEA 5 button implementation went crazy as shown here:
This node is a result of this code and resulted in this:

Fig. 1: Node appearance
~/.node-rednpm install node-red-contrib-automation-controllerFig. 2: Node explaination
The automation controller node is a multi-functional event/State handling node that takes an input and tries to match it against a number of different created rules. Each rule have their own setup on how it should be behave. The purpose of the node is to compress the complexity of the node schematics when having multiple behaviors for a single component, for example a button controlling a light in home automation or a server status that should trigger different gui components to be updated with states.

Fig. 3: Node appearance
The node has up to 10 different rules that can be customized to fit the purpose of the specified function. The node has by default multiple outputs (one for each rule, but can be reconfigured to have only a single output).
The node configuration sets up how the sensor should react.

Fig. 4: Node properties
(Optional) The name of this node. (Will change the content of the node to the name)
The field to read and validate against the rule's Match mode (for events) or Activate on and Deactivate on (for states)
Tells how the node should react when an execution occurs.

Each button/tab represents a rule. By clicking on it, the rule is presented.
To add a new rule, pres the + button (there's a maximum of 10 rules).
(Optional) Sets the name of the currently selected rule.
Sets the mode of how this rule should function.
The value to match the input field against. When matched, this rule will be executed.
The time to wait before this action can be executed again. (This will also prevent other rules to be executed if behavior is preventing multiple rules.) (Zero for disabled)
The time to wait before the rule's current value is reset to the initial. (Zero for disabled)
The value to match the input field against to begin execute the rule. JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It will accept the return value to match against the input or, it can return a true/false statement to tell if matched the field.
The value to match the input field against to halt/stop the execution of this rule. JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It will accept the return value to match against the input or, it can return a true/false statement to tell if matched the field.
The time to wait before this action can be executed again. (This will also prevent other rules to be executed if behavior is preventing multiple rules.) (Zero for disabled)
If checked, the Activate on match can occur while already active. Otherwise only Deactivate on match will be checked.
The message to use for repeat messages:
The time to wait before this action can be executed again. (This will also prevent other rules to be executed if behavior is preventing multiple rules.) (Zero for disabled)
The message to send when the state becomes inactive either through Deactivate on or the Time out. JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It can return free of choice.
If checked, the output mode's current value will be set to its Initial value. (The result depends on the Output mode that is used.).
The field to be updated with the result of the execution. (To allow multiple rules to be executed on the same input, this field is unique per rule) JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It can return free of choice. Note: input value is named output.
Tells how the output should react and work:
The value to send out to the output field. JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It can return free of choice.
The initial value to use for first execution or when being reset (either by Reset to initial.. or by message input, msg.state='reset'). This value must resolve into an integer number. JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It must return a valid integer, or 0 will be used.
The minimum value to use when cycling through the value. (Must resolve into an integer value less than max value)
The maximum value to use. (Must resolve into an integer value greater than min and initial value) When this value is reached, the loop will either stop executing (if not to cycle) or move to the min value (if to cycle).
The number of jumps to add to the current value for each iteration/execution. (Must resolve into a positive integer value)
If checked, the value will cycle to min value when reached the max. Otherwise, the execution of the rule will be prevented.
If checked, the value will ensure that the max value is sent if the value reached beyond the max value (if steps is greater than 1 it might end up in max+X). And if cycle is checked, the min value will be set (instead of "curValue - (max-min)").
The initial value to use for first execution or when being reset (either by Reset to initial.. or by message input, msg.state='reset'). This value must resolve into an integer number. JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It must return a valid integer, or 0 will be used.
The minimum value to use. (Must resolve into an integer value less than max value) When this value is reached, the iteration will turn to use the Positive steps.
The maximum value to use. (Must resolve into an integer value greater than min) When this value is reached, the iteration will turn to use the Negative steps.
The number of jumps to add to the current value for each iteration/execution while in the positive mode. (Must resolve into a positive integer value)
The number of jumps to subtract from the current value for each iteration/execution while in the negative mode. (Must resolve into a positive integer value and will automatically be converted to a negative value)
If checked, the value will ensure that the max value is sent if the value reached beyond the max value (if steps is greater than 1 it might end up in max+(X-1) or min-(X-1) and will be converted to just min/max.).
The initial index to use for first execution or when being reset (either by Reset to initial.. or by message input, msg.state='reset'). This value must resolve into a positive integer number matching one of the items (First record starts on zero) JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It must return a valid integer, or 0 will be used.
The value to send when current index maches this row. JS accepted: This field is designed to handle JavaScript (see JavaScript secion for more info). It can return free of choice.
Removes the record of the related row clicked.
Adds a new record to the fixed values.
If checked, the index will move to the first record when cycled through. Otherwise it will prevent the execution.
The rule to execute instead when this rule is executed.
If checked, the engine that is executed will work in reverse. (This is convenient if to have two inputs that toggles raise/lower.) Otherwise, the rule will just be executed in normal mode.
If checked, the target (rule linked to) will have it's latest value stored in it for usage with the JavaScript functions. Otherwise, only the current rule will have it's latest value stored.
The msg.state can be used to reset the state of the current output engine. The msg.engineValue can be used to override the current value (before execution, this means that the value will be altered).
Some fields has been JavaScript enabled. The engine works the same way in all different functions. It contains the following access features:
Remark: Example flows are present in the examples subdirectory. In Node-RED they can be imported via the import function and then selecting Examples in the vertical tab menu.
This example shows the basic usage. The configuration simulates how a button can be clicked, double clicked or hold/release and gives you the result in three different debug nodes.
example-1.json
Fig. 5: Basic usage example
v1.0.0 Completed documentation and translations v0.1.0 Initial release
FAQs
A Node-RED automation controller
We found that node-red-contrib-automation-controller demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.