<aside> đź’ˇ THE STARTING POINT
</aside>
Implement the timestamp node to ask for the WAGO values once every second.
The build all the functions according to the flow above w.r.t. the following picture and connect them all to the OPC UA Client
Connected to the OPC UA you need a function for clearing null values again and defining the different topics:
var payload = msg.payload
msg.payload ={}
if (payload === null) {
msg.payload[msg.browseName] = 0;
msg.payload["timestamp_ms"] = Date.now();
} else {
msg.payload[msg.browseName] = payload;
msg.payload["timestamp_ms"] = Date.now();
}
msg.topic='ia/raw/dccaachen/warping/'+msg.browseName
return msg;
To finalize just another simple MQTT-OUT node is necessary.
<aside> 💡 This is just the basic flow. You may need some extras like hysterises or filters on value changes. Also you may need the “kill flow” to restart PLCs in case they can’t connect.
</aside>