cysoz:
[{"id":"c55613f7.93395","type":"Datahub Subscribe","z":"58fe519a.9abd2","name":"T_Lutowania C3H1","natc":"d16b4f91.27069","topicname":"devicehub.raw.49D9941E-8915-44E2-BCC9-0A0D0652389F.E87D5CED-0734-4947-8963-0F111A6BCF1E","x":130,"y":540,"wires":[["a4f63409.147c78"]]},{"id":"55148774.36ca88","type":"Datahub Subscribe","z":"58fe519a.9abd2","name":"C31_Tracking_Data","natc":"d16b4f91.27069","topicname":"devicehub.raw.49D9941E-8915-44E2-BCC9-0A0D0652389F.C66C5852-2438-4BBA-B0BD-8C256F0E11A8","x":130,"y":460,"wires":[["a4f63409.147c78","9e447256.be923"]]},{"id":"9e447256.be923","type":"debug","z":"58fe519a.9abd2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":370,"y":400,"wires":[]},{"id":"aca0a33f.b5b3f","type":"debug","z":"58fe519a.9abd2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":500,"wires":[]},{"id":"a4f63409.147c78","type":"json","z":"58fe519a.9abd2","name":"JSON to Object","property":"payload","action":"obj","pretty":false,"x":360,"y":500,"wires":[["1c67c677.deddda"]]},{"id":"1c67c677.deddda","type":"function","z":"58fe519a.9abd2","name":"NewValue","func":"const a = new Date();\nconst top = msg.topic;\nconst pay = msg.payload;\nconst temp = msg.payload.success;\nconst temp1 = msg.payload.tagName;\nconst temp2 = msg.payload.value;\n\nif(temp1 === \"C31_Tracking_Data\" )\n {\n let trace = pay.value;\n \n }\n\n\nif(temp && temp1 !== \"C31_Tracking_Data\") // Checks if the message succeeded and if the tag name exists before continuing.\n{\n let datafilter = msg.payload;\n \n msg.payload.deviceID = \"trac\";\n let current = datafilter.value;\n \n \n let obj = datafilter.registerId;\n let previous = context.get(obj);\n \n if (previous !== current)\n {\n context.set(obj,current);\n node.status({fill:\"blue\",shape:\"dot\",text: (obj, current)});\n return msg;\n }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":520,"y":500,"wires":[["329ec114.ec3f7e","64dd267f.2203f8"]]},{"id":"329ec114.ec3f7e","type":"function","z":"58fe519a.9abd2","name":"NewName_SV","func":" const myObj = msg.payload;\n const text = myObj.tagName;\n \n\t\tif(text.startsWith(\"0#\") == true){\n\t\t\n\t\t\t//dla wartości 0#\n\t\t\t const restText = text.substr(\"0#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/1;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n else if(text.startsWith(\"1#\") == true){\n\t\t\n\t\t\t//dla wartości 1# - dzielenie wartości przez 10\n\t\t \tconst restText = text.substr(\"1#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/10;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n\t\telse if(text.startsWith(\"2#\") == true){\n\t\t\n\t\t\t//dla wartości 2# - dzielenie wartości przez 100\n\t\t \tconst restText = text.substr(\"2#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/100;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n\t\telse if(text.startsWith(\"3#\") == true){\n\t\t\n\t\t\t//dla wartości 3# - dzielenie wartości przez 1000\n\t\t \tconst restText = text.substr(\"3#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/1000;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n\t\telse if(text.startsWith(\"#\", 1 ) == false){\n\t\t\n\t\t\t//brak przedrostka\n\t\t\tmsg.payload = myObj;\n\t\t\treturn msg;\n\t\t }","outputs":1,"noerr":0,"initialize":"","finalize":"","x":700,"y":500,"wires":[["b86e757f.90d6c8","aca0a33f.b5b3f"]]},{"id":"b86e757f.90d6c8","type":"debug","z":"58fe519a.9abd2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":440,"wires":[]},{"id":"64dd267f.2203f8","type":"debug","z":"58fe519a.9abd2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":380,"wires":[]},{"id":"d16b4f91.27069","type":"Datahub Connect","ipadd":"127.0.0.1","port":"4222"}]