I’m using the node-red-contrib-mcprotocol-ind node to communicate with a Mitsubishi Q-series PLC via MC Protocol (3E frame, TCP, port 20000).
Reading values works perfectly, but I’m having trouble writing numeric values.
Here’s my situation:
I have a Function node that outputs a number like 16753 (msg.payload = 16753;)
I connect this Function node directly to an Ind MC Write node
The Write node has:
address: D400
dataType: num
data: (left blank)
When I inject the value, the Write node executes (shows true in debug), but when I read D400 back, the value is always 0.
If I manually put a value in the “data” field of the Write node (for example 1), it writes correctly.
So the connection and configuration seem fine — it’s just when I send the value dynamically through msg.payload that it doesn’t work.
Question:
What is the correct way to send a numeric value dynamically from a Function node to the Ind MC Write node?
Should msg.payload be a plain number, or does the node expect a specific format (object, array, etc.) for numeric writes?
Any examples of writing values from Function → MC Write successfully would really help.
Firstly, I would appreciate if you uninstall that version and install the original which was written by me.
This -ind version is a duplicate of my work without any accreditation and they didn't even bother to update the readme. See for yourself (they didn't even bother changing the install instructions or anything in the readme - it's still talks about the original works):
Ps, note how there is no link to the GitHub repository in the copy (so you would be unable to raise issues or implement fixes, or get support!)
Change the type to msg and specify payload
I'm not sure about this copy, but my original node has built-in examples that you access via CTRL - I
Ps, i hope you don't mind me saying but your stumbling block is quite a basic knowledge thing in node-red perhaps you would benefit from going through this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.
Thanks a lot, Steve — I really appreciate your help and the clarification about the original node.
To be honest, I had to get this system running quickly for a specific project, so I didn’t take the time to go deep into the Node-RED concepts — just enough to make it work for the moment.
I’ll definitely follow your recommendation and watch the Node-RED Essentials videos to strengthen my understanding.
Regarding the nodes, I actually tried the original node-red-contrib-mcprotocol before, but I couldn’t get it to connect to the PLC using the same configuration.
Tomorrow I’ll remove everything and reinstall the proper version, then test again from scratch.
Thank you again for your time and for pointing me in the right direction — really appreciate your availability to help!