OctoPrint

Abhängigkeit / dependence: https://flows.nodered.org/node/node-red-contrib-isonline

[{"id":"d68d865e.d13b98","type":"comment","z":"e3aa70fa.b265f","name":"OctoPrint [octoprint_1 / octoprint_2]","info":"","x":160,"y":320,"wires":[]},{"id":"2069760.de9c08a","type":"http request","z":"e3aa70fa.b265f","name":"Get Job State","method":"GET","ret":"txt","url":"http://192.168.0.250/api/job?apikey=<KEY>","tls":"","x":720,"y":340,"wires":[["bc1be689.c1cab8"]]},{"id":"bc1be689.c1cab8","type":"json","z":"e3aa70fa.b265f","name":"Pars JSON","property":"payload","action":"","pretty":false,"x":890,"y":340,"wires":[["e3fed49c.060ca8"]]},{"id":"e3fed49c.060ca8","type":"function","z":"e3aa70fa.b265f","name":"Split Payload","func":"var printTimeLeft = msg.payload.progress.printTimeLeft;\nvar completion = msg.payload.progress.completion;\nvar state = msg.payload.state;\nvar displayOne = { payload:\"\",bars:\"\"};\nvar displayTwo = { payload:\"\", text:{bigFont:true}, progessBar:\"\"};\nvar date = new Date(null);\ndate.setSeconds(printTimeLeft); // specify value for SECONDS here\nvar result = date.toISOString().substr(11, 5);\nvar progessBar = (9+(completion / 4)).toFixed(0);\n   \n//displayOne.bars = '[{\"position\": {\"x\": 7,\"y\": 7,\"x2\": 31,\"y2\": 7},\"color\": {\"r\": 35,\"g\": 196,\"b\": 43}}, {\"position\": {\"x\": 8,\"y\": 6,\"x2\": '+ pixelProgressbar +',\"y2\": 6},\"color\": {\"r\": 35,\"g\": 196,\"b\": 43}}]'\n//displayTwo.bars = '[{\"position\": {\"x\": 7,\"y\": 7,\"x2\": 31,\"y2\": 7},\"color\": {\"r\": 35,\"g\": 196,\"b\": 43}}, {\"position\": {\"x\": 8,\"y\": 6,\"x2\": '+ pixelProgressbar +',\"y2\": 6},\"color\": {\"r\": 35,\"g\": 196,\"b\": 43}}]'  \ndisplayOne.progessBar= progessBar;\ndisplayTwo.progessBar= progessBar;\nif (completion > 99.9)\n{\n    displayTwo.payload = \"Finish\";\n    displayTwo.text.bigFont = false;\n}\nelse\n{\n    displayTwo.payload = (completion ? completion.toFixed(0):0) + '%';\n}\n\ndisplayOne.payload = result;\n\nreturn [displayOne,displayTwo];\n","outputs":2,"noerr":0,"x":1050,"y":340,"wires":[["7785aeb7.9e3dd"],["c6888f65.bcebe"]]},{"id":"1105c042.2ef01","type":"is online","z":"e3aa70fa.b265f","name":"","url":"192.168.0.250","action":"0","x":260,"y":360,"wires":[["e824a69c.f6b118"]]},{"id":"e824a69c.f6b118","type":"change","z":"e3aa70fa.b265f","name":"Show Screen","rules":[{"t":"set","p":"show","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":360,"wires":[["12a7d2dc.0db1dd"]]},{"id":"733d889c.ed4da8","type":"inject","z":"e3aa70fa.b265f","name":"Every 15s","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":true,"onceDelay":"0.1","x":110,"y":360,"wires":[["1105c042.2ef01"]]},{"id":"12a7d2dc.0db1dd","type":"function","z":"e3aa70fa.b265f","name":"Aktiv?","func":"if (msg.payload)\n{\n    return [msg,null];\n}\nelse\n{\n    return [null,msg];\n}","outputs":2,"noerr":0,"x":570,"y":360,"wires":[["2069760.de9c08a"],["c6888f65.bcebe","7785aeb7.9e3dd"]]},{"id":"527249d1.144878","type":"link out","z":"e3aa70fa.b265f","name":"OctoPrint [octoprint_1 / octoprint_2] Link","links":["567381de.f98d2","df7f7c66.5d7ce"],"x":1775,"y":360,"wires":[]},{"id":"7785aeb7.9e3dd","type":"Screen Init","z":"e3aa70fa.b265f","name":"Screen Init","inscreenName":"octoprint_1","induration":"5","x":1210,"y":340,"wires":[["a9a564d5.364cf8"]]},{"id":"c6888f65.bcebe","type":"Screen Init","z":"e3aa70fa.b265f","name":"Screen Init","inscreenName":"octoprint_2","induration":"5","x":1210,"y":380,"wires":[["b027351f.069038"]]},{"id":"a9a564d5.364cf8","type":"Switch Animation","z":"e3aa70fa.b265f","name":"Switch Animation","aktiv":"true","animation":"fade","x":1390,"y":340,"wires":[["41f9ab6b.0ab0f4"]]},{"id":"b027351f.069038","type":"Switch Animation","z":"e3aa70fa.b265f","name":"Switch Animation","aktiv":"false","animation":"fade","x":1390,"y":380,"wires":[["41f9ab6b.0ab0f4"]]},{"id":"41f9ab6b.0ab0f4","type":"Text","z":"e3aa70fa.b265f","name":"Text","intextString":"{{payload}}","inbigFont":"false","inscrollText":"false","inscrollTextDelay":"0","incenterText":"true","inposX":"7","inposY":"1","incolorR":"255","incolorG":"255","incolorB":"255","x":1550,"y":360,"wires":[["14ab7a16.b08b06"]]},{"id":"14ab7a16.b08b06","type":"Bitmap","z":"e3aa70fa.b265f","name":"Bitmap","indata":"[0,0,34192,34192,34192,34192,0,0,0,34192,65535,34192,34192,65535,34192,0,0,0,34192,34192,34192,34192,0,0,34192,34192,0,34192,34192,0,34192,34192,0,0,34192,53241,53241,34192,0,0,34192,34192,34192,53241,53241,34192,34192,34192,0,0,34192,34192,34192,34192,0,0,34192,34192,0,0,0,0,34192,34192]","inposX":"0","inposY":"0","inwidth":"8","inheight":"8","x":1680,"y":360,"wires":[["527249d1.144878"]]}]