I have a system that controls heating of metal through temperature sensors and a PID controller in Node-red.
I use context too file for the controlling and storing of setpoints, temperature, statuses and so forth.
I have a :1881/ui with textfields, buttons and what not for setting what needs to be set.
This system needs to support Modbus TCP.
Now, writing locally from the context to the local modbus server is not a problem. That works fine, and the remote client is able to read the data. It is writing from a remote client to the local server that the problem arises. Since the system uses the context data for control, the new data from the remote client is not used. And I'd hate to start using the modbus server data for control, since that is a lot more complicated procedure than to just write out global.get("someKey", "file") in a function node or using a change node.
Now, I have a solution that I think will work, but I wanted to ask here before I embark on some rewrite quests.
The delay node here is the window where the remote modbus client and the local ui can do changes.
The problem here is that when a local change through the ui is done and stored in context, that data will be overridden by the data in the modbus server. The solution here is to store new data from ui in the modbus server instead, and let the loop depicted over do the writing to context.
Is there a more elegant way?