NodeRED for EdgeSense

From ESS-WIKI
Jump to: navigation, search

Introduction

 This page provide lots of Node-RED sample flows and resources. User can use these to monitor, debug trace, and integrate southbound sensor data with its applicaton at EdgeSense.

Northbound

WISE-Agent 2.0

Simulator

[{"id":"e4d2ce8e.81f9f","type":"mqtt out","z":"49cff277.82c7dc","name":"WISE-PaaS (V)","topic":"","qos":"0","retain":"","broker":"7c54e18.cf0132","x":1148.0000267028809,"y":351.00001668930054,"wires":[]},{"id":"1eb7b8.760ab849","type":"delay","z":"49cff277.82c7dc","name":"1 sec","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":298.0000343322754,"y":300.00000381469727,"wires":[["6264f766.cd2b78"]]},{"id":"9d4594e9.806418","type":"function","z":"49cff277.82c7dc","name":"Connect Info","func":"msg.payload='{\"content\":{\"parentID\":\"\",\"hostname\":\"ESL_GW\",\"sn\":\"AAAAA\",\"mac\":\"00:0B:AB:6F:37:52\",\"version\":\"1.0.6.0\",\"type\":\"IoTGW\",\"product\":\"ESL-GW\",\"manufacture\":\"\",\"account\":\"\",\"passwd\":\"\",\"status\":1,\"tag\":\"RMM\"},\"commCmd\":1,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":{\"$date\":1510044370561}}';\nreturn msg;","outputs":1,"noerr":0,"x":453.000057220459,"y":132.99999237060547,"wires":[["d2e91f81.780bb"]]},{"id":"6264f766.cd2b78","type":"function","z":"49cff277.82c7dc","name":"OS Info","func":"msg.payload='{\"content\":{\"cagentVersion\":\"1.0.6.0\",\"cagentType\":\"IoTGW\",\"osVersion\":\"OpenWRT\",\"biosVersion\":\"V1.10\",\"platformName\":\"WISE-3610\",\"processorName\":\"ARMv7\",\"osArch\":\"arm\",\"totalPhysMemKB\":1973544,\"macs\":\"00:0B:AB:6F:37:52\",\"IP\":\"172.22.12.84\"},\"commCmd\":116,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":{\"$date\":1510044371812}}';\nreturn msg;","outputs":1,"noerr":0,"x":477.0000305175781,"y":300,"wires":[["2ee11ff8.29e59"]]},{"id":"f2580d9e.36c8c","type":"delay","z":"49cff277.82c7dc","name":"20 ms","pauseType":"delay","timeout":"20","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":317.0000305175781,"y":564,"wires":[["1625932.c45bc6d"]]},{"id":"4a4f0a7f.f07ab4","type":"delay","z":"49cff277.82c7dc","name":"1.2 s","pauseType":"delay","timeout":"1.2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":290.0000343322754,"y":429.00000381469727,"wires":[["e9be7f96.c2ff","f2580d9e.36c8c"]]},{"id":"5166e7c5.7f5018","type":"comment","z":"49cff277.82c7dc","name":"WISEAgent Connect","info":"","x":457.00007247924805,"y":80.99999237060547,"wires":[]},{"id":"ed5d09ac.d65778","type":"comment","z":"49cff277.82c7dc","name":"Capability","info":"","x":476.0000343322754,"y":375.00000381469727,"wires":[]},{"id":"1cce8104.0bc29f","type":"inject","z":"49cff277.82c7dc","name":"GW","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":68.00002670288086,"y":301,"wires":[["1eb7b8.760ab849","d9aac722.867a08","4a4f0a7f.f07ab4"]]},{"id":"2ee11ff8.29e59","type":"function","z":"49cff277.82c7dc","name":"RMM/agentactionreq","func":"msg.topic=context.global.rmmtopicprefix+'agentactionack';\nreturn msg;","outputs":1,"noerr":0,"x":733,"y":431,"wires":[["91b9830c.978f6"]]},{"id":"d2e91f81.780bb","type":"function","z":"49cff277.82c7dc","name":"agentinfoack","func":"msg.topic=context.global.topicprefix+'agentinfoack';\nreturn msg;","outputs":1,"noerr":0,"x":716.9999389648438,"y":132.99998474121094,"wires":[["91b9830c.978f6"]]},{"id":"80510e8c.5a02b","type":"comment","z":"49cff277.82c7dc","name":"Topic","info":"","x":687,"y":82,"wires":[]},{"id":"e9be7f96.c2ff","type":"function","z":"49cff277.82c7dc","name":"InfoSpec","func":"msg.payload='{\"content\":{\"IoTGW\":{\"Zigbee\":{\"00124b00043a9749\":{\"Info\":{\"e\":[{\"n\":\"DeviceList\",\"sv\":\"\",\"asm\":\"r\"},{\"n\":\"premit-tag-list\",\"sv\":\"\",\"asm\":\"rw\"},{\"n\":\"pan-id\",\"v\":1,\"asm\":\"r\"},{\"n\":\"zd-fw-version\",\"v\":1,\"asm\":\"r\"},{\"n\":\"reboot\",\"bv\":0,\"asm\":\"rw\"}],\"bn\":\"Info\"},\"bn\":\"00124b00043a9749\",\"ver\":1},\"bn\":\"Zigbee\"},\"ver\":1,\"bn\":\"IoTGW\",\"opTS\":{\"$date\":160081024}}},\"commCmd\":2052,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":{\"$date\":160081024}}';\nreturn msg;","outputs":1,"noerr":0,"x":458.0000343322754,"y":429.00000381469727,"wires":[["2ee11ff8.29e59"]]},{"id":"1625932.c45bc6d","type":"function","z":"49cff277.82c7dc","name":"Data","func":"msg.payload='{\"content\":{\"IoTGW\":{\"Zigbee\":{\"00124b00043a9749\":{\"Info\":{\"e\":[{\"n\":\"DeviceList\",\"sv\":\"00000050BA485303,00000034115521a4\",\"asm\":\"r\"},{\"n\":\"premit-tag-list\",\"sv\":\"50c27710425a5347,50c27710425a5348,0000001077C25001\",\"asm\":\"rw\"},{\"n\":\"pan-id\",\"v\":1,\"asm\":\"r\"},{\"n\":\"zd-fw-version\",\"v\":1,\"asm\":\"r\"},{\"n\":\"reboot\",\"bv\":0,\"asm\":\"rw\"}],\"bn\":\"Info\"},\"bn\":\"00124b00043a9749\",\"ver\":1},\"bn\":\"Zigbee\"},\"HostGateway\":\"\",\"ver\":1,\"bn\":\"IoTGW\",\"opTS\":{\"$date\":160081024}}},\"commCmd\":2055,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":{\"$date\":160081024}}';\nreturn msg;","outputs":1,"noerr":0,"x":468.0000305175781,"y":568,"wires":[["27e553a3.e89cac"]]},{"id":"91b9830c.978f6","type":"function","z":"49cff277.82c7dc","name":"Replace","func":"//msg.deviceID='000BABBB91CC';\n// 0000000BABBB91CC\n\n\n\n//msg.topicprefix='/cagent/admin/0000'+msg.deviceID+'/';\n\nmsg.payload=msg.payload.replace(/AAAAA/g, context.global.devID);\nmsg.payload=msg.payload.replace(/BBBBB/g, context.global.devID);\nreturn msg;","outputs":1,"noerr":0,"x":966,"y":256.9999694824219,"wires":[["e4d2ce8e.81f9f","43460db6.7178e4"]]},{"id":"fb87efe.c27d51","type":"comment","z":"49cff277.82c7dc","name":"Replace AgentID","info":"","x":978.9999656677246,"y":79,"wires":[]},{"id":"d70a7f51.a697","type":"comment","z":"49cff277.82c7dc","name":"Update Value","info":"","x":477.0000343322754,"y":512.0000038146973,"wires":[]},{"id":"43460db6.7178e4","type":"debug","z":"49cff277.82c7dc","name":"","active":true,"console":"false","complete":"true","x":1133,"y":256.00001525878906,"wires":[]},{"id":"d9aac722.867a08","type":"function","z":"49cff277.82c7dc","name":"deviceID ( V )","func":"context.global.devID='00000001-0000-0000-0000-017E40000001';\n// 0000-017E40000001\n\ncontext.global.topicprefix='/wisepaas/device/'+context.global.devID+'/';\ncontext.global.rmmtopicprefix='/wisepaas/RMM/'+context.global.devID+'/';\nreturn msg;\n\n\n","outputs":1,"noerr":0,"x":213.00001907348633,"y":132.9999885559082,"wires":[["9d4594e9.806418"]]},{"id":"27e553a3.e89cac","type":"function","z":"49cff277.82c7dc","name":"deviceinfoack ","func":"msg.topic=context.global.topicprefix+'deviceinfoack';\nreturn msg;","outputs":1,"noerr":0,"x":726,"y":570,"wires":[["91b9830c.978f6"]]},{"id":"7c54e18.cf0132","type":"mqtt-broker","z":"","broker":"172.22.12.175","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""}]

Monitor Cloud's RabbitMQ

[{"id":"30d8bbc3.e67b14","type":"mqtt in","z":"c13388c1.6aa6e8","name":"/wisepaas/RMM/+/agentactionreq","topic":"/wisepaas/RMM/+/agentactionreq","qos":"2","broker":"45053fd0.b0e64","x":190,"y":120,"wires":[["902878f1.d33a48","428e36f2.7721d8"]]},{"id":"902878f1.d33a48","type":"switch","z":"c13388c1.6aa6e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"commCmd\":523,","vt":"str"}],"checkall":"true","outputs":1,"x":410,"y":120,"wires":[["613d2f75.e28de"]]},{"id":"613d2f75.e28de","type":"debug","z":"c13388c1.6aa6e8","name":"","active":false,"console":"false","complete":"false","x":590,"y":120,"wires":[]},{"id":"f6d51781.f082f8","type":"mqtt in","z":"c13388c1.6aa6e8","name":"/wisepaas/RMM/+/agentactionack","topic":"/wisepaas/RMM/+/agentactionack","qos":"2","broker":"45053fd0.b0e64","x":190,"y":380,"wires":[["b9c406cc.4e6748","a2e61c64.cb8da"]]},{"id":"29156b0e.d08534","type":"debug","z":"c13388c1.6aa6e8","name":"","active":false,"console":"false","complete":"false","x":590,"y":380,"wires":[]},{"id":"b9c406cc.4e6748","type":"switch","z":"c13388c1.6aa6e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"commCmd\":524,","vt":"str"}],"checkall":"true","outputs":1,"x":410,"y":380,"wires":[["29156b0e.d08534"]]},{"id":"a2e61c64.cb8da","type":"debug","z":"c13388c1.6aa6e8","name":"","active":true,"console":"false","complete":"false","x":430,"y":480,"wires":[]},{"id":"428e36f2.7721d8","type":"debug","z":"c13388c1.6aa6e8","name":"","active":true,"console":"false","complete":"false","x":450,"y":240,"wires":[]},{"id":"df103270.4c0ef","type":"comment","z":"c13388c1.6aa6e8","name":"OS Info / InfoSpec / ...  Requests","info":"","x":510,"y":200,"wires":[]},{"id":"d54a74cb.17da48","type":"comment","z":"c13388c1.6aa6e8","name":"Get, Set Data Request","info":"","x":620,"y":80,"wires":[]},{"id":"e1a26eb6.2f247","type":"comment","z":"c13388c1.6aa6e8","name":"Get, Set Data Reply","info":"","x":610,"y":340,"wires":[]},{"id":"420c7f01.7e267","type":"comment","z":"c13388c1.6aa6e8","name":"OS Info / InfoSpec / Report Data ...","info":"","x":500,"y":440,"wires":[]},{"id":"45053fd0.b0e64","type":"mqtt-broker","z":"","broker":"wise-msghub.eastasia.cloudapp.azure.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

WISE-Agent3.3

Simulator

[{"id":"d8e8833e.7baf","type":"mqtt out","z":"fde929ec.69cc38","name":"WISE-PaaS (V)","topic":"","qos":"0","retain":"","broker":"7c54e18.cf0132","x":1158.9999923706055,"y":338.00001287460327,"wires":[]},{"id":"b935a416.695758","type":"delay","z":"fde929ec.69cc38","name":"1 sec","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":309,"y":287,"wires":[["810a3dcc.ee96"|"810a3dcc.ee96"]]},{"id":"5e970d04.4e1f44","type":"function","z":"fde929ec.69cc38","name":"Connect Info","func":"msg.payload='{\"susiCommData\":{\"devID\":\"AAAAA\",\"hostname\":\"ESL_GW\",\"sn\":\"BBBBB\",\"mac\":\"BBBBB\",\"version\":\"3.1.23\",\"type\":\"IoTGW\",\"product\":\"ESL-GW\",\"manufacture\":\"\",\"status\":\"1\",\"commCmd\":1,\"requestID\":30002,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":160081026}}';\nreturn msg;","outputs":1,"noerr":0,"x":464.0000228881836,"y":119.9999885559082,"wires":[["9c649db2.be9b7"|"9c649db2.be9b7"]]},{"id":"810a3dcc.ee96","type":"function","z":"fde929ec.69cc38","name":"OS Info","func":"msg.payload='{\"susiCommData\":{\"osInfo\":{\"cagentVersion\":\"3.1.23\",\"cagentType\":\"IoTGW\",\"osVersion\":\"OpenWRT\",\"biosVersion\":\"\",\"platformName\":\"\",\"processorName\":\"WISEAgent\",\"osArch\":\"ARMv7\",\"totalPhysMemKB\":123,\"macs\":\"AAAAA\",\"IP\":\"192.168.0.10\"},\"commCmd\":116,\"requestID\":109,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":1466730390}}';\nreturn msg;","outputs":1,"noerr":0,"x":541,"y":288,"wires":[["33b9c533.5ed11a"|"33b9c533.5ed11a"]]},{"id":"813c1537.5e5e58","type":"delay","z":"fde929ec.69cc38","name":"20 ms","pauseType":"delay","timeout":"20","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":329,"y":546,"wires":[["d2233f9f.791a7"|"d2233f9f.791a7"]]},{"id":"24175ea.ac3c8a2","type":"delay","z":"fde929ec.69cc38","name":"1.2 s","pauseType":"delay","timeout":"1.2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":301,"y":416,"wires":[["9a13262e.a0d048","813c1537.5e5e58"|"9a13262e.a0d048","813c1537.5e5e58"]]},{"id":"44102883.d70b18","type":"comment","z":"fde929ec.69cc38","name":"WISEAgent Connect","info":"","x":468.00003814697266,"y":67.9999885559082,"wires":[]},{"id":"657a55d2.0151dc","type":"comment","z":"fde929ec.69cc38","name":"Capability","info":"","x":487,"y":362,"wires":[]},{"id":"b55d1b70.8e93c8","type":"inject","z":"fde929ec.69cc38","name":"GW Connect","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":98.99999237060547,"y":287.99999618530273,"wires":[["b935a416.695758","370e2543.81d80a","24175ea.ac3c8a2"|"b935a416.695758","370e2543.81d80a","24175ea.ac3c8a2"]]},{"id":"7f44c5e2.ab26ac","type":"function","z":"fde929ec.69cc38","name":"deviceinfo","func":"msg.topic=context.global.topicprefix+'deviceinfo';\nreturn msg;\n","outputs":1,"noerr":0,"x":745,"y":546.9999389648438,"wires":[["f1bdd2d0.c2df3"|"f1bdd2d0.c2df3"]]},{"id":"33b9c533.5ed11a","type":"function","z":"fde929ec.69cc38","name":"agentactionreq","func":"msg.topic=context.global.topicprefix+'agentactionreq';\nreturn msg;","outputs":1,"noerr":0,"x":731.9999580383301,"y":341,"wires":[["f1bdd2d0.c2df3"|"f1bdd2d0.c2df3"]]},{"id":"9c649db2.be9b7","type":"function","z":"fde929ec.69cc38","name":"agentinfoack","func":"msg.topic=context.global.topicprefix+'agentinfoack';\nreturn msg;","outputs":1,"noerr":0,"x":730.999927520752,"y":122.99997901916504,"wires":[["f1bdd2d0.c2df3"|"f1bdd2d0.c2df3"]]},{"id":"182e9ad6.a5e185","type":"comment","z":"fde929ec.69cc38","name":"RMM Topic","info":"","x":707.9999656677246,"y":68.99999618530273,"wires":[]},{"id":"9a13262e.a0d048","type":"function","z":"fde929ec.69cc38","name":"GW InfoSpec","func":"msg.payload='{\"susiCommData\":{\"infoSpec\":{\"IoTGW\":{\"Zigbee\":{\"00124b00043a9749\":{\"Info\":{\"e\":[{\"n\":\"DeviceList\",\"sv\":\"\",\"asm\":\"r\"},{\"n\":\"premit-tag-list\",\"sv\":\"\",\"asm\":\"rw\"},{\"n\":\"pan-id\",\"v\":1,\"asm\":\"r\"},{\"n\":\"zd-fw-version\",\"v\":1,\"asm\":\"r\"},{\"n\":\"reboot\",\"bv\":0,\"asm\":\"rw\"}],\"bn\":\"Info\"},\"bn\":\"00124b00043a9749\",\"ver\":1},\"bn\":\"Zigbee\"},\"HostGateway\":\"\",\"ver\":1,\"bn\":\"IoTGW\",\"opTS\":{\"$date\":160081024}}},\"commCmd\":2052,\"requestID\":2001,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":160081024}}';\nreturn msg;","outputs":1,"noerr":0,"x":479,"y":416,"wires":[["33b9c533.5ed11a"|"33b9c533.5ed11a"]]},{"id":"d2233f9f.791a7","type":"function","z":"fde929ec.69cc38","name":"GW Data","func":"msg.payload='{\"susiCommData\":{\"data\":{\"IoTGW\":{\"Zigbee\":{\"00124b00043a9749\":{\"Info\":{\"e\":[{\"n\":\"DeviceList\",\"sv\":\"0000017E40000002,0000017E40000003\",\"asm\":\"r\"},{\"n\":\"premit-tag-list\",\"sv\":\"00554b00043a9755,00554b00043a9766,00554b00043a9777\",\"asm\":\"rw\"},{\"n\":\"pan-id\",\"v\":1,\"asm\":\"r\"},{\"n\":\"zd-fw-version\",\"v\":1,\"asm\":\"r\"},{\"n\":\"reboot\",\"bv\":0,\"asm\":\"rw\"}],\"bn\":\"Info\"},\"bn\":\"00124b00043a9749\",\"ver\":1},\"bn\":\"Zigbee\"},\"HostGateway\":\"\",\"ver\":1,\"bn\":\"IoTGW\",\"opTS\":{\"$date\":160081024}}},\"commCmd\":2055,\"requestID\":2001,\"agentID\":\"AAAAA\",\"handlerName\":\"general\",\"sendTS\":160081024}}';\nreturn msg;","outputs":1,"noerr":0,"x":487,"y":547,"wires":[["7f44c5e2.ab26ac"|"7f44c5e2.ab26ac"]]},{"id":"f1bdd2d0.c2df3","type":"function","z":"fde929ec.69cc38","name":"Replace","func":"//msg.deviceID='000BABBB91CC';\n// 0000000BABBB91CC\n\n\n\n//msg.topicprefix='/cagent/admin/0000'+msg.deviceID+'/';\n\nmsg.payload=msg.payload.replace(/AAAAA/g,context.global.devID);\nmsg.payload=msg.payload.replace(/BBBBB/g, context.global.devID);\nreturn msg;","outputs":1,"noerr":0,"x":971.999942779541,"y":338.9999752044678,"wires":[["d8e8833e.7baf","633d1beb.49cad4"|"d8e8833e.7baf","633d1beb.49cad4"]]},{"id":"6de6e236.fe33fc","type":"comment","z":"fde929ec.69cc38","name":"Replace AgentID","info":"","x":989.9999313354492,"y":65.99999618530273,"wires":[]},{"id":"9340b233.f258","type":"comment","z":"fde929ec.69cc38","name":"Update Value","info":"","x":488,"y":499,"wires":[]},{"id":"633d1beb.49cad4","type":"debug","z":"fde929ec.69cc38","name":"","active":true,"console":"false","complete":"true","x":1138.9999923706055,"y":251.00001287460327,"wires":[]},{"id":"370e2543.81d80a","type":"function","z":"fde929ec.69cc38","name":"deviceID ( V )","func":"context.global.devID='0000017E40000001';\n// 0000017E40000001\n\ncontext.global.topicprefix='/cagent/admin/'+context.global.devID+'/';\nreturn msg;\n\n\n","outputs":1,"noerr":0,"x":223.99998474121094,"y":119.99998474121094,"wires":[["5e970d04.4e1f44"|"5e970d04.4e1f44"]]},{"id":"7c54e18.cf0132","type":"mqtt-broker","z":"","broker":"172.22.12.45","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

Monitor

[{"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":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

Southbound

Monitor EdgeSense Service  ( local MQTT broker )  - v1.0.1

This Node-RED flows can monitor all or a southbound service with local MQTT Bus:

  • Auto Report Sensor Data
  • Connect and Disconnect Message 
  • Capability and Response of setting 
  • Get and Set command
  • Will Message
[{"id":"ae89f488.4b2a38","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/deviceinfo","qos":"0","broker":"d67ba72f.cb57f8","x":157,"y":236,"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":178,"y":155,"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":384,"y":155,"wires":[[]]},{"id":"e7d4471a.4e0998","type":"comment","z":"5fb6fbab.f972b4","name":"Monitor Auto Report","info":"","x":635,"y":187,"wires":[]},{"id":"f9760d29.433ef","type":"debug","z":"5fb6fbab.f972b4","name":"Auto Report","active":true,"console":"false","complete":"payload","x":646,"y":236,"wires":[]},{"id":"82a66f7.b8bdd9","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/agentinfoack","qos":"0","broker":"d67ba72f.cb57f8","x":152,"y":364,"wires":[["835e7140.2a2a1"]]},{"id":"8a2adf4.f4da52","type":"comment","z":"5fb6fbab.f972b4","name":"Connect / Disconnect","info":"","x":634,"y":310,"wires":[]},{"id":"41860482.dc197c","type":"debug","z":"5fb6fbab.f972b4","name":"Connect","active":true,"console":"false","complete":"payload","x":653,"y":366,"wires":[]},{"id":"20a240d3.ecf8","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/agentactionreq","qos":"0","broker":"d67ba72f.cb57f8","x":147,"y":477,"wires":[["2abd4c34.c2bdb4"]]},{"id":"19184cf1.5f5823","type":"comment","z":"5fb6fbab.f972b4","name":"OS Info / InfoSpec / Reply ( Get, Set )","info":"","x":588,"y":427,"wires":[]},{"id":"89274.64fc7d8c8","type":"debug","z":"5fb6fbab.f972b4","name":"OS/InfoSpec/Reply","active":true,"console":"false","complete":"payload","x":620,"y":476,"wires":[]},{"id":"d453829.9e8f08","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":"/cagent/admin/+/willmessage","qos":"0","broker":"d67ba72f.cb57f8","x":158,"y":578,"wires":[["99520461.c98918"]]},{"id":"6d9e5cc2.3a4214","type":"comment","z":"5fb6fbab.f972b4","name":"Will Msg","info":"","x":676,"y":533,"wires":[]},{"id":"1505a2ec.a8e73d","type":"debug","z":"5fb6fbab.f972b4","name":"Will Msg","active":true,"console":"false","complete":"payload","x":647,"y":578,"wires":[]},{"id":"15fea8db.b4d6c7","type":"comment","z":"5fb6fbab.f972b4","name":"1. Config - Service Name","info":"","x":249,"y":105,"wires":[]},{"id":"fe21d1fd.b7959","type":"mqtt in","z":"5fb6fbab.f972b4","name":"","topic":" /cagent/admin/+/agentcallbackreq","qos":"0","broker":"d67ba72f.cb57f8","x":163,"y":699,"wires":[["54f161ce.e7ef3"]]},{"id":"e7b53a18.ecb898","type":"comment","z":"5fb6fbab.f972b4","name":"Get / Set  Cmd","info":"","x":660,"y":647,"wires":[]},{"id":"414b68b2.7dd3d8","type":"debug","z":"5fb6fbab.f972b4","name":"Get / Set","active":true,"console":"false","complete":"payload","x":648,"y":701,"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":391,"y":236,"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":397,"y":365,"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":394,"y":477,"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":392,"y":578,"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":393,"y":700,"wires":[["414b68b2.7dd3d8"]]},{"id":"539df27f.b021ac","type":"comment","z":"5fb6fbab.f972b4","name":"EdgeSense MQTT BUS Monitor - V1.0.1","info":"","x":298,"y":42,"wires":[]},{"id":"d67ba72f.cb57f8","type":"mqtt-broker","z":"","broker":"172.22.12.141","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

Control Soutbound Service ( local MQTT broker ) - v1.0.1

This Node-RED flow sample can send RMM control command to a sourthbound service

  • Enable Auto Report : You can modify the report interval ( in second, default is 10 sec ) 
  • Disable Auto Report 
  • Re-Connect Command
[{"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":531,"y":170,"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":526,"y":384,"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":161,"y":123,"wires":[["2a3478b2.a807c8"]]},{"id":"2a3478b2.a807c8","type":"function","z":"f560a871.91f588","name":"","func":"context.global.CtlDevID='ODBC_Handler';\n\n","outputs":1,"noerr":0,"x":367,"y":123,"wires":[[]]},{"id":"7cf6dfcc.657e1","type":"comment","z":"f560a871.91f588","name":"1. Config - Service Name","info":"","x":244,"y":80,"wires":[]},{"id":"1b638c5.637a674","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\":125,\"handlerName\":\"general\",\"response\":{\"statuscode\":4,\"msg\":\"Reconnect\"}}}';\nreturn msg;","outputs":1,"noerr":0,"x":341,"y":685,"wires":[["3820a01b.1c2da","3eef54bd.df17fc"]]},{"id":"3820a01b.1c2da","type":"mqtt out","z":"f560a871.91f588","name":"","topic":"","qos":"","retain":"","broker":"d67ba72f.cb57f8","x":569,"y":686,"wires":[]},{"id":"e06669b4.0174e8","type":"comment","z":"f560a871.91f588","name":"ReConnect","info":"","x":527,"y":637,"wires":[]},{"id":"80060eb1.014ff","type":"inject","z":"f560a871.91f588","name":"Trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":117,"y":686,"wires":[["1b638c5.637a674"]]},{"id":"3eef54bd.df17fc","type":"debug","z":"f560a871.91f588","name":"","active":true,"console":"false","complete":"false","x":540,"y":765,"wires":[]},{"id":"e8ce49da.283b18","type":"comment","z":"f560a871.91f588","name":"Control Southbound Service - V1.0.1","info":"","x":278,"y":29,"wires":[]},{"id":"d67ba72f.cb57f8","type":"mqtt-broker","z":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

Trace Data Flow ( from local MQTT broker to Cloud's RabbitMQ Broker)

[{"id":"23e8472.96e52b8","type":"debug","z":"f5f11af6.146838","name":"","active":true,"console":"false","complete":"false","x":490,"y":400,"wires":[]},{"id":"c94d6f0c.2ebe5","type":"mqtt in","z":"f5f11af6.146838","name":"Modbus Get Data Reply","topic":"/cagent/admin/Modbus_Handler/agentactionreq","qos":"0","broker":"cf82a5a9.8e4858","x":120,"y":400,"wires":[["962adb1b.0bd3d8","a01a8727.339618"]]},{"id":"6d14aec0.5e6a1","type":"mqtt in","z":"f5f11af6.146838","name":"EI Agent Get Data Cmd","topic":"/wisepaas/RMM/00000001-0000-0000-0000-00D0C9020513/agentactionreq","qos":"2","broker":"45053fd0.b0e64","x":120,"y":80,"wires":[["3828c4a7.7edafc","be0a767.b6cf288"]]},{"id":"3828c4a7.7edafc","type":"debug","z":"f5f11af6.146838","name":"","active":false,"console":"false","complete":"false","x":330,"y":120,"wires":[]},{"id":"30bbd415.7c053c","type":"debug","z":"f5f11af6.146838","name":"","active":false,"console":"false","complete":"false","x":330,"y":260,"wires":[]},{"id":"c969145d.546568","type":"mqtt in","z":"f5f11af6.146838","name":"Modbus Get Data Cmd","topic":"/cagent/admin/Modbus_Handler/agentcallbackreq","qos":"0","broker":"cf82a5a9.8e4858","x":120,"y":220,"wires":[["30bbd415.7c053c","fb458140.e623b"]]},{"id":"33437759.990c08","type":"mqtt in","z":"f5f11af6.146838","name":"EI Agent Get Data Reply","topic":"/wisepaas/RMM/00000001-0000-0000-0000-00D0C9020513/agentactionack","qos":"2","broker":"45053fd0.b0e64","x":130,"y":540,"wires":[["4b591f8.54c42e","f6f0fc8.ee372"]]},{"id":"8cf00a8a.15f528","type":"debug","z":"f5f11af6.146838","name":"","active":true,"console":"false","complete":"false","x":490,"y":540,"wires":[]},{"id":"4ca121d0.b5c78","type":"file","z":"f5f11af6.146838","name":"EI Agent Get Data Cmd Log","filename":"C:\\EIAgentGetDataCmd.log","appendNewline":true,"createDir":true,"overwriteFile":"false","x":540,"y":40,"wires":[]},{"id":"962adb1b.0bd3d8","type":"switch","z":"f5f11af6.146838","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"commCmd\":524,","vt":"str"}],"checkall":"true","outputs":1,"x":310,"y":400,"wires":[["23e8472.96e52b8","a977ba47.9b2f78"]]},{"id":"a01a8727.339618","type":"debug","z":"f5f11af6.146838","name":"","active":false,"console":"false","complete":"false","x":330,"y":440,"wires":[]},{"id":"4b591f8.54c42e","type":"switch","z":"f5f11af6.146838","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"commCmd\":524,","vt":"str"}],"checkall":"true","outputs":1,"x":310,"y":540,"wires":[["8cf00a8a.15f528","62214537.72d20c"]]},{"id":"f6f0fc8.ee372","type":"debug","z":"f5f11af6.146838","name":"","active":false,"console":"false","complete":"false","x":330,"y":580,"wires":[]},{"id":"be0a767.b6cf288","type":"switch","z":"f5f11af6.146838","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"commCmd\":523,","vt":"str"}],"checkall":"true","outputs":1,"x":310,"y":80,"wires":[["2faedf3e.4c1d8","4ca121d0.b5c78"]]},{"id":"2faedf3e.4c1d8","type":"debug","z":"f5f11af6.146838","name":"","active":true,"console":"false","complete":"false","x":490,"y":80,"wires":[]},{"id":"fb458140.e623b","type":"switch","z":"f5f11af6.146838","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"commCmd\":523,","vt":"str"}],"checkall":"true","outputs":1,"x":310,"y":220,"wires":[["5b1ff843.3af5f8","66f8c40a.d32c4c"]]},{"id":"5b1ff843.3af5f8","type":"debug","z":"f5f11af6.146838","name":"","active":true,"console":"false","complete":"false","x":490,"y":220,"wires":[]},{"id":"66f8c40a.d32c4c","type":"file","z":"f5f11af6.146838","name":"EI Agent Get Data Cmd Log","filename":"C:\\EIAgentGetDataCmd.log","appendNewline":true,"createDir":true,"overwriteFile":"false","x":540,"y":180,"wires":[]},{"id":"a977ba47.9b2f78","type":"file","z":"f5f11af6.146838","name":"EI Agent Get Data Cmd Log","filename":"C:\\EIAgentGetDataCmd.log","appendNewline":true,"createDir":true,"overwriteFile":"false","x":540,"y":360,"wires":[]},{"id":"62214537.72d20c","type":"file","z":"f5f11af6.146838","name":"EI Agent Get Data Cmd Log","filename":"C:\\EIAgentGetDataCmd.log","appendNewline":true,"createDir":true,"overwriteFile":"false","x":540,"y":500,"wires":[]},{"id":"cf82a5a9.8e4858","type":"mqtt-broker","z":"","broker":"172.22.12.138","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"45053fd0.b0e64","type":"mqtt-broker","z":"","broker":"wise-msghub.eastasia.cloudapp.azure.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]