NodeRED for EdgeSense

From ESS-WIKI
Revision as of 07:03, 15 January 2019 by Eric.liang (talk | contribs) (Created page with "= Introduction =  This page description of Node-RED example and resources.  User can easy to monitor, debug, rule engine with Node-RED on EdgeSense....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

 This page description of Node-RED example and resources.  User can easy to monitor, debug, rule engine with Node-RED on EdgeSense.

Northbound

WISE-Agent 2.0

Simulator

Monitor Cloud's RabbitMQ

WISE-Agent3.3

Simulator

Monitor

Southbound

Monitor Service ( local MQTT Broker )

[{"id":"ae89f488.4b2a38","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/deviceinfo","qos":"0","broker":"d67ba72f.cb57f8","x":163,"y":162,"wires":[["ac9d2218.62c74"]]},{"id":"11099cb8.38b4d3","type":"inject","z":"5fb6fbab.f972b4","name":"","topic":"Set Global Variable","payload":"","payloadType":"str","repeat":"36000","crontab":"","once":true,"x":184,"y":81,"wires":[["5e27e7c5.1bd008"]]},{"id":"5e27e7c5.1bd008","type":"function","z":"5fb6fbab.f972b4","name":"","func":"context.global.devID='Simulator';\ncontext.global.All = 0;\n","outputs":1,"noerr":0,"x":390,"y":81,"wires":[[]]},{"id":"e7d4471a.4e0998","type":"comment","z":"5fb6fbab.f972b4","name":"Monitor Auto Report","info":"","x":641,"y":113,"wires":[]},{"id":"f9760d29.433ef","type":"debug","z":"5fb6fbab.f972b4","name":"Auto Report","active":true,"console":"false","complete":"payload","x":652,"y":162,"wires":[]},{"id":"82a66f7.b8bdd9","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/agentinfoack","qos":"0","broker":"d67ba72f.cb57f8","x":158,"y":290,"wires":[["835e7140.2a2a1"]]},{"id":"8a2adf4.f4da52","type":"comment","z":"5fb6fbab.f972b4","name":"Connect / Disconnect","info":"","x":640,"y":236,"wires":[]},{"id":"41860482.dc197c","type":"debug","z":"5fb6fbab.f972b4","name":"Connect","active":true,"console":"false","complete":"payload","x":659,"y":292,"wires":[]},{"id":"20a240d3.ecf8","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/agentactionreq","qos":"0","broker":"d67ba72f.cb57f8","x":153,"y":403,"wires":[["2abd4c34.c2bdb4"]]},{"id":"19184cf1.5f5823","type":"comment","z":"5fb6fbab.f972b4","name":"OS Info / InfoSpec / Reply ( Get, Set )","info":"","x":594,"y":353,"wires":[]},{"id":"89274.64fc7d8c8","type":"debug","z":"5fb6fbab.f972b4","name":"OS/InfoSpec/Reply","active":true,"console":"false","complete":"payload","x":626,"y":402,"wires":[]},{"id":"d453829.9e8f08","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/willmessage","qos":"0","broker":"d67ba72f.cb57f8","x":164,"y":504,"wires":[["99520461.c98918"]]},{"id":"6d9e5cc2.3a4214","type":"comment","z":"5fb6fbab.f972b4","name":"Will Msg","info":"","x":682,"y":459,"wires":[]},{"id":"1505a2ec.a8e73d","type":"debug","z":"5fb6fbab.f972b4","name":"Will Msg","active":true,"console":"false","complete":"payload","x":653,"y":504,"wires":[]},{"id":"15fea8db.b4d6c7","type":"comment","z":"5fb6fbab.f972b4","name":"Config - Service Name","info":"","x":245,"y":31,"wires":[]},{"id":"fe21d1fd.b7959","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":" /cagent/admin/+/agentcallbackreq","qos":"0","broker":"d67ba72f.cb57f8","x":169,"y":625,"wires":[["54f161ce.e7ef3"]]},{"id":"e7b53a18.ecb898","type":"comment","z":"5fb6fbab.f972b4","name":"Get / Set  Cmd","info":"","x":666,"y":573,"wires":[]},{"id":"414b68b2.7dd3d8","type":"debug","z":"5fb6fbab.f972b4","name":"Get / Set","active":true,"console":"false","complete":"payload","x":654,"y":627,"wires":[]},{"id":"ac9d2218.62c74","type":"function","z":"5fb6fbab.f972b4","name":"","func":"if(context.global.All == 1 || msg.topic.indexOf(context.global.devID)>-1)\n    return msg;","outputs":1,"noerr":0,"x":397,"y":162,"wires":[["f9760d29.433ef"]]},{"id":"835e7140.2a2a1","type":"function","z":"5fb6fbab.f972b4","name":"","func":"if(context.global.All == 1 || msg.topic.indexOf(context.global.devID)>-1)\n    return msg;","outputs":1,"noerr":0,"x":403,"y":291,"wires":[["41860482.dc197c"]]},{"id":"2abd4c34.c2bdb4","type":"function","z":"5fb6fbab.f972b4","name":"","func":"if(context.global.All == 1 || msg.topic.indexOf(context.global.devID)>-1)\n    return msg;","outputs":1,"noerr":0,"x":400,"y":403,"wires":[["89274.64fc7d8c8"]]},{"id":"99520461.c98918","type":"function","z":"5fb6fbab.f972b4","name":"","func":"if(context.global.All == 1 || msg.topic.indexOf(context.global.devID)>-1)\n    return msg;","outputs":1,"noerr":0,"x":398,"y":504,"wires":[["1505a2ec.a8e73d"]]},{"id":"54f161ce.e7ef3","type":"function","z":"5fb6fbab.f972b4","name":"","func":"if(context.global.All == 1 || msg.topic.indexOf(context.global.devID)>-1)\n    return msg;","outputs":1,"noerr":0,"x":399,"y":626,"wires":[["414b68b2.7dd3d8"]]},{"id":"d67ba72f.cb57f8","type":"mqtt-broker","z":"","broker":"172.22.12.213","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

Control Service ( by local MQTT broker )

[{"id":"6dfc8599.6c3d1c","type":"function","z":"f560a871.91f588","name":"","func":"\nmsg.topic='/cagent/admin/AAAAA/agentcallbackreq';\nmsg.topic=msg.topic.replace(/AAAAA/g, context.global.CtlDevID);\nmsg.payload='{\"susiCommData\":{\"commCmd\":2053,\"requestItems\":{\"All\":{}},\"autoUploadIntervalSec\":10,\"handlerName\":\"general\"}}';\nreturn msg;","outputs":1,"noerr":0,"x":361,"y":233,"wires":[["790269c3.c30e88","7210ad86.d7ca84"]]},{"id":"790269c3.c30e88","type":"mqtt out","z":"f560a871.91f588","name":"","topic":"","qos":"","retain":"","broker":"d67ba72f.cb57f8","x":589,"y":234,"wires":[]},{"id":"99fff11a.682e5","type":"comment","z":"f560a871.91f588","name":"Enable Auto Report","info":"","x":439,"y":166,"wires":[]},{"id":"28cbe991.433636","type":"inject","z":"f560a871.91f588","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":147,"y":234,"wires":[["6dfc8599.6c3d1c"]]},{"id":"7210ad86.d7ca84","type":"debug","z":"f560a871.91f588","name":"","active":false,"console":"false","complete":"false","x":560,"y":313,"wires":[]},{"id":"956b099f.cb56e8","type":"function","z":"f560a871.91f588","name":"","func":"\nmsg.topic='/cagent/admin/AAAAA/agentcallbackreq';\nmsg.topic=msg.topic.replace(/AAAAA/g, context.global.CtlDevID);\nmsg.payload='{\"susiCommData\":{\"requestID\":1001,\"catalogID\":4,\"commCmd\":2056,\"handlerName\":\"general\",\"requestItems\":{\"All\":{}}}}';\nreturn msg;","outputs":1,"noerr":0,"x":338,"y":443,"wires":[["3f629bb0.f335c4","79fc41cd.0ee99"]]},{"id":"3f629bb0.f335c4","type":"mqtt out","z":"f560a871.91f588","name":"","topic":"","qos":"","retain":"","broker":"d67ba72f.cb57f8","x":566,"y":444,"wires":[]},{"id":"6afc7182.8070d","type":"comment","z":"f560a871.91f588","name":"Stop Auto Report","info":"","x":406,"y":376,"wires":[]},{"id":"f5440d41.c0573","type":"inject","z":"f560a871.91f588","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":131,"y":433,"wires":[["956b099f.cb56e8"]]},{"id":"79fc41cd.0ee99","type":"debug","z":"f560a871.91f588","name":"","active":false,"console":"false","complete":"false","x":537,"y":523,"wires":[]},{"id":"b333d18e.7bda","type":"inject","z":"f560a871.91f588","name":"","topic":"Set Global Variable","payload":"","payloadType":"str","repeat":"36000","crontab":"","once":true,"x":153,"y":70,"wires":[["2a3478b2.a807c8"]]},{"id":"2a3478b2.a807c8","type":"function","z":"f560a871.91f588","name":"","func":"context.global.CtlDevID='Simulator';\n\n","outputs":1,"noerr":0,"x":359,"y":70,"wires":[[]]},{"id":"7cf6dfcc.657e1","type":"comment","z":"f560a871.91f588","name":"Config - Service Name","info":"","x":226,"y":27,"wires":[]},{"id":"d67ba72f.cb57f8","type":"mqtt-broker","z":"","broker":"172.22.12.213","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]