UNPKG

node-red-contrib-azure-iot-edge-module

Version:
1 lines 13.7 kB
[{"id":"9e0862f4.a82c9","type":"tab","label":"Example Flow","disabled":false,"info":""},{"id":"424b6553.dbf1ec","type":"tab","label":"Example Dashboard","disabled":false,"info":""},{"id":"e543a472.1c5818","type":"ui_tab","z":"","name":"IoT Dashboard","icon":"dashboard","disabled":false,"hidden":false},{"id":"8b8bd259.7af5b","type":"ui_group","z":"","name":"Charts","tab":"e543a472.1c5818","order":1,"disp":true,"width":"12","collapse":false},{"id":"d5ae2d76.f72a","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"eb53bb6b.018308","type":"ui_group","z":"","name":"Gauges","tab":"e543a472.1c5818","order":2,"disp":true,"width":"6","collapse":false},{"id":"ad0fb0dd.c701d","type":"edgeclient","z":""},{"id":"8a770dff.d5cf1","type":"function","z":"9e0862f4.a82c9","name":"output msg","func":"var newMsg = { payload:\n \"{ \\\"random\\\":\" + Math.random() + \",\" +\n \"\\\"deviceId\\\": \\\"device-01\\\",\" +\n \"\\\"timestamp\\\":\" + msg.payload + \"}\"\n}\nreturn newMsg;","outputs":1,"noerr":0,"x":930,"y":200,"wires":[["d8dae50b.812ae8"]]},{"id":"a6d8f764.cfe618","type":"moduletwin","z":"9e0862f4.a82c9","client":"ad0fb0dd.c701d","x":490,"y":120,"wires":[["ce65f7c5.c5d048"]]},{"id":"ce65f7c5.c5d048","type":"debug","z":"9e0862f4.a82c9","name":"twin msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":710,"y":60,"wires":[]},{"id":"ba813da4.bd919","type":"inject","z":"9e0862f4.a82c9","name":"running","repeat":"","crontab":"","once":false,"onceDelay":"0.1","topic":"","payload":"running","payloadType":"str","x":126,"y":78,"wires":[["329a4a8d.cadb16"]]},{"id":"329a4a8d.cadb16","type":"function","z":"9e0862f4.a82c9","name":"reported msg","func":"var reported = { payload:\n\"{\\\"moduleStatus\\\": \\\"\" + msg.payload + \"\\\"}\" }\nreturn reported;","outputs":1,"noerr":0,"x":286,"y":158,"wires":[["a6d8f764.cfe618"]]},{"id":"6fed83d0.7d743c","type":"inject","z":"9e0862f4.a82c9","name":"stopped","repeat":"","crontab":"","once":false,"onceDelay":"0.1","topic":"","payload":"stopped","payloadType":"str","x":126,"y":218,"wires":[["329a4a8d.cadb16"]]},{"id":"d8dae50b.812ae8","type":"moduleoutput","z":"9e0862f4.a82c9","client":"ad0fb0dd.c701d","output":"output1","x":1195,"y":248,"wires":[]},{"id":"77eac982.43ff08","type":"inject","z":"9e0862f4.a82c9","name":"","repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":730,"y":260,"wires":[["8a770dff.d5cf1"]]},{"id":"541097f6.edc958","type":"modulemethod","z":"9e0862f4.a82c9","client":"ad0fb0dd.c701d","method":"setValue","x":910,"y":600,"wires":[["d6c374a7.fea2d8","c3effbe1.9672e8","c85d97b1.90e908"]]},{"id":"60a82287.44320c","type":"moduleinput","z":"9e0862f4.a82c9","client":"ad0fb0dd.c701d","input":"input1","x":170,"y":480,"wires":[["e581a7a2.8c8f78","772ca5d9.96610c","1405034e.8d367d"]]},{"id":"e581a7a2.8c8f78","type":"debug","z":"9e0862f4.a82c9","name":"input msg","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":401,"y":514,"wires":[]},{"id":"d6c374a7.fea2d8","type":"debug","z":"9e0862f4.a82c9","name":"method msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1165,"y":572,"wires":[]},{"id":"c3effbe1.9672e8","type":"function","z":"9e0862f4.a82c9","name":"response msg","func":"var response = { payload:\n\"{\\\"methodpayload\\\": \\\"\" + JSON.stringify(msg.payload) + \"\\\"}\" }\nresponse.payload.timestamp = Date.now()\nresponse.status = 100\nreturn response;","outputs":1,"noerr":0,"x":900,"y":720,"wires":[["541097f6.edc958"]]},{"id":"72b700cf.c4535","type":"moduleoutput","z":"9e0862f4.a82c9","client":"ad0fb0dd.c701d","output":"output2","x":665,"y":440,"wires":[]},{"id":"8f5b507c.788c7","type":"comment","z":"9e0862f4.a82c9","name":"Example: Work with module twin","info":"The Module Twin enables you to interact with the module twin on IoT Hub. The node output will provide the twin desired property changes and the node input will enable you to send reported properties back to the IoT Hub. The message coming from the node output will have the property \"topic: desired\" added to it for selection and identification purposes.","x":446,"y":67,"wires":[]},{"id":"cb6c11b9.3becc","type":"comment","z":"9e0862f4.a82c9","name":"Example: Simulate module output","info":"The Module Output enables you to send output to the edgeHub. To send output to another module or to the IoT Hub you have to setup the route to use the output when you created the node. The node input will enable you to send the telemetry message.","x":977,"y":147,"wires":[]},{"id":"f9ed4fb7.8e983","type":"comment","z":"9e0862f4.a82c9","name":"Example: Process Direct Method","info":"The Module Method enables you receive module direct methods. The setup of the module defines which method the node is responding to and what the response is for the method call. The message coming from the node output will have the properties \"topic: method\", \"method: <method name>\" and \"payload: <method payload>\" added to it for selection and identification purposes.\nThe input of the node will have to be used to send a response for the method call. The response (message) wil have to be connected (indirectly) to the message coming from the node output, to ensure a closed loop for the method. When sending a return for the method call on the input, the message property \"status: <your status>\" needs to be set on the message. See the function in the example for details.","x":922,"y":543,"wires":[]},{"id":"2ee29c39.98d3f4","type":"comment","z":"9e0862f4.a82c9","name":"Example: Enable module input","info":"The Module Input enables you to receive input from other modules on your IoT Edge device. To receive input, you have to setup the route to point at the input you specified when you created the node. The node output will provide you with the incoming telemetry message. The message coming from the node output will have the properties \"topic: input\" and \"input: <input name>\" added to it for selection and identification purposes.","x":171,"y":422,"wires":[]},{"id":"b548b2c4.d8ccd","type":"comment","z":"9e0862f4.a82c9","name":"Example: Process message and send to output","info":"Receive an input message and then use another node-red node to change the message and sen it thorugh to an output node.","x":649,"y":358,"wires":[]},{"id":"772ca5d9.96610c","type":"change","z":"9e0862f4.a82c9","name":"adjust msg","rules":[{"t":"delete","p":"payload.timeCreated","pt":"msg"},{"t":"set","p":"payload.timestamp","pt":"msg","to":"","tot":"date"},{"t":"set","p":"payload.deviceId","pt":"msg","to":"device-02","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":410,"wires":[["72b700cf.c4535"]]},{"id":"c5f9620f.742f1","type":"link in","z":"424b6553.dbf1ec","name":"dashboardTelemetry","links":["1405034e.8d367d"],"x":175,"y":160,"wires":[["f48f8e4a.f2805"]]},{"id":"1405034e.8d367d","type":"link out","z":"9e0862f4.a82c9","name":"telemetryToDashboard","links":["c5f9620f.742f1"],"x":355,"y":612,"wires":[]},{"id":"f48f8e4a.f2805","type":"function","z":"424b6553.dbf1ec","name":"process to chart elements","func":"var machineTempMsg = {};\nmachineTempMsg.payload = msg.payload.machine.temperature;\nmachineTempMsg.timestamp = msg.timestamp;\nmachineTempMsg.topic = \"Machine Temperature\";\n\nvar ambientTempMsg = {};\nambientTempMsg.payload = msg.payload.ambient.temperature;\nambientTempMsg.timestamp = msg.timestamp;\nambientTempMsg.topic = \"Ambient Temperature\";\n\nreturn [machineTempMsg, ambientTempMsg];","outputs":2,"noerr":0,"x":350,"y":160,"wires":[["519a35c9.ac360c","13de3dae.008572"],["416b0944.827d68","7cb241bc.42c4"]]},{"id":"416b0944.827d68","type":"ui_gauge","z":"424b6553.dbf1ec","name":"Ambient Temperature","group":"eb53bb6b.018308","order":0,"width":0,"height":0,"gtype":"gage","title":"{{msg.topic}}","label":"deg C","format":"{{msg.payload | number:1}}","min":"20","max":"22","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":660,"y":280,"wires":[]},{"id":"519a35c9.ac360c","type":"ui_gauge","z":"424b6553.dbf1ec","name":"MachineTemperature","group":"eb53bb6b.018308","order":0,"width":0,"height":0,"gtype":"gage","title":"{{msg.topic}}","label":"deg C","format":"{{msg.payload | number:1}}","min":"20","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":660,"y":120,"wires":[]},{"id":"c85d97b1.90e908","type":"link out","z":"9e0862f4.a82c9","name":"methodToDashboard","links":["4dfbd3b.2bc762c"],"x":1110,"y":632,"wires":[]},{"id":"4dfbd3b.2bc762c","type":"link in","z":"424b6553.dbf1ec","name":"dashboardMethod","links":["c85d97b1.90e908"],"x":175,"y":380,"wires":[["b2b39783.6520f8"]]},{"id":"77e7f977.538378","type":"ui_toast","z":"424b6553.dbf1ec","position":"top right","displayTime":"5","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":630,"y":480,"wires":[]},{"id":"b2b39783.6520f8","type":"function","z":"424b6553.dbf1ec","name":"create notification","func":"var notification = {};\nnotification.topic = msg.method\nnotification.payload = JSON.stringify(msg.payload);\nreturn notification;","outputs":1,"noerr":0,"x":350,"y":420,"wires":[["77e7f977.538378"]]},{"id":"13de3dae.008572","type":"ui_chart","z":"424b6553.dbf1ec","name":"Machine Temperature","group":"8b8bd259.7af5b","order":0,"width":0,"height":0,"label":"Machine Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"bezier","nodata":"Machine Temperature","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":660,"y":60,"wires":[[]]},{"id":"7cb241bc.42c4","type":"ui_chart","z":"424b6553.dbf1ec","name":"Ambient Temperature","group":"8b8bd259.7af5b","order":0,"width":0,"height":0,"label":"Ambient Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"bezier","nodata":"Ambient Temperature","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":660,"y":220,"wires":[[]]},{"id":"23a7e69a.73b25a","type":"comment","z":"424b6553.dbf1ec","name":"Example charts","info":"","x":240,"y":100,"wires":[]},{"id":"66ff0a74.6e0694","type":"comment","z":"424b6553.dbf1ec","name":"Example gauges","info":"","x":240,"y":320,"wires":[]},{"id":"c40c5702.e52658","type":"ui_button","z":"424b6553.dbf1ec","name":"","group":"8b8bd259.7af5b","order":2,"width":0,"height":0,"passthru":false,"label":"Clear charts","tooltip":"","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"json","topic":"","x":370,"y":240,"wires":[["13de3dae.008572","7cb241bc.42c4"]]},{"id":"36735329.ca4acc","type":"ui_button","z":"424b6553.dbf1ec","name":"","group":"8b8bd259.7af5b","order":3,"width":0,"height":0,"passthru":false,"label":"Reset simulator","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"command\":\"reset\"}","payloadType":"json","topic":"","x":960,"y":180,"wires":[["1a2146f0.b44779"]]},{"id":"5bb51754.391f78","type":"comment","z":"424b6553.dbf1ec","name":"Button to reset Simulator module","info":"","x":1010,"y":100,"wires":[]},{"id":"1a2146f0.b44779","type":"link out","z":"424b6553.dbf1ec","name":"dashboardReset","links":["4e342a0d.7305e4"],"x":1155,"y":200,"wires":[]},{"id":"9f1f9bbd.78b5f8","type":"comment","z":"9e0862f4.a82c9","name":"Example sending reset to simulator","info":"","x":320,"y":720,"wires":[]},{"id":"d74b08a5.13e388","type":"moduleoutput","z":"9e0862f4.a82c9","client":"ad0fb0dd.c701d","output":"output3","x":410,"y":800,"wires":[]},{"id":"4e342a0d.7305e4","type":"link in","z":"9e0862f4.a82c9","name":"simulatorReset","links":["1a2146f0.b44779"],"x":200,"y":800,"wires":[["d74b08a5.13e388"]]}]