-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduction-Copilot-Tutorial.vfc-sample-flow.json
More file actions
1 lines (1 loc) · 16.6 KB
/
Production-Copilot-Tutorial.vfc-sample-flow.json
File metadata and controls
1 lines (1 loc) · 16.6 KB
1
[{"id":"5be3cc14.887c04","type":"tab","allowCycles":false,"label":"🌟 CopilotTutorial","disabled":false,"info":""},{"id":"9d0a3fb7.5746","type":"catch","z":"5be3cc14.887c04","name":"","scope":null,"x":440,"y":180,"wires":[["2d2a4421.9556fc","f0fa3969.ee5fc8"]],"_type":"node"},{"id":"70b5ad6d.47c584","type":"combine","z":"5be3cc14.887c04","name":"","triggers":"1,1,1","inputs":"3","timeseries":false,"waitall":true,"reset":true,"x":960,"y":100,"wires":[["94bc3273.738c7","a1cfcc0e.1a6ba"]]},{"id":"d848426c.1704a","type":"comment","z":"5be3cc14.887c04","name":"GetEvents skill","info":"","sticky":2,"x":150,"y":300,"wires":[]},{"id":"2eb07b0d.6cd004","type":"comment","z":"5be3cc14.887c04","name":"GetCases skill","info":"","sticky":2,"x":150,"y":480,"wires":[]},{"id":"49c9ef7f.1990e","type":"comment","z":"5be3cc14.887c04","name":"GetEnergyCost skill","info":"","sticky":2,"x":130,"y":680,"wires":[]},{"id":"63560008.fbf9a","type":"comment","z":"5be3cc14.887c04","name":"CreateNewCase skill","info":"","sticky":2,"x":130,"y":900,"wires":[]},{"id":"454eb8e0.5d3738","type":"comment","z":"5be3cc14.887c04","name":"GetPlantStatus skill","info":"","sticky":2,"x":190,"y":20,"wires":[]},{"id":"84b76b45.dac9a8","type":"create event","z":"5be3cc14.887c04","name":"Simulate event","asset":"1d22c207ccb34957962df3a005b2c89d","assetName":"01 - Stencil Printer","severity":"30","acknowledged":"false","description":"Front gearbox vibration problem","x":1640,"y":320,"wires":[]},{"id":"f8e4d9d.e06f628","type":"create-work-order","z":"5be3cc14.887c04","name":"Create Case","title":"\"test\"","description":"\"test\"","assignedTo":"","dueDate":"2024-10-10","datetimepickerDueDate":"2024-10-10","orderStatus":"OPEN","priority":"LOW","orderType":"PLANNED","asset":"","assetName":"","fileAsset":"","fileName":"","x":650,"y":940,"wires":[["f2520c9.225c0f","9a7e1783.227118"]]},{"id":"7ee451a.a65e6b","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":880,"y":380,"wires":[]},{"id":"d67ef1bc.677b2","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":880,"y":560,"wires":[]},{"id":"5e9a1988.360c78","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":880,"y":760,"wires":[]},{"id":"f2520c9.225c0f","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":880,"y":980,"wires":[]},{"id":"2dc82a7.c449dd6","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":400,"y":300,"wires":[]},{"id":"e9d203c8.6d7cb","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":400,"y":480,"wires":[]},{"id":"fa677422.d89a68","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":400,"y":680,"wires":[]},{"id":"575f348a.7d35cc","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":400,"y":900,"wires":[]},{"id":"94bc3273.738c7","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"true","x":1180,"y":220,"wires":[]},{"id":"d0a98426.c51c88","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"payload","x":460,"y":20,"wires":[]},{"id":"f0fa3969.ee5fc8","type":"debug","z":"5be3cc14.887c04","name":"debug output","active":true,"console":"false","xaxis":"_time","complete":"true","x":740,"y":220,"wires":[]},{"id":"4af372d5.f6cb9c","type":"function","z":"5be3cc14.887c04","name":"Filter","func":"const statuses = {\n 0: 'unknown status',\n 20: 'error',\n 30: 'warning',\n 40: 'information',\n 50: 'OK'\n};\n\n// remove info events\nconst inputArray = msg.payload.filter(item => item.severity !== 40);\n \n// limit to 50 messages\nconst limitedArray = inputArray.slice(0, 50);\n\n// select the interesting fields, and map codes to text\nconst resultArray = limitedArray.map(item => ({\n timestamp: item.timestamp,\n description: item.description,\n severity: statuses[item.severity]\n}));\n\n\nmsg.payload = resultArray;\nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":650,"y":340,"wires":[["7ee451a.a65e6b","947830cf.5e22b"]]},{"id":"d184e0d7.4a681","type":"function","z":"5be3cc14.887c04","name":"Filter","func":"const statuses = {\n 0: 'unknown status',\n 20: 'error',\n 30: 'warning',\n 40: 'information',\n 50: 'OK'\n};\n\n// limit to 50 \nconst limitedArray = msg.payload.slice(0, 50);\n\n// select the interesting fields\nconst resultArray = limitedArray.map(item => ({\n createdDate: item.createdDate,\n title: item.title,\n type: item.type,\n priority: item.priority,\n description: item.description,\n handle: item.handle\n}));\n\nmsg.payload = resultArray;\nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":650,"y":520,"wires":[["d67ef1bc.677b2","664fd81f.e9bda8"]]},{"id":"13514911.39dbe7","type":"function","z":"5be3cc14.887c04","name":"Extract market price","func":"var data = msg.payload.data;\n\nif (data && data.length > 0) {\n // in case rate limiting kicks in, use replacement value\n if (data[0].marketprice === \"Too many requests\") {\n msg.payload = '233 Eur/MWh';\n }\n else {\n msg.payload = data[0].marketprice + ' Eur/MWh';\n }\n} else {\n // in case the http call failed use replacement value\n msg.payload = '234 Eur/MWh';\n}\nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":650,"y":720,"wires":[["5e9a1988.360c78","3d6f959f.7298fa"]]},{"id":"5baf2b33.9a1804","type":"function","z":"5be3cc14.887c04","name":"Extract Parameters","func":"const title = msg.payload.title.substring(0,30);\nconst description = msg.payload.description.substring(0,200);\nconst currentDate = new Date();\n\nmsg.payload = {\n title: title,\n description: description,\n status: \"Open\",\n priority: \"MEDIUM\",\n type: \"Planned\",\n dueDate: currentDate.toISOString()\n};\n\nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":410,"y":940,"wires":[["f8e4d9d.e06f628"]]},{"id":"336cc4f7.f198ac","type":"function","z":"5be3cc14.887c04","name":"Translate Status","func":"const assetName = 'Stencil printer';\n\nconst statuses = {\n 0: '❔ unknown status',\n 20: '❌ ERROR',\n 30: '⚠️ Warning',\n 40: 'ⓘ Information',\n 50: '✅ Operational'\n};\n\nconst assetStatus = statuses[msg.payload.health];\n\nmsg.payload = assetName + ': ' + assetStatus;\n \nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":740,"y":60,"wires":[["70b5ad6d.47c584"]]},{"id":"7ce54828.d041b8","type":"function","z":"5be3cc14.887c04","name":"Translate Status","func":"const assetName = 'SPI machine';\n\nconst statuses = {\n 0: '❔ unknown status',\n 20: '❌ ERROR',\n 30: '⚠️ Warning',\n 40: 'ⓘ Information',\n 50: '✅ Operational'\n};\n\nconst assetStatus = statuses[msg.payload.health];\n\nmsg.payload = assetName + ': ' + assetStatus;\n \nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":740,"y":100,"wires":[["70b5ad6d.47c584:1"]]},{"id":"41ae521d.0e43dc","type":"function","z":"5be3cc14.887c04","name":"Translate Status","func":"const assetName = 'SMT placing';\n\nconst statuses = {\n 0: '❔ unknown status',\n 20: '❌ ERROR',\n 30: '⚠️ Warning',\n 40: 'ⓘ Information',\n 50: '✅ Operational'\n};\n\nconst assetStatus = statuses[msg.payload.health];\n\nmsg.payload = assetName + ': ' + assetStatus;\n \nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":740,"y":140,"wires":[["70b5ad6d.47c584:2"]]},{"id":"2d2a4421.9556fc","type":"function","z":"5be3cc14.887c04","name":"Return error message","func":"msg.payload = \"Error occured - Please check the nodes in your VFC Flow,\"; \nreturn msg;","outputs":1,"language":"javascript","noerr":0,"x":760,"y":180,"wires":[["94bc3273.738c7","a1cfcc0e.1a6ba"]]},{"id":"72698c3e.68ef04","type":"http request","z":"5be3cc14.887c04","name":"GET real market price","method":"GET","ret":"obj","url":"https://api.corrently.io/v2.0/marketdata?zip=76189&token=xyz","timeout":"20","mindspherePath":"","useMindsphereAuth":false,"isAdmin":false,"secretHeaders":"","x":420,"y":720,"wires":[["13514911.39dbe7"]]},{"id":"363992d3.beb14e","type":"inject","z":"5be3cc14.887c04","name":"manual trigger","topic":"","payload":"","payloadType":"date","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":140,"y":380,"wires":[["fd433abe.409498"]]},{"id":"c692e505.bf20a8","type":"inject","z":"5be3cc14.887c04","name":"manual trigger","topic":"","payload":"","payloadType":"date","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":140,"y":560,"wires":[["dfcb337e.ed4be"]]},{"id":"4dc2137b.84777c","type":"inject","z":"5be3cc14.887c04","name":"manual trigger","topic":"","payload":"","payloadType":"date","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":140,"y":760,"wires":[["72698c3e.68ef04"]]},{"id":"524245b2.d3aa9c","type":"inject","z":"5be3cc14.887c04","name":"Simulate","topic":"","payload":"","payloadType":"num","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":1460,"y":320,"wires":[["84b76b45.dac9a8"]]},{"id":"1c133c08.0ab6f4","type":"inject","z":"5be3cc14.887c04","name":"manual trigger","topic":"","payload":"{\"title\":\"demo title\",\"description\":\"demo description\"}","payloadType":"json","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":140,"y":980,"wires":[["5baf2b33.9a1804"]]},{"id":"20f8ccde.322bb4","type":"inject","z":"5be3cc14.887c04","name":"manual trigger","topic":"","payload":"","payloadType":"date","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":200,"y":100,"wires":[["90813164.81d28","e9edec7.ab28d1"]]},{"id":"fb3a298f.a85428","type":"inject","z":"5be3cc14.887c04","name":"set status","topic":"","payload":"50","payloadType":"num","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":1460,"y":80,"wires":[["c89fb8b2.214728"]]},{"id":"1d3b3b8e.d62ac4","type":"inject","z":"5be3cc14.887c04","name":"set status","topic":"","payload":"50","payloadType":"num","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":1460,"y":120,"wires":[["317b3891.468918"]]},{"id":"7d96b337.b20dac","type":"inject","z":"5be3cc14.887c04","name":"set status","topic":"","payload":"30","payloadType":"num","repeat":"","repeatEnd":"0","endTime":"0","crontab":"","offset":"NaN","once":false,"properties":"","timezone":"utc","betweentimesunit":"m","showNextExecution":false,"powerMode":false,"x":1460,"y":160,"wires":[["96e682de.6e15f"]]},{"id":"dfcb337e.ed4be","type":"list-work-orders","z":"5be3cc14.887c04","name":"Get cases","handle":"","x":380,"y":520,"wires":[["d184e0d7.4a681"]]},{"id":"fd433abe.409498","type":"read events","z":"5be3cc14.887c04","name":"Get Events","asset":"","assetName":"","severity":"","acknowledged":"","period":"1440","mode":"relative","from":"","datetimepickerFrom":"","to":"","datetimepickerTo":"","timezoneoffset":0,"thoroughly":false,"x":390,"y":340,"wires":[["4af372d5.f6cb9c"]]},{"id":"90813164.81d28","type":"read-static","z":"5be3cc14.887c04","name":"GetState - Stencil Printer","topic":"1d22c207ccb34957962df3a005b2c89d/status/health","topicLabel":"01 - Stencil Printer/status/health","topicData":"{\"asset\":\"1d22c207ccb34957962df3a005b2c89d\",\"assetName\":\"01 - Stencil Printer\",\"aspect\":\"status\",\"aspectName\":\"status\",\"variables\":[{\"name\":\"health\",\"variableId\":\"health\"}]}","assetName":"","aspectName":"","x":490,"y":60,"wires":[["336cc4f7.f198ac"]]},{"id":"e9edec7.ab28d1","type":"read-static","z":"5be3cc14.887c04","name":"GetState - SPI machine","topic":"bb3a49e9e2ca44399f6266bf6a3514d5/status/health","topicLabel":" 02 - SPI/status/health","topicData":"{\"asset\":\"bb3a49e9e2ca44399f6266bf6a3514d5\",\"assetName\":\" 02 - SPI\",\"aspect\":\"status\",\"aspectName\":\"status\",\"variables\":[{\"name\":\"health\",\"variableId\":\"health\"}]}","assetName":"","aspectName":"","x":480,"y":100,"wires":[["7ce54828.d041b8"]]},{"id":"fd9fdac7.0354f8","type":"read-static","z":"5be3cc14.887c04","name":"GetState - SMT placing","topic":"654ed7ea2959458aab7c03c193a8f26c/status/health","topicLabel":" 03 - SMT Placing Machine/status/health","topicData":"{\"asset\":\"654ed7ea2959458aab7c03c193a8f26c\",\"assetName\":\" 03 - SMT Placing Machine\",\"aspect\":\"status\",\"aspectName\":\"status\",\"variables\":[{\"name\":\"health\",\"variableId\":\"health\"}]}","assetName":"","aspectName":"","x":480,"y":140,"wires":[[]]},{"id":"947830cf.5e22b","type":"skills-response","z":"5be3cc14.887c04","name":"","x":870,"y":340,"wires":[]},{"id":"664fd81f.e9bda8","type":"skills-response","z":"5be3cc14.887c04","name":"","x":870,"y":520,"wires":[]},{"id":"3d6f959f.7298fa","type":"skills-response","z":"5be3cc14.887c04","name":"","x":870,"y":720,"wires":[]},{"id":"9a7e1783.227118","type":"skills-response","z":"5be3cc14.887c04","name":"","x":870,"y":940,"wires":[]},{"id":"a1cfcc0e.1a6ba","type":"skills-response","z":"5be3cc14.887c04","name":"","x":1170,"y":180,"wires":[]},{"id":"27594a3a.a9bf36","type":"skills-trigger","z":"5be3cc14.887c04","name":"TutorialGetEvents","key":"TutorialGetEvents","x":140,"y":340,"wires":[["fd433abe.409498","2dc82a7.c449dd6"]],"_type":"node"},{"id":"b99d207e.5e2cf","type":"skills-trigger","z":"5be3cc14.887c04","name":"TutorialGetCases","key":"TutorialGetCases","x":140,"y":520,"wires":[["dfcb337e.ed4be","e9d203c8.6d7cb"]],"_type":"node"},{"id":"cdd8aaa6.6b46a8","type":"skills-trigger","z":"5be3cc14.887c04","name":"TutorialGetEnergyCost","key":"TutorialGetEnergyCost","x":120,"y":720,"wires":[["72698c3e.68ef04","fa677422.d89a68"]],"_type":"node"},{"id":"d8573d58.4cc3e","type":"skills-trigger","z":"5be3cc14.887c04","name":"TutorialCreateNewCase","key":"TutorialCreateNewCase","x":120,"y":940,"wires":[["5baf2b33.9a1804","575f348a.7d35cc"]],"_type":"node"},{"id":"a1103b69.9e3c88","type":"skills-trigger","z":"5be3cc14.887c04","name":"TutorialGetPlantStatus","key":"TutorialGetPlantStatus","x":180,"y":60,"wires":[["90813164.81d28","e9edec7.ab28d1","d0a98426.c51c88"]],"_type":"node"},{"id":"317b3891.468918","type":"write-static","z":"5be3cc14.887c04","name":"Simulate SPI machine","topic":"bb3a49e9e2ca44399f6266bf6a3514d5/status/health","topicLabel":" 02 - SPI/status/health","topicData":"{\"asset\":\"bb3a49e9e2ca44399f6266bf6a3514d5\",\"assetName\":\" 02 - SPI\",\"aspect\":\"status\",\"aspectName\":\"status\",\"variables\":[{\"name\":\"health\",\"variableId\":\"health\"}]}","assetName":"","aspectName":"","x":1660,"y":120,"wires":[]},{"id":"c89fb8b2.214728","type":"write-static","z":"5be3cc14.887c04","name":"Simulate Stencil printer","topic":"1d22c207ccb34957962df3a005b2c89d/status/health","topicLabel":"01 - Stencil Printer/status/health","topicData":"{\"asset\":\"1d22c207ccb34957962df3a005b2c89d\",\"assetName\":\"01 - Stencil Printer\",\"aspect\":\"status\",\"aspectName\":\"status\",\"variables\":[{\"name\":\"health\",\"variableId\":\"health\"}]}","assetName":"","aspectName":"","x":1660,"y":80,"wires":[]},{"id":"96e682de.6e15f","type":"write-static","z":"5be3cc14.887c04","name":"Simulate SMT placing","topic":"654ed7ea2959458aab7c03c193a8f26c/status/health","topicLabel":" 03 - SMT Placing Machine/status/health","topicData":"{\"asset\":\"654ed7ea2959458aab7c03c193a8f26c\",\"assetName\":\" 03 - SMT Placing Machine\",\"aspect\":\"status\",\"aspectName\":\"status\",\"variables\":[{\"name\":\"health\",\"variableId\":\"health\"}]}","assetName":"","aspectName":"","x":1660,"y":160,"wires":[]}]