diff --git a/node/flows.json b/node/flows.json new file mode 100644 index 0000000..8a33d3a --- /dev/null +++ b/node/flows.json @@ -0,0 +1 @@ +[{"id":"8218571184381fe1","type":"tab","label":"car logic","disabled":false,"info":"","env":[]},{"id":"1d0479f6bc979bb1","type":"mqtt in","z":"8218571184381fe1","name":"","topic":"python/obdata","qos":"2","datatype":"auto-detect","broker":"6992075b538d96f8","nl":true,"rap":true,"rh":0,"inputs":0,"x":150,"y":120,"wires":[["1a33aae22e09835e"]]},{"id":"1a33aae22e09835e","type":"json","z":"8218571184381fe1","name":"format rx message","property":"payload","action":"obj","pretty":false,"x":370,"y":120,"wires":[["274778b25ca84f0b","10e36d154fbc92ee","fa93d4231885566d","95b2eacab91265c3","28a1532308b7437e"]]},{"id":"e817ca7d0a68a820","type":"inject","z":"8218571184381fe1","name":"fail","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"timestamp\":1668370055,\"RPM\":3100,\"SPD\":140,\"PDL\":16.6666,\"INT\":20.0656,\"COL\":110,\"TRB\":true,\"ERR\":{\"LST\":[[\"P0104\",\"Mass or Volume Air Flow Circuit Intermittent\"],[\"B0003\",\"\"],[\"C0123\",\"\"]],\"FRZ\":[\"P0104\",\"Mass or Volume Air Flow Circuit Intermittent\"],\"RPM\":700,\"SPD\":0,\"PDL\":12.3333333,\"INT\":70,\"COL\":100}}","payloadType":"json","x":150,"y":160,"wires":[["1a33aae22e09835e"]]},{"id":"274778b25ca84f0b","type":"change","z":"8218571184381fe1","name":"engine light check","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.TRB","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":400,"wires":[["e30fdc6b1627c8cc"]]},{"id":"3e4833bd97a2ddf9","type":"file","z":"8218571184381fe1","name":"save file","filename":"arquivo-carro.txt","filenameType":"str","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":940,"y":120,"wires":[[]]},{"id":"4ff3240a4383860e","type":"inject","z":"8218571184381fe1","name":"good","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"timestamp\":1665607045,\"RPM\":807.25,\"SPD\":2,\"PDL\":13.72549019607843,\"INT\":48,\"COL\":97,\"TRB\":false,\"ERR\":null}","payloadType":"json","x":150,"y":200,"wires":[["1a33aae22e09835e"]]},{"id":"2c39208b4dfade7f","type":"file in","z":"8218571184381fe1","name":"read prev. car data","filename":"arquivo-carro.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":390,"y":860,"wires":[["1243ed31402252ce"]]},{"id":"1de8634d5a1db0f0","type":"json","z":"8218571184381fe1","name":"read json from file","property":"payload","action":"obj","pretty":false,"x":390,"y":940,"wires":[["11045786c2726e7f"]]},{"id":"10e36d154fbc92ee","type":"json","z":"8218571184381fe1","name":"prep to save","property":"payload","action":"str","pretty":false,"x":790,"y":120,"wires":[["3e4833bd97a2ddf9"]]},{"id":"1243ed31402252ce","type":"switch","z":"8218571184381fe1","name":"not empty check","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":380,"y":900,"wires":[["1de8634d5a1db0f0"]]},{"id":"1092d949ee4050d6","type":"join","z":"8218571184381fe1","name":"join parts","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":600,"y":940,"wires":[["4e719f79721d1d9c"]]},{"id":"2f9b359d2edbfa9d","type":"change","z":"8218571184381fe1","name":"load error values","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ERR","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":320,"wires":[["47581b3b6d664858","5164c25b0505c4df"]]},{"id":"fa93d4231885566d","type":"switch","z":"8218571184381fe1","name":"car has error?","property":"payload.ERR","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":320,"wires":[["2f9b359d2edbfa9d"],["02a6382425d23121"]]},{"id":"02a6382425d23121","type":"change","z":"8218571184381fe1","name":"clear error values","rules":[{"t":"set","p":"payload.ERR","pt":"msg","to":"{\"LST\":null,\"FRZ\":null,\"RPM\":null,\"SPD\":null,\"PDL\":null,\"INT\":null,\"COL\":null}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":360,"wires":[["2f9b359d2edbfa9d"]]},{"id":"47581b3b6d664858","type":"change","z":"8218571184381fe1","name":"get error code list","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.LST","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":360,"wires":[["38f0ccdac745359e"]]},{"id":"38f0ccdac745359e","type":"function","z":"8218571184381fe1","name":"order error codes to table","func":"if (msg.payload != null){\n var tmp = msg.payload;\n msg.payload = [];\n for (i = 0; i < tmp.length; i++)\n {\n msg.payload[i] = {\n \"CODE\" : tmp[i][0],\n \"DESC\" : tmp[i][1]\n };\n }\n}\nelse\n{\n msg.payload = [{\"CODE\":null,\"DESC\":null}];\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1270,"y":360,"wires":[["107e18e2f30352fe"]]},{"id":"647cdc791eedecf9","type":"switch","z":"8218571184381fe1","name":"clear file request","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Sim","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":380,"y":700,"wires":[["26151946b7fc1074"]]},{"id":"4fa12a21fdcba3c7","type":"file","z":"8218571184381fe1","name":"delete","filename":"arquivo-carro.txt","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":350,"y":620,"wires":[["ea9894f622a06121"]]},{"id":"26151946b7fc1074","type":"change","z":"8218571184381fe1","name":"clear file","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":660,"wires":[["4fa12a21fdcba3c7"]]},{"id":"a7b709f91159494d","type":"inject","z":"8218571184381fe1","name":"startup","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":860,"wires":[["2c39208b4dfade7f"]]},{"id":"ea9894f622a06121","type":"function","z":"8218571184381fe1","name":"reset values","func":"msg.payload = [\n {\n \"RPM\" : null,\n \"SPD\" : null,\n \"PDL\" : null,\n \"INT\" : null,\n \"COL\" : null,\n \"TRB\" : null,\n \"ERR\" : null\n }\n ];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":580,"wires":[["fa93d4231885566d","4e719f79721d1d9c","95b2eacab91265c3"]]},{"id":"e30fdc6b1627c8cc","type":"switch","z":"8218571184381fe1","name":"engine light turned on?","property":"payload","propertyType":"msg","rules":[{"t":"null"},{"t":"nnull"}],"checkall":"true","repair":false,"outputs":2,"x":1020,"y":400,"wires":[["1627e07b5c12e95c"],["290a2f511e1b4811"]]},{"id":"1627e07b5c12e95c","type":"change","z":"8218571184381fe1","name":"engine light turned off","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":400,"wires":[["290a2f511e1b4811"]]},{"id":"c8778fc95a5f3a55","type":"watch","z":"8218571184381fe1","name":"watch prev. car data","files":"arquivo-carro.txt","recursive":"","x":390,"y":820,"wires":[["2c39208b4dfade7f"]]},{"id":"28a1532308b7437e","type":"debug","z":"8218571184381fe1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":350,"y":80,"wires":[]},{"id":"5164c25b0505c4df","type":"link out","z":"8218571184381fe1","name":"formatted freeze frame data","mode":"link","links":["7ded16e4c8781f69","588bd75a649d8b02","78176010f4c32e32"],"x":1195,"y":320,"wires":[]},{"id":"107e18e2f30352fe","type":"link out","z":"8218571184381fe1","name":"formatted car error msg","mode":"link","links":["abc242fa2d577bec"],"x":1415,"y":360,"wires":[]},{"id":"290a2f511e1b4811","type":"link out","z":"8218571184381fe1","name":"engine light check","mode":"link","links":["4d0417acb90a1287","ed3765da020faa88"],"x":1175,"y":460,"wires":[]},{"id":"4e719f79721d1d9c","type":"link out","z":"8218571184381fe1","name":"car table prep","mode":"link","links":["6afd0641f0b1bd76"],"x":715,"y":940,"wires":[]},{"id":"cc60f3d0d8d4725c","type":"link in","z":"8218571184381fe1","name":"request clear file","links":["77199d94f4abf95d"],"x":225,"y":660,"wires":[["647cdc791eedecf9"]]},{"id":"95b2eacab91265c3","type":"link out","z":"8218571184381fe1","name":"car values","mode":"link","links":["35482836fa6bbe10","bbe448e170e4d3e4"],"x":735,"y":280,"wires":[]},{"id":"866d8bfacaea6f0c","type":"file in","z":"8218571184381fe1","name":"cfg file","filename":"config_car.cfg","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":930,"y":620,"wires":[["0c08b74485670f0a"]]},{"id":"3c493bbbc2f674b9","type":"json","z":"8218571184381fe1","name":"","property":"payload","action":"obj","pretty":false,"x":1090,"y":620,"wires":[["af4d7b6b1e62b7c3"]]},{"id":"af4d7b6b1e62b7c3","type":"change","z":"8218571184381fe1","name":"set config","rules":[{"t":"move","p":"payload.spd_threshold","pt":"msg","to":"spd_threshold","tot":"global"},{"t":"move","p":"payload.coolant_threshold","pt":"msg","to":"coolant_threshold","tot":"global"},{"t":"move","p":"payload.rpm_threshold","pt":"msg","to":"rpm_threshold","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":620,"wires":[[]]},{"id":"fa01d7bfb8c43d0f","type":"change","z":"8218571184381fe1","name":"defaults","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"spd_threshold\":130,\"rpm_threshold\":3000,\"coolant_threshold\":105}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":680,"wires":[["af4d7b6b1e62b7c3"]]},{"id":"0c08b74485670f0a","type":"switch","z":"8218571184381fe1","name":"check cfg file","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"null"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":3,"x":950,"y":660,"wires":[["3c493bbbc2f674b9"],["fa01d7bfb8c43d0f"],["fa01d7bfb8c43d0f"]]},{"id":"746279b21d92655e","type":"catch","z":"8218571184381fe1","name":"file read fail","scope":["866d8bfacaea6f0c"],"uncaught":false,"x":950,"y":700,"wires":[["fa01d7bfb8c43d0f"]]},{"id":"75e203eb34ed333f","type":"comment","z":"8218571184381fe1","name":"reset_historico()","info":"","x":380,"y":540,"wires":[]},{"id":"6b2ec685f65d401d","type":"comment","z":"8218571184381fe1","name":"carregar_historico()","info":"","x":390,"y":780,"wires":[]},{"id":"c4a1a29f1fc477a9","type":"comment","z":"8218571184381fe1","name":"carregar_configuracao()","info":"","x":980,"y":580,"wires":[]},{"id":"c7865daede096b0e","type":"comment","z":"8218571184381fe1","name":"receber_dados()","info":"","x":160,"y":80,"wires":[]},{"id":"9fca6e1c7a9c667c","type":"comment","z":"8218571184381fe1","name":"buscar_dados()","info":"","x":840,"y":280,"wires":[]},{"id":"01d6817bb1c69276","type":"comment","z":"8218571184381fe1","name":"salvar_configuracao()","info":"","x":980,"y":760,"wires":[]},{"id":"0b79afd0c563bdc5","type":"link in","z":"8218571184381fe1","name":"save request","links":["42e7d064c5fa77c6"],"x":895,"y":800,"wires":[["3ab3b3f91913b672"]]},{"id":"42d632e2748f4037","type":"file","z":"8218571184381fe1","name":"save cfg","filename":"config_car.cfg","filenameType":"str","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"none","x":1100,"y":840,"wires":[[]]},{"id":"3ab3b3f91913b672","type":"function","z":"8218571184381fe1","name":"get global variables","func":"msg.payload = {\n \"spd_threshold\": global.get(\"spd_threshold\"),\n \"rpm_threshold\": global.get(\"rpm_threshold\"),\n \"coolant_threshold\": global.get(\"coolant_threshold\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1010,"y":800,"wires":[["8f8d77c24bf121a6"]]},{"id":"8f8d77c24bf121a6","type":"json","z":"8218571184381fe1","name":"","property":"payload","action":"str","pretty":false,"x":970,"y":840,"wires":[["42d632e2748f4037"]]},{"id":"5bdfe88720725589","type":"catch","z":"8218571184381fe1","name":"file write error","scope":["42d632e2748f4037"],"uncaught":false,"x":990,"y":880,"wires":[["8db84e02f7b80bec"]]},{"id":"8db84e02f7b80bec","type":"change","z":"8218571184381fe1","name":"save error","rules":[{"t":"set","p":"payload","pt":"msg","to":"Erro ao salvar configurações!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1140,"y":880,"wires":[["a0d45aba2b89d406"]]},{"id":"a0d45aba2b89d406","type":"ui_toast","z":"8218571184381fe1","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"UI Notif - FAIL to Save CFG","x":1040,"y":920,"wires":[]},{"id":"11045786c2726e7f","type":"function","z":"8218571184381fe1","name":"timestamp convert","func":"msg.payload.timestamp = new Date(msg.payload.timestamp * 1000);\nlet ts = msg.payload.timestamp.toLocaleString();\nmsg.payload.timestamp = ts;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":900,"wires":[["1092d949ee4050d6"]]},{"id":"136a8c4f343daf25","type":"catch","z":"8218571184381fe1","name":"fail history write","scope":["3e4833bd97a2ddf9"],"uncaught":false,"x":800,"y":160,"wires":[["b318ceec4590a609"]]},{"id":"b318ceec4590a609","type":"change","z":"8218571184381fe1","name":"save file error","rules":[{"t":"set","p":"payload","pt":"msg","to":"Erro ao gravar dados!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":200,"wires":[["3b379f2eabeba6a7"]]},{"id":"3b379f2eabeba6a7","type":"ui_toast","z":"8218571184381fe1","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"UI Notif - Error while saving data","x":1070,"y":160,"wires":[]},{"id":"09708fc6cfab28dd","type":"ui_template","z":"8218571184381fe1","group":"2a745e6b.07df92","name":"Dashboard Theme : Modern Dark","order":2,"width":0,"height":0,"format":"
\n \n \n
","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"global","className":"","x":220,"y":280,"wires":[[]],"icon":"node-red-dashboard/ui_colour_picker.png","info":"# Modern Dark Theme for node-red-dashboard\n\nInspired by Victor Lucachi with his [Node Red Dashboard Concept](https://dribbble.com/shots/10356530-Node-Red-Dashboard-Concept) on Dribbble. Thank you for your work.\n\n## Customize\n\n1. Go on dashboard customisation tab (At the right of Debug Console).\n2. Select the style `Dark`.\n3. Pick the color you want. Example `#66B5F8`\n\n## Buttons\n\nUse `2x2` size for buttons with icon and text on the screenshot"},{"id":"f7537559217ab1d4","type":"ui_template","z":"8218571184381fe1","group":"83dfbdc5d81da0f4","name":"car style status","order":12,"width":0,"height":0,"format":"","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","className":"","x":160,"y":240,"wires":[[]]},{"id":"6f8787c644bd95e5","type":"inject","z":"8218571184381fe1","name":"startup","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":800,"y":620,"wires":[["866d8bfacaea6f0c"]]},{"id":"8979f63c92c22d1a","type":"comment","z":"8218571184381fe1","name":"salvar_dados()","info":"","x":800,"y":80,"wires":[]},{"id":"6992075b538d96f8","type":"mqtt-broker","name":"personal","broker":"raszeja.xyz","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"2a745e6b.07df92","type":"ui_group","name":"Default","tab":"e63bce2d.68925","order":5,"disp":true,"width":"6","collapse":true},{"id":"83dfbdc5d81da0f4","type":"ui_group","name":"STATUS","tab":"c69ae39536c7dc05","order":1,"disp":true,"width":"12","collapse":false,"className":""},{"id":"e63bce2d.68925","type":"ui_tab","name":"Tema","icon":"dashboard","order":4,"disabled":false,"hidden":false},{"id":"c69ae39536c7dc05","type":"ui_tab","name":"Menu Carro","icon":"dashboard","order":9,"disabled":false,"hidden":false}] \ No newline at end of file