[Example] Node-RED Dashboard Example
Posted: Tue Oct 17, 2023 2:35 pm
This is a node-red dashboard flow for IoT Studio try:
Code: Select all
[{"id":"fe0a146bfb529e03","type":"ui_gauge","z":"120be5cad3efeffd","name":"","group":"0f5cc07a6ddb1d59","order":5,"width":0,"height":0,"gtype":"gage","title":"溫度模擬值","label":"°C","format":"{{value | number:1}}","min":0,"max":"60","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":390,"y":320,"wires":[]},{"id":"2f9140024196daac","type":"ui_gauge","z":"120be5cad3efeffd","name":"","group":"0f5cc07a6ddb1d59","order":6,"width":0,"height":0,"gtype":"gage","title":"濕度模擬值","label":"%","format":"{{value | number:1}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":390,"y":360,"wires":[]},{"id":"0e280c4580e79201","type":"ui_gauge","z":"120be5cad3efeffd","name":"","group":"6660a8784889209f","order":1,"width":0,"height":0,"gtype":"wave","title":"溫度實際值","label":"°C","format":"{{value | number:1}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":390,"y":400,"wires":[]},{"id":"d1b484c274cf6e99","type":"ui_gauge","z":"120be5cad3efeffd","name":"","group":"6660a8784889209f","order":2,"width":0,"height":0,"gtype":"compass","title":"濕度實際值","label":"%","format":"{{value | number:1}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":390,"y":440,"wires":[]},{"id":"c564eececc87afac","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":210,"y":320,"wires":[["fe0a146bfb529e03"]]},{"id":"c003231c138dd803","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"num","x":210,"y":360,"wires":[["2f9140024196daac"]]},{"id":"7dd01a504b51bcd5","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"47.5","payloadType":"num","x":210,"y":400,"wires":[["0e280c4580e79201"]]},{"id":"cfa6b3bf89813185","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"64.0","payloadType":"num","x":210,"y":440,"wires":[["d1b484c274cf6e99"]]},{"id":"78975b37d5759013","type":"ui_text_input","z":"120be5cad3efeffd","name":"","label":"溫度波動值","tooltip":"","group":"0f5cc07a6ddb1d59","order":2,"width":3,"height":1,"passthru":true,"mode":"number","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":410,"y":120,"wires":[["f43e61a895b26af1","e9cc89d0eee8606d"]]},{"id":"1c1d4c476f94316f","type":"ui_text_input","z":"120be5cad3efeffd","name":"","label":"濕度波動值","tooltip":"","group":"0f5cc07a6ddb1d59","order":4,"width":3,"height":1,"passthru":true,"mode":"number","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":410,"y":240,"wires":[["ee8ca93204e2ec86","1d41361191796846"]]},{"id":"0aab61116d59d33f","type":"ui_text_input","z":"120be5cad3efeffd","name":"","label":"濕度模擬基數","tooltip":"","group":"0f5cc07a6ddb1d59","order":3,"width":3,"height":1,"passthru":true,"mode":"number","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":420,"y":200,"wires":[["7a31322b8a81904b","1d41361191796846"]]},{"id":"f1cdcad185bbb319","type":"ui_text_input","z":"120be5cad3efeffd","name":"","label":"溫度模擬基數","tooltip":"","group":"0f5cc07a6ddb1d59","order":1,"width":3,"height":1,"passthru":true,"mode":"number","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":420,"y":80,"wires":[["1afb65aafb7c6bf5","e9cc89d0eee8606d"]]},{"id":"1afb65aafb7c6bf5","type":"debug","z":"120be5cad3efeffd","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":580,"y":60,"wires":[]},{"id":"7a31322b8a81904b","type":"debug","z":"120be5cad3efeffd","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":580,"y":180,"wires":[]},{"id":"ee8ca93204e2ec86","type":"debug","z":"120be5cad3efeffd","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":580,"y":260,"wires":[]},{"id":"f43e61a895b26af1","type":"debug","z":"120be5cad3efeffd","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":580,"y":140,"wires":[]},{"id":"a70dc06626598fc2","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"tempBase","payload":"45","payloadType":"num","x":240,"y":80,"wires":[["f1cdcad185bbb319","e9cc89d0eee8606d"]]},{"id":"f46c492751fc10bb","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"tempDelta","payload":"3","payloadType":"num","x":230,"y":120,"wires":[["78975b37d5759013","e9cc89d0eee8606d"]]},{"id":"e9cc89d0eee8606d","type":"function","z":"120be5cad3efeffd","name":"Calc 溫度模擬值","func":"if (msg.topic == \"tempBase\") {\n context.set(\"tempBase\", msg.payload);\n}\n\nif (msg.topic == \"tempDelta\") {\n context.set(\"tempDelta\", msg.payload);\n}\n\nvar max = context.get(\"tempDelta\");\nvar min = max * -1;\nmsg.payload = context.get(\"tempBase\") + Math.floor(Math.random() * (max - min + 1) + min);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":100,"wires":[["fe0a146bfb529e03"]]},{"id":"2b4252c7946d539a","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"humiBase","payload":"45","payloadType":"num","x":230,"y":200,"wires":[["0aab61116d59d33f","1d41361191796846"]]},{"id":"eb69312afbc147f8","type":"inject","z":"120be5cad3efeffd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"humiDelta","payload":"3","payloadType":"num","x":230,"y":240,"wires":[["1c1d4c476f94316f","1d41361191796846"]]},{"id":"1d41361191796846","type":"function","z":"120be5cad3efeffd","name":"Calc 濕度模擬值","func":"if (msg.topic == \"humiBase\") {\n context.set(\"humiBase\", msg.payload);\n}\n\nif (msg.topic == \"humiDelta\") {\n context.set(\"humiDelta\", msg.payload);\n}\n\nvar max = context.get(\"humiDelta\");\nvar min = max * -1;\nmsg.payload = context.get(\"humiBase\") + Math.floor(Math.random() * (max - min + 1) + min);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":220,"wires":[["2f9140024196daac"]]},{"id":"349ba08621565c30","type":"ui_slider","z":"120be5cad3efeffd","name":"","label":"溫度設定值","tooltip":"","group":"8d034e9d05738f91","order":1,"width":4,"height":1,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":0,"max":"60","step":1,"className":"","x":270,"y":560,"wires":[["d760633e0e2fd344"]]},{"id":"96af84c2397c5f36","type":"ui_slider","z":"120be5cad3efeffd","name":"","label":"濕度設定值","tooltip":"","group":"8d034e9d05738f91","order":3,"width":4,"height":1,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":270,"y":620,"wires":[["49b1acaafa1f00d0"]]},{"id":"4a410c758b8db224","type":"ui_button","z":"120be5cad3efeffd","name":"","group":"8d034e9d05738f91","order":2,"width":2,"height":1,"passthru":false,"label":"設定","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"tempSetting","payloadType":"global","topic":"topic","topicType":"msg","x":610,"y":560,"wires":[["e27e48d3c645fd2b","0e280c4580e79201"]]},{"id":"3a0618d681c34415","type":"ui_button","z":"120be5cad3efeffd","name":"","group":"8d034e9d05738f91","order":4,"width":2,"height":1,"passthru":false,"label":"設定","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"humiSetting","payloadType":"global","topic":"topic","topicType":"msg","x":610,"y":620,"wires":[["d1b484c274cf6e99"]]},{"id":"e27e48d3c645fd2b","type":"debug","z":"120be5cad3efeffd","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":740,"y":560,"wires":[]},{"id":"d760633e0e2fd344","type":"function","z":"120be5cad3efeffd","name":"tempSetting","func":"global.set(\"tempSetting\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":560,"wires":[[]]},{"id":"49b1acaafa1f00d0","type":"function","z":"120be5cad3efeffd","name":"humiSetting","func":"global.set(\"humiSetting\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":620,"wires":[[]]},{"id":"0f5cc07a6ddb1d59","type":"ui_group","name":"溫溼度模擬器","tab":"3f38a04c838180d9","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"6660a8784889209f","type":"ui_group","name":"溫溼度顯示","tab":"3f38a04c838180d9","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"8d034e9d05738f91","type":"ui_group","name":"調整溫溼度設定值","tab":"3f38a04c838180d9","order":3,"disp":true,"width":"6","collapse":false,"className":""},{"id":"3f38a04c838180d9","type":"ui_tab","name":"FMCS_0806","icon":"dashboard","disabled":false,"hidden":false}]