Overall equipment effectiveness

Hello,

I need help.

I want to program an overall equipment effectiveness for a machine.
I have 8 inputs (mqtt) and I converted these as json with aa == for off and aq == for on. The inputs also give me a timestamp.

1.) How can I show if, for example, Pin 1 was on weekdays between 8:15 and 15:30 online and how long?

2.) How can I log the data per week / year/ over all time?

I'm a beginner in programming.

Best regards

Agrotar

mqtt

The nodes :

[{"id":"f34bcea1.a6c18","type":"mqtt in","z":"7259aae9.ba1fa4","name":"Signalspannung Input","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/1","qos":"2","broker":"ee7cd723.3d96a8","x":192.57144165039062,"y":121.00001907348633,"wires":[["9b4c59a3.26df98","d847f4bb.d99268"]]},{"id":"5d596770.641488","type":"debug","z":"7259aae9.ba1fa4","name":"","active":false,"console":false,"complete":"payload","x":973.4285850524902,"y":360.5714473724365,"wires":},{"id":"96ad9671.e823a8","type":"mqtt in","z":"7259aae9.ba1fa4","name":"Hauptmotor Input","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/2","qos":"2","broker":"ee7cd723.3d96a8","x":164.42857360839844,"y":232.57144355773926,"wires":[["70bc5db8.7a10a4"]]},{"id":"c8bb8806.d57df8","type":"mqtt in","z":"7259aae9.ba1fa4","name":"Steuerspannung Input","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/3","qos":"2","broker":"ee7cd723.3d96a8","x":172.2857208251953,"y":329.2857255935669,"wires":[["5344b572.16444c"]]},{"id":"90a7279d.d18678","type":"mqtt in","z":"7259aae9.ba1fa4","name":"Oberertotpunkt Input","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/4","qos":"2","broker":"ee7cd723.3d96a8","x":168.42857360839844,"y":426.57144927978516,"wires":[["2629860c.7cd4ba"]]},{"id":"c1ba0133.8b4b","type":"mqtt in","z":"7259aae9.ba1fa4","name":"Wartung Input","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/5","qos":"2","broker":"ee7cd723.3d96a8","x":171.42857360839844,"y":529.5714492797852,"wires":[["9d6633d0.790df"]]},{"id":"7a285e56.f0782","type":"mqtt in","z":"7259aae9.ba1fa4","name":" Ölmangel Input","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/6","qos":"2","broker":"ee7cd723.3d96a8","x":171.42857360839844,"y":645.5714511871338,"wires":[["50c8bdd7.bde254"]]},{"id":"30053717.fe6608","type":"mqtt in","z":"7259aae9.ba1fa4","name":"Hub ausgeführt","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/8","qos":"2","broker":"ee7cd723.3d96a8","x":162.857177734375,"y":821.4285869598389,"wires":[["35c121f1.a9d13e"]]},{"id":"9b4c59a3.26df98","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":383.95714569091797,"y":120.40003776550293,"wires":[["bfb0fdb5.b2f53"]]},{"id":"70bc5db8.7a10a4","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":361.52857971191406,"y":232.9714527130127,"wires":[["be16c869.108ba8"]]},{"id":"5344b572.16444c","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":354.4285774230957,"y":328.5714473724365,"wires":[["237c6646.912a5a"]]},{"id":"2629860c.7cd4ba","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":351.4285774230957,"y":426.57144927978516,"wires":[["849bca34.5db978"]]},{"id":"9d6633d0.790df","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":356.7143135070801,"y":530.7143077850342,"wires":[["a4b41607.031f28"]]},{"id":"50c8bdd7.bde254","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":346.8571434020996,"y":644.4286193847656,"wires":[["b4dd8f2a.2fa8b"]]},{"id":"35c121f1.a9d13e","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":332.857177734375,"y":821.4285869598389,"wires":[["ee1d07fc.fb1088"]]},{"id":"bfb0fdb5.b2f53","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"siin","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":549.1000823974609,"y":120.57145690917969,"wires":[["5d596770.641488","cd78732f.a434d","3b913795.3cd338"]]},{"id":"be16c869.108ba8","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"hain","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":548.428581237793,"y":233.57144165039062,"wires":[["5d596770.641488","cd78732f.a434d","3b913795.3cd338"]]},{"id":"237c6646.912a5a","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"stin","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":555.5714569091797,"y":330.00003814697266,"wires":[["5d596770.641488","cd78732f.a434d","3b913795.3cd338"]]},{"id":"849bca34.5db978","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"obin","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":547.1428756713867,"y":427.1428871154785,"wires":[["5d596770.641488","cd78732f.a434d","3b913795.3cd338"]]},{"id":"a4b41607.031f28","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"wain","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":537.0000228881836,"y":525.4286003112793,"wires":[["cd78732f.a434d","3b913795.3cd338"]]},{"id":"b4dd8f2a.2fa8b","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"oein","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":531.4286804199219,"y":644.4286956787109,"wires":[["5d596770.641488","cd78732f.a434d"]]},{"id":"ee1d07fc.fb1088","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"huin","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":671.2857666015625,"y":800.285779774189,"wires":[["5d596770.641488","789d1afb.272e84"]]},{"id":"cd78732f.a434d","type":"function","z":"7259aae9.ba1fa4","name":"Status","func":"var siin = flow.get('siin');\nvar hain = flow.get('hain');\nvar stin = flow.get('stin');\nvar obin = flow.get('obin');\nvar wain = flow.get('wain');\nvar oein = flow.get('oein');\nvar zhub = flow.get('zhub');\n\n\nif (flow.get('hain') === "AA==" &&\nflow.get('stin') === "AA==" ) {\nmsg.payload = "Status: Aus";\n}\n\n\n\nif (flow.get('hain') === "AQ==") {\nmsg.payload = "Status: Stand By";\n}\n\nif (flow.get('siin') === "AQ==") {\nmsg.payload = "Status: Stand By";\n}\n\nif (flow.get('hain') === "AQ==" && flow.get('siin') === "AQ==" && flow.get('stin') === "AQ==") {\nmsg.payload = "Status: Einsatzbereit";\n}\n\nif (flow.get('oein') === "AQ==") {\nmsg.payload = "Status: Störung Ölmangel";\n}\n\n\nif (flow.get('obin') === "AQ==") {\nmsg.payload = "Status: Störung Oberertotpunkt";\n}\n\nif (flow.get('wain') === "AQ==") {\nmsg.payload = "Status: Wartung";\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":940.8214225769043,"y":263.85715675354004,"wires":[["c3d0ffc1.a7642"]]},{"id":"c3d0ffc1.a7642","type":"ui_text","z":"7259aae9.ba1fa4","group":"f19ffc7.b96d5","order":1,"width":"12","height":"1","name":"Status","label":"","format":"{{msg.payload}}","layout":"row-spread","x":1077.9841842651367,"y":263.5396957397461,"wires":},{"id":"1fb1fdb1.a4bf92","type":"ui_gauge","z":"7259aae9.ba1fa4","name":"Anlagenverfügbarkeit","group":"48597deb.5c9894","order":0,"width":0,"height":0,"gtype":"gage","title":"","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#ff0000","#ffff00","#80ff00"],"seg1":"","seg2":"","x":1372.000244140625,"y":595.1430130004883,"wires":},{"id":"2e58c9bc.d4e706","type":"ui_gauge","z":"7259aae9.ba1fa4","name":"OEE","group":"598cb64b.a64368","order":0,"width":0,"height":0,"gtype":"gage","title":"","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#ff0000","#ffff00","#80ff00"],"seg1":"","seg2":"","x":1335.4289932250977,"y":710.1430225372314,"wires":},{"id":"a405631b.306a7","type":"ui_gauge","z":"7259aae9.ba1fa4","name":"Leistungsgrad","group":"1e445a8e.203a45","order":0,"width":0,"height":0,"gtype":"gage","title":"","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#ff0000","#ffff00","#80ff00"],"seg1":"","seg2":"","x":1361.0002975463867,"y":648.5715312957764,"wires":},{"id":"e47564ee.d233a8","type":"ui_gauge","z":"7259aae9.ba1fa4","name":"Qualität","group":"372b1ac3.350236","order":0,"width":0,"height":0,"gtype":"gage","title":"","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#ff0000","#ffff00","#80ff00"],"seg1":"","seg2":"","x":1334.7144470214844,"y":514.7143745422363,"wires":},{"id":"ef1440e8.2aebb","type":"inject","z":"7259aae9.ba1fa4","name":"","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":true,"x":1202.7144470214844,"y":514.7143745422363,"wires":[["e47564ee.d233a8"]]},{"id":"f1cda098.f888","type":"ui_text","z":"7259aae9.ba1fa4","group":"eccac165.4a15d","order":1,"width":"12","height":"1","name":"Wartung in:","label":"Wartung fällig in:","format":"{{msg.payload}} Tagen","layout":"row-spread","x":1210,"y":920,"wires":},{"id":"cda86e30.7d35a","type":"function","z":"7259aae9.ba1fa4","name":"Zähler","func":"msg.decrement = 1;\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":1000,"wires":[["5fca0e90.b9ff2"]]},{"id":"da6e8fea.a244a","type":"debug","z":"7259aae9.ba1fa4","name":"count","active":false,"console":"false","complete":"payload","x":1230.4284019470215,"y":997.7143411636353,"wires":},{"id":"5fca0e90.b9ff2","type":"counter","z":"7259aae9.ba1fa4","name":"","init":"32","step":"1","lower":"0","upper":"","mode":"decrement","outputs":"2","x":1031.857021331787,"y":994.857177734375,"wires":[["da6e8fea.a244a","f1cda098.f888"],["d45bfa88.a67d18"]]},{"id":"d45bfa88.a67d18","type":"debug","z":"7259aae9.ba1fa4","name":"message","active":false,"console":"false","complete":"true","x":1224.7141304016113,"y":1044.857190132141,"wires":},{"id":"fd92eecb.d28cb","type":"ui_button","z":"7259aae9.ba1fa4","name":"","group":"1a76756a.c0177b","order":3,"width":0,"height":0,"passthru":false,"label":"Wartungszähler Starten ?","tooltip":"Nur wenn zähler nicht von allein startet","color":"","bgcolor":"","icon":"","payload":"i","payloadType":"flow","topic":"","x":432.57104873657227,"y":997.7140636444092,"wires":[["586cbf8.752eb4"]]},{"id":"a187d7ee.aecc48","type":"function","z":"7259aae9.ba1fa4","name":"Reset","func":"msg.reset = 30;\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":1060,"wires":[["5fca0e90.b9ff2"]]},{"id":"6d63d715.7bd428","type":"ui_button","z":"7259aae9.ba1fa4","name":"","group":"1a76756a.c0177b","order":1,"width":0,"height":0,"passthru":false,"label":"Wartung erfolgt ?","tooltip":"","color":"","bgcolor":"","icon":"","payload":"i","payloadType":"flow","topic":"","x":169.2859344482422,"y":1050.4764499664307,"wires":[["a187d7ee.aecc48","fd92eecb.d28cb"]]},{"id":"586cbf8.752eb4","type":"trigger","z":"7259aae9.ba1fa4","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-24","extend":false,"units":"hr","reset":"","name":"","x":669.4285545349121,"y":997.0477857589722,"wires":[["cda86e30.7d35a"]]},{"id":"3b913795.3cd338","type":"function","z":"7259aae9.ba1fa4","name":"Bemerkung","func":"\n\nif (flow.get('siin') === "AA==" && \nflow.get('hain') === "AA==" &&\nflow.get('stin') === "AA==" &&\nflow.get('obin') === "AA==" &&\nflow.get('wain') === "AA==" &&\nflow.get('oein') === "AA==" ) {\nmsg.payload = "Die Reibspindelpresse ist ausgeschaltet.

1. Bitte Prüfen Sie ob der Luftdruck abgestellt ist. ";\n}\n\n\n\nif (flow.get('hain') === "AQ==") {\nmsg.payload = "Status: Stand By";\n}\n\nif (flow.get('siin') === "AQ==") {\nmsg.payload = "Status: Stand By";\n}\n\nif (flow.get('hain') === "AQ==" && flow.get('siin') === "AQ==" && flow.get('stin') === "AQ==") {\nmsg.payload = "Status: Einsatzbereit";\n}\n\nif (flow.get('oein') === "AQ==") {\nmsg.payload = "Zum beheben der Störung: 

1. Ă–l nachfĂĽllen 

2. Optional Ă–lpumpe prĂĽfen 

3. Optional Ölleitung prüfen" ;\n}\n\n\nif (flow.get('obin') === "AQ==") {\nmsg.payload = "Status: Störung Oberertotpunkt";\n}\n\nif (flow.get('wain') === "AQ==") {\nmsg.payload = "Status: Wartung";\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":942.0001106262207,"y":138.00001525878906,"wires":[["79ff07ad.a48c68"]]},{"id":"79ff07ad.a48c68","type":"ui_text","z":"7259aae9.ba1fa4","group":"c5ab468f.981298","order":1,"width":"0","height":"0","name":"Bemerkungen","label":"","format":"{{msg.payload}}","layout":"row-center","x":1125.0000553131104,"y":138.0000057220459,"wires":},{"id":"22e43036.90347","type":"ui_text","z":"7259aae9.ba1fa4","group":"3b07a5d6.4246ba","order":1,"width":"12","height":"1","name":"Wartung in:","label":"Ausgeführte Hübe:","format":"{{msg.payload}} Stück","layout":"row-spread","x":891.428596496582,"y":900.000020980835,"wires":},{"id":"f86cacc7.7624f","type":"function","z":"7259aae9.ba1fa4","name":"Zähler","func":"msg.increment = 1;\nreturn msg;","outputs":1,"noerr":0,"x":551.4286041259766,"y":907.1429042816162,"wires":[["3abf1208.d7a3ee"]]},{"id":"3abf1208.d7a3ee","type":"counter","z":"7259aae9.ba1fa4","name":"","init":"0","step":"1","lower":"","upper":"","mode":"increment","outputs":"2","x":711.8570365905762,"y":906.2857933044434,"wires":[["22e43036.90347"],]},{"id":"789d1afb.272e84","type":"function","z":"7259aae9.ba1fa4","name":"Status","func":"var huin = flow.get('huin');\n\nif (flow.get('huin') === "Ag==" ){\n msg.payload = "Hub";\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":408.57147216796875,"y":908.5714492797852,"wires":[["f86cacc7.7624f"]]},{"id":"e56fcf82.69892","type":"mqtt in","z":"7259aae9.ba1fa4","name":"Zweihand Einzelhub","topic":"pfannenberg/io-connect/00170d000059c3e4/pin/7","qos":"2","broker":"ee7cd723.3d96a8","x":174.2857208251953,"y":745.7142944335938,"wires":[["877ddcc2.997d2"]]},{"id":"877ddcc2.997d2","type":"json","z":"7259aae9.ba1fa4","name":"","pretty":false,"x":342.241512298584,"y":745.5671262741089,"wires":[["b7125f5.a0d2da"]]},{"id":"b7125f5.a0d2da","type":"change","z":"7259aae9.ba1fa4","name":"","rules":[{"t":"set","p":"zhub","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":535.2573699951172,"y":742.8686819076538,"wires":[["cd78732f.a434d"]]},{"id":"d847f4bb.d99268","type":"state-machine","z":"7259aae9.ba1fa4","name":"Signal","triggerProperty":"topic","triggerPropertyType":"msg","stateProperty":"topic","statePropertyType":"msg","outputStateChangeOnly":false,"throwException":false,"states":["AA==","AQ=="],"transitions":[{"name":"An","from":"AQ==","to":"AQ=="},{"name":"Aus","from":"AQ==","to":"AQ=="}],"x":421.5377731323242,"y":1185.9473571777344,"wires":[["b7ebadba.8f417"]]},{"id":"b7ebadba.8f417","type":"debug","z":"7259aae9.ba1fa4","name":"","active":true,"console":false,"complete":"payload","x":598.5962371826172,"y":1185.7291564941406,"wires":},{"id":"ee7cd723.3d96a8","type":"mqtt-broker","z":"","broker":"172.17.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"f19ffc7.b96d5","type":"ui_group","z":"","name":"Status","tab":"ba74f39a.c8d6e","order":7,"disp":true,"width":"12","collapse":false},{"id":"48597deb.5c9894","type":"ui_group","z":"","name":"Verfügbarkeit","tab":"ba74f39a.c8d6e","order":4,"disp":true,"width":"6","collapse":false},{"id":"598cb64b.a64368","type":"ui_group","z":"","name":"OEE","tab":"ba74f39a.c8d6e","order":3,"disp":true,"width":"6","collapse":false},{"id":"1e445a8e.203a45","type":"ui_group","z":"","name":"Leistungsgrad","tab":"ba74f39a.c8d6e","order":5,"disp":true,"width":"6","collapse":false},{"id":"372b1ac3.350236","type":"ui_group","z":"","name":"Qualität","tab":"ba74f39a.c8d6e","order":6,"disp":true,"width":"6","collapse":false},{"id":"eccac165.4a15d","type":"ui_group","z":"","name":"Wartung","tab":"ba74f39a.c8d6e","order":8,"disp":true,"width":"12","collapse":false},{"id":"1a76756a.c0177b","type":"ui_group","z":"","name":"Wartung","tab":"905afddf.43ae9","order":1,"disp":true,"width":"6","collapse":false},{"id":"c5ab468f.981298","type":"ui_group","z":"","name":"Bermerkungen zum Status:","tab":"ba74f39a.c8d6e","order":11,"disp":true,"width":"24","collapse":false},{"id":"3b07a5d6.4246ba","type":"ui_group","z":"","name":"Anzahl Hübe","tab":"ba74f39a.c8d6e","order":9,"disp":true,"width":"12","collapse":false},{"id":"ba74f39a.c8d6e","type":"ui_tab","z":"","name":"Dashboard der Reibspindelpresse","icon":"important_devices","order":2,"disabled":false,"hidden":false},{"id":"905afddf.43ae9","type":"ui_tab","z":"","name":"Wartungs-Dashboard der Reibspindelpresse","icon":"build","order":2,"disabled":false,"hidden":false}]

Please see this page on how to post code

https://discourse.nodered.org/t/how-to-share-code-or-flow-json/

This is a good case for a "Timeseries Database". The most popular amongst IoT people is InfluxDB. You will need to spend some time understanding the best data structure to use but once you have that, you can easily use Grafana to plot data and you can easily write queries that will answer your questions.

2 Likes

@Agrotar : I am not sure whether this topic is this occupying you, but I currently have to set up an OEE dashboard with NodeRed and Eclipse Streamsheets anyhow, so I stumbled across your post when googling for Node Red / OEE.

@TotallyInformation mentioned already that you can combine with Grafana. That certainly works and I have seen an interesting article on hackster.io about a guy doing that kind of set up (https://www.hackster.io/harit-shah/node-red-mqtt-with-google-sheets-ab1aa7).

My feeling was that this is kind of complicated, so I will go the following route: catch signals by NodeRed (or directly in Streamsheets), then use the MQTT node of Node Red to pump that into Streamsheets and do my OEE calculation + visualization over there.

Hmm, so not only do you need Docker to be installed but Streamsheets is not fully open source - I really can't quite comprehend what the Apache Foundation is up to these days. Whatever it is, I don't like it.

  • only available in the premium version

Introduction — Streamsheets 2.0.0 documentation (cedalo.com)

Noting that Streamsheets actually belongs to a commercial organisation.

Eclipse Streamsheets | projects.eclipse.org

Yes, there you are right. No Docker, no Streamsheets.
I think all the things you need for an OEE dashboard can be realized with Streamsheets like it is in the open Source version.

  • only available in the premium version

Introduction — Streamsheets 2.0.0 documentation (cedalo.com)

Yes, but this is the case for a lot of OS projects.

Not so much actually. Node-RED for example, ExpressJS, Mosquitto, ... too many to recount here. Apache used to be renown for its open source.

It just doesn't sit well when you are taken to the Apache Foundation for something and then, without any warning find yourself on a commercial website and they are talking about a premium version. I'm not against there being commercial software but I am against it not being clear where the boundaries are.

Then again, perhaps I am bias because I long ago went off Apache when they started focusing so heavily on Java.

I understand your concerns, but I think -at least in this case - the boundary is very clearly described on the docs page of the Streamsheets project. Instead of a generic bashing of a company for having a premium version of an open source SW, I recommend to take a look at the open source SW and what is in there.

I am well aware of tons of companies that pretend to be open source, but then you realize that you get just a “three-wheeled car without seats” when going for the OS version. But I do not think that this applies to Streamsheets.

btw: you mention Mosquitto. It is actually sponsored by the same company since several years...