Sending values per OPC UA works when inputing a msg, msg.payload gets sent as value.
In this example you can press the top inject node to send true to whatever item is set in OPC UA Item.
Leaving the item of OPC UA Item blank is not allowed. Trying to send a different item doesn't work, because the node only tries to send msg.payload per OPC UA, and does not look at msg.topic.
Is there a way to achieve the theorized example of being able to change the Item after deploying, or is there some underlying issue with OPC UA communication?
Yes, there is a way:
First i checked, what is inside the msg sent by the OPC UA item node, then recreated it with an own implementation:
_event does not seem to be needed, i added all others:
This way, I am able to send my item while being able to change the topic which changes the OPC UA variable that is written.
if(msg.topic == "Value")
{
context.data.payload = msg.payload;
msg = context.data;
return msg;
}
else if(msg.topic == "Item")
{
context.data = {}
context.data.datatype = "Boolean"
context.data.browseName = "";
context.data.topic = msg.payload;
}
This is my example implementation that works by first receiving the topic (only Boolean values will be set in OPC UA), then afterwards receiving the value(s).
There probably is a better and more robust implementation, but you can change this for your own use case, whatever works for you. This is just for a proof of concept, so the simplest implementation is best.
Thanks for being interested in this question @whoever upvoted. Maybe someone in the future stumbles across this and it can help them out.