Is exec node is the one i should use?

I'm trying to create a communication driver i C language for reading data from variuos sources like for example modbus devices. I am going to include much more then one method of communication in it. My idea is to make this driver as stand alone execute file in linux system on raspberry pi. The driver will recieve configuration and then in return i will get read data from device continusly 24h/365. My issue is this:

I want to run this driver using node-red node and control if this driver is working or not. If not working i want to run it again and so on...

What node i should use?

If you could integrate a MQTT Server/Client into the driver you could read/communicate with it using the MQTT nodes.

1 Like

For long running exec commands that you want to interact with while there running there is the daemon node: https://flows.nodered.org/node/node-red-node-daemon
I use it to interact with several exec scripts that run 24/7 365.
Johannes

3 Likes

Do you have any reason to not use the available modbus nodes?

I am curious as to why you might develop a C application for accessing modbus then attempt to remote control it from node-red when node-red already has the ability to poll modbus devices.

1 Like

Hi ghayne

Yes but i want to controll all of it.

Simplest way is to use the daemon node as mentioned, as that let's you interact via stdin and stdout, and does autorestart etc.

The serious way is to wrap the c with a nodejs interface and then create a dedicated node, but that may be a bit too onerous for a small project. Eg see https://nodeaddons.com/getting-your-c-to-the-web-with-node-js/

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.