Automation (Node-RED) in Access Commander
The steps in this article require using the web interface of a 2N device. Please follow this manual in case this is your first time using the web interface.
In this article, we will go through the new Automation feature of the Access Commander available since the 3.2 version.
The Access Commander's Automation feature is powered by the Node-RED editor, which is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single click. Basically, it is a low-code programming for event-driven applications.
- First start
- Automation states
- Automation editor (Node-RED)
- Examples
- Feedback
First start
The Automation feature is located in the "Settings -> Configuration -> Automation" section and is turned off by default. You can enable it with the slider.

When the Automation is enabled for the first time, a new window will appear with information about the Automation feature, its examples and Access Commander-specific notes along with links for the official Node-RED documentation.
You can select to install example flows when first enabling the Automation feature. it is also possible to install the example flows later in the editor.

Once you enable the Automation feature, the state will change to Active and you can edit the flows (more about flows will be described later in this article).
It is also possible to show the window with the information about the Access Commander's Automation feature by clicking on the question mark.

You can show the Automation logs and download them in the .log format by showing more options.


Automation states
There are five states of the Access Commander's Automation feature when enabled - No status, RUNNING, NOT RESPONDING, UNSTABLE and SAFE MODE.
No status
When the Automation function is not enabled, the status does not show in the section and it is possible to see a "Disabled" message.
RUNNING
When the Automation feature is enabled and there are no issues with the flows (more about flows later), the status of the Automation is RUNNING.
SAFE MODE
The automation is enabled, but loading and running user nodes is suspended. The Automation feature makes it possible to access and fix flows or nodes which may cause instability or response issues. This mode does not persist through reboots of the 2N Acess Commander.

NOT RESPONDING
The automation is running but not responding. In this state, the flows are not running. We recommend running the Automation in safe mode to check and fix possible issues. It is also possible to view logs of the automation.

UNSTABLE
This state means that the automation is enabled but it is restarting frequently and the flows are not running. We recommend running the Automation in safe mode to check and fix possible issues. It is also possible to view logs of the automation.

Automation editor (Node-RED)
In this section, we will describe the Node-RED editor itself, its sections and components.
A new tab in your web browser will be opened when you click on "Open editor".

Once you open the editor you will access the editor's workspace described below.

1) On the left side you can find nodes.
Nodes are the building blocks of a Node-RED application. Each node performs a specific task, such as sending data, processing information, or interacting with an external device or service. Nodes are connected with wires.
Wires are the lines that connect nodes together. They show how data flows from one node to another.
These nodes are sectioned in groups. Most of them are standard Node-RED nodes which are explained in the Node-RED documentation. In the Access Comamdner automation, there are nodes made specifically for the Access Comamdner.
- REST API - sends the defined HTTP API request. The input data contained in the body property is used as the request body of this request. The output from the node is the data from the response to the request.
The selection and sorting of the output data can be specified in the Query parameter. - Access log - retrieves records in the Access log and enables further processing of these records. The administrator can set up automated tasks that run when the 2N Access Commander records a defined log entry.
Defining the action is done in the node settings. The output is specific data about the recorded event. A SignalR-based feature runs in the background of this feature. - System log - retrieves records in the System log and enables further processing of these records. The administrator can set up automated tasks that run when the 2N Access Commander records a defined log entry.
Defining the action is done in the node settings. The output is specific data about the recorded event. A SignalR-based feature runs in the background of this feature. - SignalR - reads data in the subscribed topic. Node fetches data in real-time, so it is suitable for scenarios where it has an automated task to fetch information from the 2N Access Commander without having to constantly poll.
- Dynamic SignalR - In comparison to the SignalR node, the Dynamic SignalR node allows for dynamic changes in data retrieval. It may be for example change of topic or a way of data retrieval based on input values.
The output of this node is retrieved data from topics (Data) and also information about the success or failure of actions made by this node. - Write System log - creates a record in System log in the web of 2N Access Commander. The record in the system log consists of severity, event name and event description.
If any error happens during the process, it is recorded and the state of the node is updated. Node does not have any output.
2) This section is basically the "workplace" where nodes are wired making them flows. A flow is the complete set of nodes and wires that work together to achieve a task or automate a process. You can have multiple tabs for a more clear arrangement.
3) On the right side, you can see the information about the nodes, display the "Help" option and show the debug section, where the output from the flows can be exported.
4) by clicking the "Deploy" button, the flows are applied and started.
5) In the top right corner, you can see more options for the editor.
Import of flows
In the top right corner click on the "burger menu" and select "Import".

Flows should be saved in a .json format. You can import the flows by writing the JSON code to the clipboard, uploading it from local storage or selecting examples by the Access Commander.

You can also select if you want to import the flow to the current flow tab or create a new flow tab. By clicking on the "Import" button, the import is finished.

Export of flows
In the top right corner click on the "burger menu" and select "Export".

A new window will show where you can see all the nodes that can be exported. You can also display the JSON code of the flow.
There are two ways to export the flows.
1) You can download a .json file which can be uploaded or imported.
2) You can copy the JSON code and paste it where you need.


Examples
For more information about the examples, please, refer to the Access Commander manual at: https://www.2n.com/en-GB/Manuals/22111/UUID-76d55fd6-6832-2275-b1ba-32d6a22f85f9
Feedback
If you want to send us feedback or suggest an improvement, you can do so simply by clicking on the Please share your thoughts. link in the Automation section and a new window will appear. You can select if you want to be contacted back or not.
All your feedback is reviewed by our Access Commander team. In case of technical issues, contact our technical support

