Node-RED Dashboard – Enterprise 2 Channel Push Notification

Enterprise Push Notification Dashboard

Node-RED Dashboard Flow

The examples in this series are for use with Node-RED and our Wireless Enterprise line of products. If you haven’t already, check out this post, which will explain the packages required for this flow.

This example will set up a dashboard with 2 tabs, one containing current readings, the other showing historical data. All telemetry reported from the sensor is displayed in both tabs.

Usage

Click on the flow below to copy it to your clipboard.

From the hamburger menu on the top right of your flow window, hover over import, click clipboard, and paste in the copied flow.

Double click on the Wireless Gateway node and set up the “Serial Device” field.

At this point you can deploy (it will throw an error about unconfigured nodes, this is fine).

Go to the other node that still shows a triangle, indicating it needs additional configuration, and select the serial device you just created from the drop down.

Deploy again and you will begin receiving telemetry when the sensor is restarted, or at the interval indicated by the settings stored in the sensor.

The Flow

[{"id":"128499f8.93e056","type":"ncd-gateway-node","z":"95b1ec27.9fae5","name":"","connection":"","x":230,"y":480,"wires":[["c46e88b2.17d308"]]},{"id":"b8b2f766.dcbb48","type":"switch","z":"95b1ec27.9fae5","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"input_1","vt":"str"},{"t":"eq","v":"input_2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":790,"y":660,"wires":[["3eef1d3b.4a4d52"],["84b7717b.36328"]]},{"id":"a092304c.8edce","type":"split","z":"95b1ec27.9fae5","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":470,"y":660,"wires":[["a595e2f8.33b25","4a2f8cd1.664784"]]},{"id":"f4cbd0e4.11b03","type":"ncd-wireless-node","z":"95b1ec27.9fae5","name":"","connection":"","config_comm":"","addr":"","sensor_type":"2","auto_config":false,"node_id":0,"delay":300,"destination":"0000FFFF","power":4,"retries":10,"pan_id":"7FFF","change_enabled":"","change_pr":"0","change_interval":"0","cm_calibration":"60.6","bp_altitude":"0","bp_pressure":"0","bp_temp_prec":"0","bp_press_prec":"0","amgt_accel":"0","amgt_mag":"0","amgt_gyro":"0","impact_accel":"0","impact_data_rate":"4","impact_threshold":25,"impact_duration":1,"activ_interr_x":1,"activ_interr_y":2,"activ_interr_z":4,"activ_interr_op":8,"x":240,"y":660,"wires":[["a092304c.8edce","d5c92f84.b9e07"]]},{"id":"542cdc32.ad6d24","type":"ui_chart","z":"95b1ec27.9fae5","name":"","group":"8f08e849.547418","order":0,"width":0,"height":0,"label":"Input History","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":810,"y":540,"wires":[[],[]]},{"id":"a595e2f8.33b25","type":"change","z":"95b1ec27.9fae5","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"On","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"Off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":660,"wires":[["b8b2f766.dcbb48"]]},{"id":"3eef1d3b.4a4d52","type":"ui_text","z":"95b1ec27.9fae5","group":"b8a7bc9b.086d6","order":0,"width":0,"height":0,"name":"","label":"Input 1","format":"{{msg.payload}}","layout":"row-center","x":1000,"y":600,"wires":[]},{"id":"84b7717b.36328","type":"ui_text","z":"95b1ec27.9fae5","group":"b8a7bc9b.086d6","order":0,"width":0,"height":0,"name":"","label":"Input 2","format":"{{msg.payload}}","layout":"row-center","x":1000,"y":680,"wires":[]},{"id":"c46e88b2.17d308","type":"debug","z":"95b1ec27.9fae5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":510,"y":440,"wires":[]},{"id":"4a2f8cd1.664784","type":"function","z":"95b1ec27.9fae5","name":"","func":"var total = flow.get(msg.topic) || 0;\nvar last = flow.get(msg.topic+'_last');\nflow.set(msg.topic+'_last', msg.payload);\nif(!last && msg.payload){\n    msg.payload = total + msg.payload;\n    flow.set(msg.topic, msg.payload);\n}else{\n    msg.payload = total;\n}\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":540,"wires":[["542cdc32.ad6d24"]]},{"id":"2daa15.908a15ec","type":"ui_gauge","z":"95b1ec27.9fae5","name":"","group":"b8a7bc9b.086d6","order":0,"width":0,"height":0,"gtype":"gage","title":"Battery","label":"V","format":"{{value | number:2}}","min":0,"max":"3.3","colors":["#ff0011","#e6e600","#09ca00"],"seg1":"","seg2":"","x":800,"y":760,"wires":[]},{"id":"d5c92f84.b9e07","type":"change","z":"95b1ec27.9fae5","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"data.battery","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":760,"wires":[["2daa15.908a15ec"]]},{"id":"8f08e849.547418","type":"ui_group","z":"","name":"Default","tab":"c4f82725.5cb928","disp":false,"width":"8","collapse":false},{"id":"b8a7bc9b.086d6","type":"ui_group","z":"","name":"Status","tab":"104ce52d.cc60bb","order":1,"disp":true,"width":"8","collapse":false},{"id":"c4f82725.5cb928","type":"ui_tab","z":"","name":"History","icon":"dashboard","order":4},{"id":"104ce52d.cc60bb","type":"ui_tab","z":"","name":"Current","icon":"dashboard","order":1}]
Enterprise Push Notification Dashboard