Inventory Management
Double-click each dashboard node (e.g., ui_chart, ui_text) to open its configuration settings. Select the appropriate tab and group from the dropdown menus (e.g., "Inventory Dashboard" tab and "Inventory Levels" group). Customize the settings as needed (e.g., chart type, label, data format).
[{"id":"mqtt-in","type":"mqtt in","z":"flow-id","name":"Sensor Data","topic":"inventory/sensor","qos":"2","broker":"mqtt-broker-id","x":150,"y":100,"wires":[["function-process"]]},{"id":"function-process","type":"function","z":"flow-id","name":"Process Data","func":"msg.payload = JSON.parse(msg.payload);\nmsg.topic = 'INSERT INTO inventory (sensor_id, value, timestamp) VALUES (?, ?, ?)';\nmsg.payload = [msg.payload.sensor_id, msg.payload.value, new Date()];\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":100,"wires":[["db-out","chart-node","text-node","alert-function"]]},{"id":"db-out","type":"mysql","z":"flow-id","mydb":"db-config-id","name":"Store in DB","x":550,"y":100,"wires":[[]]},{"id":"chart-node","type":"ui_chart","z":"flow-id","name":"Inventory Levels","group":"dashboard-group-id","order":1,"width":6,"height":4,"label":"Inventory Levels","chartType":"line","legend":"false","x":550,"y":200,"wires":[[]]},{"id":"text-node","type":"ui_text","z":"flow-id","group":"dashboard-group-id","order":2,"width":6,"height":1,"name":"Inventory Count","label":"Current Inventory Count","format":"{{msg.payload.count}}","layout":"row-spread","x":550,"y":300,"wires":[]},{"id":"alert-function","type":"function","z":"flow-id","name":"Check Low Inventory","func":"if (msg.payload.value < 10) {\n msg.payload = 'Low inventory alert for sensor ' + msg.payload.sensor_id + ': ' + msg.payload.value;\n return [msg, null];\n} else {\n return [null, msg];\n}","outputs":2,"noerr":0,"x":350,"y":200,"wires":[["email-node","notification-node"],[]]},{"id":"email-node","type":"e-mail","z":"flow-id","server":"smtp.example.com","port":"465","secure":true,"name":"[email protected]","dname":"Email Alerts","x":550,"y":200,"wires":[]},{"id":"notification-node","type":"ui_text","z":"flow-id","group":"dashboard-group-alerts","order":1,"width":6,"height":1,"name":"Inventory Alerts","label":"Alerts","format":"{{msg.payload}}","layout":"row-spread","x":550,"y":300,"wires":[]},{"id":"vehicle-mqtt-in","type":"mqtt in","z":"flow-id","name":"Vehicle Data","topic":"vehicles/sensor","qos":"2","broker":"mqtt-broker-id","x":150,"y":400,"wires":[["vehicle-process"]]},{"id":"vehicle-process","type":"function","z":"flow-id","name":"Process Vehicle Data","func":"msg.payload = JSON.parse(msg.payload);\nmsg.topic = 'INSERT INTO vehicles (vehicle_id, health_metric, timestamp) VALUES (?, ?, ?)';\nmsg.payload = [msg.payload.vehicle_id, msg.payload.health_metric, new Date()];\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":400,"wires":[["vehicle-db-out","vehicle-alert-function"]]},{"id":"vehicle-db-out","type":"mysql","z":"flow-id","mydb":"db-config-id","name":"Store Vehicle Data in DB","x":550,"y":400,"wires":[[]]},{"id":"vehicle-alert-function","type":"function","z":"flow-id","name":"Check Vehicle Health","func":"if (msg.payload.health_metric < 50) {\n msg.payload = 'Maintenance alert for vehicle ' + msg.payload.vehicle_id + ': ' + msg.payload.health_metric;\n return [msg, null];\n} else {\n return [null, msg];\n}","outputs":2,"noerr":0,"x":350,"y":500,"wires":[["vehicle-email-node","vehicle-notification-node"],[]]},{"id":"vehicle-email-node","type":"e-mail","z":"flow-id","server":"smtp.example.com","port":"465","secure":true,"name":"[email protected]","dname":"Vehicle Email Alerts","x":550,"y":500,"wires":[]},{"id":"vehicle-notification-node","type":"ui_text","z":"flow-id","group":"dashboard-group-alerts","order":2,"width":6,"height":1,"name":"Vehicle Alerts","label":"Vehicle Alerts","format":"{{msg.payload}}","layout":"row-spread","x":550,"y":600,"wires":[]},{"id":"ui-group-vehicle-alerts","type":"ui_group","z":"","name":"Vehicle Alerts","tab":"dashboard-tab-id","order":3,"disp":true,"width":"6"}]