Skip to content

Node-RED Event Analytics Service

使用以下内容创建一个 .txt 文件:

[{"id":"6b537c88.7ef914","type":"inject","z":"46ca465d.0b46b8","name":"Duplicate removal body","topic":"","payload":"{ \"eventsMetadata\": { \"eventTextPropertyName\": \"text\", \"timeWindowLength\":5000 }, \"events\": [ { \"_time\": \"2017-10-01T12:00:00.001Z\", \"text\": \"INTRODUCING FUEL\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:01.001Z\", \"text\": \"Status@Flame On\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:01.081Z\", \"text\": \"Status@Flame On\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:02.001Z\", \"text\": \"Status@Flame Off\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:04.091Z\", \"text\": \"Error code:340\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:03.001Z\", \"text\": \"Error code:340\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:04.001Z\", \"text\": \"Error code:340\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:04.061Z\", \"text\": \"Error code:340\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:05.001Z\", \"text\": \"Error code:340\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:06.001Z\", \"text\": \"INTRODUCING FUEL\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:06.231Z\", \"text\": \"INTRODUCING FUEL\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:08.001Z\", \"text\": \"Status@Flame On\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:09.001Z\", \"text\": \"Status@Flame On\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:09.231Z\", \"text\": \"INTRODUCING FUEL\", \"text_qc\":0 } ] }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":320,"wires":[["8e059f82.8db47","40cd04f5.47f7dc"]]},{"id":"a08e63cb.ee679","type":"debug","z":"46ca465d.0b46b8","name":"Duplicate removal respoonse","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1160,"y":200,"wires":[]},{"id":"8296de56.f415b","type":"debug","z":"46ca465d.0b46b8","name":"Event count response","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","x":1130,"y":400,"wires":[]},{"id":"8e059f82.8db47","type":"debug","z":"46ca465d.0b46b8","name":"Input Body","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":350,"y":400,"wires":[]},{"id":"ecfab80d.dcbb58","type":"function","z":"46ca465d.0b46b8","name":"headers","func":"msg.headers = {};\n\nmsg.headers['Cookie'] = 'SESSION=' + global.get('SESSION') + '; XSRF-TOKEN=' + global.get('XSRF-TOKEN')\nmsg.headers['X-XSRF-TOKEN'] = global.get('XSRF-TOKEN');\nmsg.headers['Content-Type']= 'application/json' \n\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":320,"wires":[["ddf4019c.b6ddf","7240086f.5e65c8"]]},{"id":"40cd04f5.47f7dc","type":"function","z":"46ca465d.0b46b8","name":"SET SESSION+XSRf-TOKEN","func":"global.set('SESSION', '8fb587f3-a5fd-4d52-99dc-1c6c6cfdbdc6')\nglobal.set('XSRF-TOKEN', '5cf53f87-3ce8-4080-bae2-48d28ac98c0a')\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":320,"wires":[["ecfab80d.dcbb58"]]},{"id":"ddf4019c.b6ddf","type":"www-request","z":"46ca465d.0b46b8","name":"Duplicate Events Removal","method":"POST","ret":"obj","url":"https://tide1-analytics.eu1-int.mindsphere.io/api/eventremoval/v3/duplicateEventRemoval ","follow-redirects":true,"tls":"","x":860,"y":200,"wires":[["a08e63cb.ee679"]]},{"id":"7240086f.5e65c8","type":"www-request","z":"46ca465d.0b46b8","name":"Event Count","method":"POST","ret":"obj","url":"https://tide1-analytics.eu1-int.mindsphere.io/api/eventcount/v3/eventCount","follow-redirects":true,"tls":"","x":790,"y":400,"wires":[["8296de56.f415b"]]},{"id":"952a8772.16be18","type":"inject","z":"46ca465d.0b46b8","name":"Event Search Body","topic":"","payload":"{ \"eventsMetadata\": { \"eventTextPropertyName\": \"text\" }, \"events\": [ { \"_time\": \"2017-10-01T12:00:00.001Z\", \"text\": \"INTRODUCING FUEL\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:01.001Z\", \"text\": \"Status@Flame On\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:02.001Z\", \"text\": \"Status@Flame Off\", \"text_qc\":0 }, { \"_time\": \"2017-10-01T12:00:03.001Z\", \"text\": \"Error code:340\", \"text_qc\":0 } ], \"ignoreList\": [ \"INTRODUCING FUEL\", \"MEANINGLESS ALARM\", \"Status@Flame On\" ] }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["856fb4b.09df448","6b57f9b9.754a38"]]},{"id":"856fb4b.09df448","type":"function","z":"46ca465d.0b46b8","name":"SET SESSION+XSRf-TOKEN","func":"global.set('SESSION', '8fb587f3-a5fd-4d52-99dc-1c6c6cfdbdc6')\nglobal.set('XSRF-TOKEN', '5cf53f87-3ce8-4080-bae2-48d28ac98c0a')\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":100,"wires":[["8b9558b8.099528"]]},{"id":"8b9558b8.099528","type":"function","z":"46ca465d.0b46b8","name":"headers","func":"msg.headers = {};\n\nmsg.headers['Cookie'] = 'SESSION=' + global.get('SESSION') + '; XSRF-TOKEN=' + global.get('XSRF-TOKEN')\nmsg.headers['X-XSRF-TOKEN'] = global.get('XSRF-TOKEN');\nmsg.headers['Content-Type']= 'application/json' \n\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":100,"wires":[["b131fc5.f1434"]]},{"id":"6b57f9b9.754a38","type":"debug","z":"46ca465d.0b46b8","name":"Input Body","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":350,"y":160,"wires":[]},{"id":"b131fc5.f1434","type":"www-request","z":"46ca465d.0b46b8","name":"Event Search","method":"POST","ret":"obj","url":"https://tide1-analytics.eu1-int.mindsphere.io/api/eventsSearch/v3/eventSearch","follow-redirects":true,"tls":"","x":820,"y":100,"wires":[["cbb6ba7e.0bc198"]]},{"id":"cbb6ba7e.0bc198","type":"debug","z":"46ca465d.0b46b8","name":"Events search response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1110,"y":80,"wires":[]}]

Last update: January 15, 2024