node-red-contrib-proficloud 1.1.1
Proficloud - IIoT-Platform of Phoenix Contact
Proficloud - IIoT-Platform of Phoenix Contact
NodeRED ProficloudNodes
This Nodes can be used to connect to the IIoT-Platform from Phoenix Contact the Proficloud
Requirements
To use the ProficloudDevice Nodes you need to have the node-red version 2.2.2 or higher as well as the node js version 12.22.8 or higher.
Usage
ProficloudDevice Node: This node represents a device of the Proficloud. You can set up the metadata in the node configuration. TSD, TrafficLight and Logs will be send through the input of the node.
TimeSeriesData: Send a msg.payload.data object to the node input. It will send the data to the cloud to visualize it on a dashboard in the Time Series Data Service. Please note that the names of your metrics can not contain any special charachters beside - and _.
example payload:
msg = {};
msg.payload = {"data" : {"humidity": 12.0, "temp": 2.0}};
return msg;
TrafficLight:
The traffic light will show up as color and Device status
in the Device Management Service.
The node needs a msg.payload.trafficLight object with the color (0 = Green, 1 = Orange, 2 = Red) and a message to be displayed as the Device status
. Neither one of them shall be missing.
example payload:
msg = {};
msg.payload = {"trafficlight": {"color": 2, "msg": "Some errors"}};
return msg;
To send a log, the node needs a msg.payload.log object with the message, the tag and the level of the log to be displayed in the Logs
-Panel of the Device Management Service. Neither one of them shall be missing.
example payload:
msg = {};
msg.payload = {"log": {"level": 2, "tag":"Node-RED","msg": "System started"}};
return msg;
External Timestamps: To send an external timestamp together with your data, you need to send the UTC timestamp in milliseconds. example payload:
msg = {};
msg.payload = {"data: {"timestamp": 12343423423, "humidity": 12.0, "temp": 2.0}};
return msg;
You can also send multiple timestamps and data at the same time. example payload:
msg = {}
msg.payload = {"data: [{"timestamp": 12343423423, "humidity": 12.0, "temp": 2.0}, {"timestamp": 12343423425, "humidity": 13.0, "temp": 21.0}]};
return msg;
Sending UUIDs: You can not only set the UUID of a node directly in the settings of the node, but also send it via a payload. Example payload:
msg = {};
msg.payload = {"config" : {"uuid": "873c543f-d3bd-43e1-bc47-982c0109566f"}};
return msg;
Reference Implementation: You can import the following flow as a reference implementation.
[{"id":"6ec2b92219a35dfa","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"9f62a2f0960bd0a4","type":"ProficloudDevice","z":"6ec2b92219a35dfa","uuid":"e884f50e-410a-4f31-a419-d00bdfca83dad","env":"Production","autostart":true,"autodelay":0,"metaByPayload":true,"deviceType":"NodeRED-Node","serialnumber":"","hardwareVersion":"2.4.2","proficloud_api":"env.kaa.proficloud-production.io","proficloud_mqtt":"mqtts://mqtt.proficloud-production.io:8883","tsd_interval_activated":true,"tsd_interval":"10","tsd_timeunit":"s","uuid_payload":false,"x":890,"y":460,"wires":[[]]},{"id":"6989bbdd0250d2ed","type":"comment","z":"6ec2b92219a35dfa","name":"Reference Implementation with buffering and set UUID","info":"This is an example flow to show the capabilities of the ProficloudDevice-Node.\nThe inject->function combination can be replaced by the way you like to connect your application. You can also use one of the pre configured Nodes for PxC devices. Just install [this](https://www.npmjs.com/package/node-red-contrib-phoenix-contact).","x":280,"y":80,"wires":[]},{"id":"24c2572c032adb83","type":"inject","z":"6ec2b92219a35dfa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":220,"wires":[["26b790e44e5f342e"]]},{"id":"26b790e44e5f342e","type":"function","z":"6ec2b92219a35dfa","name":"","func":"msg = {};\nmsg.payload = {\"data\" : {\"humidity\": 12.0, \"temp\": 2.0}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":220,"wires":[["9f62a2f0960bd0a4"]]},{"id":"b14218828af928f9","type":"comment","z":"6ec2b92219a35dfa","name":"TimeSeriesData","info":"","x":120,"y":160,"wires":[]},{"id":"8112e7959e7f526c","type":"comment","z":"6ec2b92219a35dfa","name":"TrafficLight - Green","info":"","x":130,"y":300,"wires":[]},{"id":"e5bea70b0076e6e0","type":"inject","z":"6ec2b92219a35dfa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":340,"wires":[["5f1c94add542f7db"]]},{"id":"5f1c94add542f7db","type":"function","z":"6ec2b92219a35dfa","name":"","func":"msg = {};\nmsg.payload = {\"trafficlight\": {\"color\": 0, \"msg\": \"no problem\"}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":340,"wires":[["9f62a2f0960bd0a4"]]},{"id":"a31c7dead96f3c26","type":"inject","z":"6ec2b92219a35dfa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":460,"wires":[["57fdc8a48d4b2e80"]]},{"id":"3f347af94461b670","type":"comment","z":"6ec2b92219a35dfa","name":"TrafficLight - Orange","info":"","x":130,"y":420,"wires":[]},{"id":"57fdc8a48d4b2e80","type":"function","z":"6ec2b92219a35dfa","name":"","func":"msg = {};\nmsg.payload = {\"trafficlight\": {\"color\": 1, \"msg\": \"Some minor problem\"}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":460,"wires":[["9f62a2f0960bd0a4"]]},{"id":"3328dbe573b734b8","type":"inject","z":"6ec2b92219a35dfa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":560,"wires":[["25519ad837182774"]]},{"id":"33e5997a8e3ced52","type":"comment","z":"6ec2b92219a35dfa","name":"TrafficLight - Red","info":"","x":120,"y":520,"wires":[]},{"id":"25519ad837182774","type":"function","z":"6ec2b92219a35dfa","name":"","func":"msg = {};\nmsg.payload = {\"trafficlight\": {\"color\": 2, \"msg\": \"Some problem\"}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":560,"wires":[["9f62a2f0960bd0a4"]]},{"id":"77f0f3e9dfd84f7a","type":"comment","z":"6ec2b92219a35dfa","name":"Log","info":"","x":90,"y":640,"wires":[]},{"id":"a5d6e4526c86be13","type":"inject","z":"6ec2b92219a35dfa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":700,"wires":[["b123fb2a72242919"]]},{"id":"b123fb2a72242919","type":"function","z":"6ec2b92219a35dfa","name":"","func":"msg = {};\nmsg.payload = {\"log\": {\"level\": 2, \"tag\":\"Node-RED\",\"msg\": \"System tarted\"}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":700,"wires":[["9f62a2f0960bd0a4"]]},{"id":"4b548d92b1e8a22b","type":"comment","z":"6ec2b92219a35dfa","name":"Refernce Implementation with UUID via payload and without buffering","info":"This reference implementation is supposed to showcase how a device can receive its UUID via a payload and work without buffering. The injection of TimeSeriesData and Logs works exactely the same as in the example above.\nTo connect the device with the Proficloud, you need to trigger the injection of the UUID.","x":330,"y":820,"wires":[]},{"id":"dd556f5f240c3bd2","type":"ProficloudDevice","z":"6ec2b92219a35dfa","uuid":"","env":"Production","autostart":true,"autodelay":0,"metaByPayload":true,"deviceType":"NodeRED-Node","serialnumber":"","hardwareVersion":"","proficloud_api":"env.kaa.proficloud-production.io","proficloud_mqtt":"mqtts://mqtt.proficloud-production.io:8883","tsd_interval_activated":false,"tsd_interval":10000,"tsd_timeunit":"ms","uuid_payload":true,"x":790,"y":1000,"wires":[[]]},{"id":"9ecffacd849fde46","type":"inject","z":"6ec2b92219a35dfa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":940,"wires":[["c52e2ff544f1c901"]]},{"id":"c52e2ff544f1c901","type":"function","z":"6ec2b92219a35dfa","name":"","func":"msg = {};\nmsg.payload = {\"config\" : {\"uuid\": \"e85964ce-8aff-4459-844d-a8bd9f7c30bio\"}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":940,"wires":[["dd556f5f240c3bd2"]]},{"id":"43ba6df70f4dd346","type":"comment","z":"6ec2b92219a35dfa","name":"UUID","info":"","x":90,"y":900,"wires":[]},{"id":"223aeee8864e22d0","type":"inject","z":"6ec2b92219a35dfa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":1060,"wires":[["6c0c2ff1682813b4"]]},{"id":"6c0c2ff1682813b4","type":"function","z":"6ec2b92219a35dfa","name":"","func":"msg = {};\nmsg.payload = {\"data\" : {\"volume\": 20.0, \"temp\": 4.0}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1060,"wires":[["dd556f5f240c3bd2"]]},{"id":"0b8cfe23c4ba838a","type":"comment","z":"6ec2b92219a35dfa","name":"TimeSeriesData","info":"","x":120,"y":1020,"wires":[]}]