Hilscher / node-red-contrib-s7comm

A Node-RED node to communicate with Siemens S7 PLCs.
MIT License
34 stars 11 forks source link

Dynamic Reading I /O #14

Open Not-Jukkapan opened 1 year ago

Not-Jukkapan commented 1 year ago

Hi Can the library set the dynamic of IO that need to read/write via msg.payload or .ini file?

Sumiyyo commented 3 months ago

I have the same needs. I need to enter msg.payload.db number, msg.paylaod.offset, msg.payload. quantity in the input box of the setting reading signal, and accept the dynamic address from the previous function node to dynamically obtain the byte in the DB in the PLC. I tried to modify the .html file, but failed. I hope to get help.

Not-Jukkapan commented 2 months ago

It's been a while since I worked on this, but I remember my approach back then. In Node-RED, all the flows, libraries, and positions are stored in a flow.json file, where you can find the S7 configuration. This file stores all the addresses that we configure.

To make this dynamic, you can create another file, perhaps named addr.json, which users can access from outside, through some UI that you set up. You would then build a CRUD app specifically for managing addr.json.

Once you have that, you can create a merge script that combines the addresses in addr.json with the existing flow.json at the S7 configuration location. After merging, you can automate the redeployment of Node-RED to apply the changes.

You might want to explore the Node-RED documentation for scripting the redeployment, and you can use tools like ChatGPT or Claude to help you script out the merging process.