Set up an LXC container with a Node-RED function. A 7KN Powercenter 1000 data transceiver is integrated into Node-RED, which can be queried via Modbus TCP. Additional end devices can transmit data to the Powercenter via the energy monitoring system and be queried via Modbus. The data is stored in a structured format in an Influx database and can then be virtualized using Grafana.
The wiki was tested with router software 0.0.0.0 and the LXC container with Debian armhf bookworn.
The link below takes you to a wiki that describes how to install and set up an LXC container on a NetModule router.
Once the LXC container has been installed, we can install Node-RED.
For further installation, we need the curl
program and the npm
package on the container. We will then deploy Node-RED on the router using a script.
Next, the Node-RED program is installed via a script file.
Further information on the installation script can be found at this link.
* Node-RED script information github link
Node-RED core is installed in version 4.0.9 and Node.js in version 18.19.0.
The script command for this:
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/ master/deb/update-nodejs-and-nodered)
The first question is whether the installation should be carried out under
the “root” user. We only have the “root” user in the container, so
the answer is yes
.
Are you really sure you want to install as root ? (y/N) ? y
yes
here
Are you really sure you want to do this ? [y/N] ? y
I don't have a Pi where I install Node-RED on it, so no
here
Would you like to install the Pi-specific nodes ? [y/N] ? n
Stop Node-RED \u2714 Remove old version of Node-RED \u2714 Remove old version of Node.js \u2714 18.19.0+dfsg-6~deb12u2 Install Node 18.20.6-1nodesource1 \u2714 v18.20.8 Npm 10.8.2 Clean npm cache \u2714 Install Node-RED core \u2714 4.0.9 Move global nodes to local - Npm rebuild existing nodes \u2714 Install extra Pi nodes - Add shortcut commands \u2714 Update systemd script \u2714 Any errors will be logged to /var/log/nodered-install.log
All done.
Further settings for the Node-Red interface
The script command for this:
root@LXCNAME:~# node-red admin init
User Security ============= ? Do you want to setup user security? … ▸ Yes ▸ No
? Add another user? … ▸ Yes ▸ No
✔ Do you want to enable the Projects feature? · Yes ? What project workflow do you want to use? … ▸ manual - you must manually commit changes ▸ auto - changes are automatically committed
Node settings ============= ? Allow Function nodes to load external modules? (functionExternalModules) … ▸ Yes ▸ No
If you want to test the whole thing first, you can start the Node-RED server manually by entering the command “node-red-start”
.
If you want this to happen automatically when you start the LXC container, you have to set it up with the command “systemctl enable nodered.service”
.
Once you have stored the systemctl for Node-RED, you still have to restart the container for the service to start.
You can access the Node-RED interface via a web browser. Simply enter the IP address of the container and port 1880.
The Node-RED interface will then be displayed.