Skip to content

Node-RED 模式匹配

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

[{"id":"297a307b.6635c","type":"inject","z":"81541aa1.954638","name":"Pattern Matching Input Body","topic":"","payload":"{ \t\"maxIntervalLength\":2000, \t\"patternsList\": [{ \t\t\t\"pattern\": [{ \t\t\t\t\t\"eventDescription\": \"Start Turbine\", \t\t\t\t\t\"minRepetitions\":1, \t\t\t\t\t\"maxRepetitions\":1 \t\t\t\t}, { \t\t\t\t\t\"eventDescription\": \"Rising Temperature\", \t\t\t\t\t\"minRepetitions\":1, \t\t\t\t\t\"maxRepetitions\":2 \t\t\t\t}, { \t\t\t\t\t\"eventDescription\": \"Warning Message\", \t\t\t\t\t\"minRepetitions\":0, \t\t\t\t\t\"maxRepetitions\":1 \t\t\t\t} \t\t\t] \t\t}, \t\t{ \t\t\t\"pattern\": [{ \t\t\t\t\t\"eventDescription\": \"Start Engine\", \t\t\t\t\t\"minRepetitions\":0, \t\t\t\t\t\"maxRepetitions\":1 \t\t\t\t}, { \t\t\t\t\t\"eventDescription\": \"Rising Temperature\", \t\t\t\t\t\"minRepetitions\":1, \t\t\t\t\t\"maxRepetitions\":1 \t\t\t\t} \t\t\t] \t\t} \t], \t\"eventsInput\": { \t\t\"eventsMetadata\": { \t\t\t\"eventTextPropertyName\": \"text\" \t\t}, \t\t\"events\": [{ \t\t\t\t\"_time\": \"2017-10-01T12:00:00.001Z\", \t\t\t\t\"text\": \"Start Turbine\", \t\t\t\t\"text_qc\":0 \t\t\t}, { \t\t\t\t\"_time\": \"2017-10-01T12:00:01.001Z\", \t\t\t\t\"text\": \"Status Msg\", \t\t\t\t\"text_qc\":0 \t\t\t}, { \t\t\t\t\"_time\": \"2017-10-01T12:00:03.001Z\", \t\t\t\t\"text\": \"Rising Temperature\", \t\t\t\t\"text_qc\":0 \t\t\t}, { \t\t\t\t\"_time\": \"2017-10-01T12:00:06.001Z\", \t\t\t\t\"text\": \"Warning Message\", \t\t\t\t\"text_qc\":0 \t\t\t}, { \t\t\t\t\"_time\": \"2017-10-01T12:00:07.001Z\", \t\t\t\t\"text\": \"Start Turbine\", \t\t\t\t\"text_qc\":0 \t\t\t}, { \t\t\t\t\"_time\": \"2017-10-01T12:00:08.001Z\", \t\t\t\t\"text\": \"Start Engine\", \t\t\t\t\"text_qc\":0 \t\t\t}, { \t\t\t\t\"_time\": \"2017-10-01T12:00:09.001Z\", \t\t\t\t\"text\": \"Start Engine\", \t\t\t\t\"text_qc\":0 \t\t\t}, { \t\t\t\t\"_time\": \"2017-10-01T12:00:10.001Z\", \t\t\t\t\"text\": \"Rising Temperature\", \t\t\t\t\"text_qc\":0 \t\t\t} \t\t] \t} }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":80,"wires":[["d834adbc.008b","9125af79.cf7f2"]]},{"id":"d834adbc.008b","type":"function","z":"81541aa1.954638","name":"SET SESSION+XSRf-TOKEN","func":"global.set('SESSION', '7daa20f5-3cbb-4f2b-9cc5-358340bfc887')\nglobal.set('XSRF-TOKEN', '21d3ebbd-4b5a-4ada-83a5-bd5467365aa7')\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":140,"wires":[["adaaa1ed.4d5bb"]]},{"id":"adaaa1ed.4d5bb","type":"function","z":"81541aa1.954638","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":580,"y":140,"wires":[["2392577d.f32018"]]},{"id":"9125af79.cf7f2","type":"debug","z":"81541aa1.954638","name":"Pattern Matching Input Body","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":320,"y":20,"wires":[]},{"id":"2392577d.f32018","type":"www-request","z":"81541aa1.954638","name":"Pattern Matching","method":"POST","ret":"obj","url":"https://tide1-analytics.eu1-int.mindsphere.io/api/patternMatching_int/v3/patternMatching ","follow-redirects":true,"tls":"","x":770,"y":140,"wires":[["e89095e7.0c07e8"]]},{"id":"e89095e7.0c07e8","type":"debug","z":"81541aa1.954638","name":"Pattern Matching response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":740,"y":20,"wires":[]}]

还有问题?

向社区提问


除非另行声明,该网站内容遵循MindSphere开发许可协议.


Last update: April 24, 2019