[{"id":"7f5e9c3c.4c5a24","type":"mqtt out","z":"681f8e2c.e4fde","name":"","topic":"","qos":"","retain":"","broker":"37b5fb05.a852a4","x":1184.4643936157227,"y":118.71429634094238,"wires":[]},{"id":"3be988a0.7fe888","type":"e-mail","z":"681f8e2c.e4fde","server":"smtp.gmail.com","port":"465","secure":true,"name":"surveillanceimprimante3d@gmail.com","dname":"Email","x":1382.3613681793213,"y":331.94456481933594,"wires":[]},{"id":"d510a9c6.b9f4c8","type":"mqtt in","z":"681f8e2c.e4fde","name":"Image","topic":"printcam/live","qos":"0","broker":"37b5fb05.a852a4","x":90,"y":669,"wires":[["e7ead2bc.1a246"]]},{"id":"1fbd3522.9f3e9b","type":"debug","z":"681f8e2c.e4fde","name":"Dashboard Log","active":true,"console":"false","complete":"payload","x":2068.666664123535,"y":244.33332920074463,"wires":[]},{"id":"c5c567f0.fd4788","type":"function","z":"681f8e2c.e4fde","name":"Enregistre les événements","func":"// Créé une variable pour stocker le journal du dashboard si inexistante\n// initialise the counter to 0 if it doesn't exist already\nvar dashboardLog = context.get('dashboardLog')|| [];\n\ndashboardLog.push(msg);\nif (dashboardLog.length > 20){\n // Supprime le plus anciens message si > 20\n // Delete oldest message if > 20\n dashboardLog.shift();\n dashboardLog.length = 20;\n} \n\n// Enregistre les messages du dashboard pour le prochain affichage\n// store the value back\ncontext.set('dashboardLog',dashboardLog);\n\n// Affiche le journal des messages\n// make it part of the outgoing msg object\nmsg = {};\nmsg.payload = dashboardLog;\nreturn msg;\n","outputs":1,"noerr":0,"x":1801.0000457763672,"y":243.00000762939453,"wires":[["1fbd3522.9f3e9b","7d038e86.d8107"]]},{"id":"700b456f.6938cc","type":"mqtt out","z":"681f8e2c.e4fde","name":"","topic":"mail","qos":"","retain":"","broker":"37b5fb05.a852a4","x":510,"y":829,"wires":[]},{"id":"3ee4dea8.cf8cc2","type":"function","z":"681f8e2c.e4fde","name":"Retranscription TOPIC + PAY","func":"// MACHINE 1\n\nif (msg.payload == \"oui\"){\n msg.payload = \"Voir le live\"\n msg.topic = \"Appui sur BP\";\n}\n\nif (msg.payload == \"start\"){\n msg.payload = \"Allumer/Eteindre lumière + image\"\n msg.topic = \"Appui sur BP\"; \n}\n\nif (msg.payload == \"stop\"){\n msg.payload = \"Arrêter l'impression\"\n msg.topic = \"Appui sur BP\"; \n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1105.3333587646484,"y":238.33333587646484,"wires":[["c5c567f0.fd4788"]]},{"id":"c545e31f.f7ea9","type":"inject","z":"681f8e2c.e4fde","name":"green","topic":"","payload":"green","payloadType":"str","repeat":"","crontab":"","once":false,"x":218.33331298828125,"y":1042.333251953125,"wires":[["a448dbad.e28a88"]]},{"id":"8f15fba5.8f5518","type":"inject","z":"681f8e2c.e4fde","name":"orange","topic":"","payload":"orange","payloadType":"str","repeat":"","crontab":"","once":false,"x":218.33331298828125,"y":1082.333251953125,"wires":[["a448dbad.e28a88"]]},{"id":"a448dbad.e28a88","type":"function","z":"681f8e2c.e4fde","name":"Fonction couleur","func":"msg.colour=msg.payload;\nmsg.payload=undefined;\nreturn msg;","outputs":1,"noerr":0,"x":493.33331298828125,"y":1134.333236694336,"wires":[["8fcbe841.6e85a8"]]},{"id":"45f140a6.d10a8","type":"inject","z":"681f8e2c.e4fde","name":"blue","topic":"","payload":"blue","payloadType":"str","repeat":"","crontab":"","once":false,"x":218.33331298828125,"y":1122.333251953125,"wires":[["a448dbad.e28a88"]]},{"id":"e103e08a.07fa1","type":"inject","z":"681f8e2c.e4fde","name":"yellow","topic":"","payload":"yellow","payloadType":"str","repeat":"","crontab":"","once":false,"x":218.33331298828125,"y":1162.333251953125,"wires":[["a448dbad.e28a88"]]},{"id":"e3dd408a.eb8c1","type":"inject","z":"681f8e2c.e4fde","name":"white","topic":"","payload":"white","payloadType":"str","repeat":"","crontab":"","once":false,"x":218.33331298828125,"y":1202.333251953125,"wires":[["a448dbad.e28a88"]]},{"id":"630162c0.aef93c","type":"inject","z":"681f8e2c.e4fde","name":"pink","topic":"","payload":"pink","payloadType":"str","repeat":"","crontab":"","once":false,"x":218.33331298828125,"y":1242.333251953125,"wires":[["a448dbad.e28a88"]]},{"id":"ebd9f0af.184f1","type":"inject","z":"681f8e2c.e4fde","name":"red and light text","topic":"","payload":"red","payloadType":"str","repeat":"","crontab":"","once":false,"x":248.33331298828125,"y":1282.333251953125,"wires":[["a448dbad.e28a88"]]},{"id":"5f64a50b.6ae95c","type":"mqtt in","z":"681f8e2c.e4fde","name":"","topic":"printcam/temp","qos":"2","broker":"37b5fb05.a852a4","x":203.10000610351562,"y":965.0000295639038,"wires":[["98217ad.29c9488","8fcbe841.6e85a8"]]},{"id":"98217ad.29c9488","type":"debug","z":"681f8e2c.e4fde","name":"","active":true,"console":"false","complete":"payload","x":561.1000595092773,"y":966.0000286102295,"wires":[]},{"id":"9dad4f76.c9048","type":"comment","z":"681f8e2c.e4fde","name":"Gestion des boutons ","info":"Voir le Live : \n- Génère un message en MQTT qui va être envoyé et interprété par Node-Red sur le Raspberry pour prendre une photo\n- Les paramètres \"msg.payload\" et \"msg.topic\" vont être changés par le node \"Function\" afin d'être affichés dans le journal d'évènement \n\nAllumer/Eteindre lumière + image :\nIdem qu'au-dessus, sauf que les paramètres MQTT vont être interprétés par Node-Red sur Rpi pour la prise d'image qui sera envoyée sur 1 adresse mail, mais aussi dans le programme en python pour tourner le servo-moteur pour l'allumage de la lumière\n\nArrêter l'impression : \n- Idem pour MQTT/journal d'event\n- Un Mail va être envoyé pour prévenir qu'une action d'arrêt a été exécuté\n- Notif + Son seront également présents => Action sensible \n\n","x":288.5000190734863,"y":55,"wires":[]},{"id":"bf386bf.82cbd98","type":"comment","z":"681f8e2c.e4fde","name":"Live","info":"L'image est reçue en MQTT (envoyée depuis Node-Red Rpi), transcrite en Base 64 avant d'être affichée sur le Dashboard","x":278.50000381469727,"y":600.0000305175781,"wires":[]},{"id":"7b8b28c9.7c4768","type":"comment","z":"681f8e2c.e4fde","name":"Sélection adresse e-mail","info":"La chaîne de caractères entrée par l'utilisateur sera envoyée sur Node-Red Rpi pour être interprétée","x":315.16667683919263,"y":763.3333333333333,"wires":[]},{"id":"94786dd6.88ba1","type":"comment","z":"681f8e2c.e4fde","name":"Affichage divers","info":"On reçoit en MQTT la température envoyée par la CPU du Rpi et on l'affiche\nOn peut choisir la couleur d'affichage pour JJ/HH/MM/AA et température\nOn affiche les noms de l'équipe et le logo UHA ","x":311.8333435058593,"y":908.3333333333331,"wires":[]},{"id":"5bbf76f7.090368","type":"function","z":"681f8e2c.e4fde","name":"Retourne heure si impulsion","func":"// Create a Date object from the payload\nvar date = new Date(msg.payload);\n// Change the payload to be a formatted Date string\nstr = date.toString();\nmsg.payload = str.substr(16,8);\n// Return the message so it can be sent on\nreturn msg;","outputs":1,"noerr":0,"x":1252.595531463623,"y":550.0992364883423,"wires":[["73081e4d.59d67"]]},{"id":"b75803c2.69723","type":"change","z":"681f8e2c.e4fde","name":"Génération impulsion","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":972.928825378418,"y":550.4325494766235,"wires":[["5bbf76f7.090368"]]},{"id":"73081e4d.59d67","type":"change","z":"681f8e2c.e4fde","name":"Adaptation pour affichage","rules":[{"t":"move","p":"payload","pt":"msg","to":"date","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Heure :","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1522.9288368225098,"y":549.7658824920654,"wires":[["c5c567f0.fd4788"]]},{"id":"99eea572.826758","type":"comment","z":"681f8e2c.e4fde","name":"Affichage heure sur journal","info":"","x":1386.500061035156,"y":500.6666666666666,"wires":[]},{"id":"c84be62.f0ee618","type":"ui_button","z":"681f8e2c.e4fde","name":"","group":"17f77e9c.730751","order":1,"width":0,"height":0,"passthru":false,"label":"Allumer/Eteindre lumière + image ","color":"","bgcolor":"#0000FF","icon":"power_settings_new","payload":"start","payloadType":"str","topic":"printcam/servo","x":145,"y":242.33330917358398,"wires":[["3ee4dea8.cf8cc2","b75803c2.69723","7f5e9c3c.4c5a24"]]},{"id":"b45ed428.2dfac8","type":"ui_button","z":"681f8e2c.e4fde","name":"","group":"17f77e9c.730751","order":2,"width":0,"height":0,"passthru":true,"label":"Arrêter l'impression","color":"","bgcolor":"#FF0000","icon":"warning","payload":"stop","payloadType":"str","topic":"printcam/servo","x":110,"y":340,"wires":[["7f5e9c3c.4c5a24","3ee4dea8.cf8cc2","dbf9b4db.6c1488","5896e04.898f82","fc049481.2fd768","b75803c2.69723"]]},{"id":"da8e3f00.c652","type":"ui_button","z":"681f8e2c.e4fde","name":"","group":"17f77e9c.730751","order":3,"width":0,"height":0,"passthru":false,"label":"Voir le Live","color":"","bgcolor":"#2EFE2E","icon":"switch_video","payload":"oui","payloadType":"str","topic":"printcam/servo","x":90,"y":120,"wires":[["549a2706.3db888","3ee4dea8.cf8cc2","b75803c2.69723"]]},{"id":"e2d2bb75.22b318","type":"ui_text_input","z":"681f8e2c.e4fde","name":"","label":"Mail pour envoi image dès validation :","group":"17f77e9c.730751","order":0,"width":0,"height":0,"passthru":true,"mode":"email","delay":300,"topic":"mail","x":190,"y":829,"wires":[["700b456f.6938cc"]]},{"id":"fc049481.2fd768","type":"ui_audio","z":"681f8e2c.e4fde","name":"STOP son ","group":"17f77e9c.730751","voice":"fr-FR","always":"","x":1039.7666473388672,"y":439.73336696624756,"wires":[]},{"id":"5896e04.898f82","type":"ui_toast","z":"681f8e2c.e4fde","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"OK","cancel":"","topic":"l'impression va s'arrêter","name":"Notif arrêt","x":1046.766746520996,"y":394.73336696624756,"wires":[[]]},{"id":"31507bad.548eb4","type":"ui_template","z":"681f8e2c.e4fde","group":"17f77e9c.730751","name":"LOGO UHA","order":6,"width":"0","height":"0","format":"
\n\n
\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":766.7619247436523,"y":1261.952314376831,"wires":[[]]},{"id":"815a204c.e8cba","type":"ui_template","z":"681f8e2c.e4fde","group":"17f77e9c.730751","name":"NOMS","order":5,"width":"3","height":"2","format":"
\n

GRINAN Johann (DUT GEII)

\n

WILLIG Jérôme (DUT GEII)

\n

MACCAGLIA Hugo (DUT GMP)

\n

MEISTER Jonathan (DUT GMP)

\n

HARDY Noémie (DUT GMP)

\n
\n\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":745.1905364990234,"y":1198.8094882965088,"wires":[[]]},{"id":"7d038e86.d8107","type":"ui_template","z":"681f8e2c.e4fde","group":"58b335ad.3fc36c","name":"Journal des événement (Heure UTC)","order":1,"width":"8","height":"6","format":"\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":2128.666664123535,"y":299.00000190734863,"wires":[[]]},{"id":"c69e42cf.8e87e","type":"ui_template","z":"681f8e2c.e4fde","group":"58b335ad.3fc36c","name":"Message temp","order":0,"width":"2","height":"3","format":"
\n

La température affichée est celle de la CPU. Au-dessus de 80°, le Raspberry s'éteindra automatiquement !

\n
","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":775.1000366210938,"y":1071.3999938964844,"wires":[[]]},{"id":"549a2706.3db888","type":"trigger","z":"681f8e2c.e4fde","op1":"","op2":"","op1type":"pay","op2type":"pay","duration":"5","extend":false,"units":"s","reset":"","name":"","x":790.3928833007812,"y":121.4642972946167,"wires":[["7f5e9c3c.4c5a24"]]},{"id":"a8fb8419.5c8648","type":"comment","z":"681f8e2c.e4fde","name":"Résolution de problème","info":"Suite à un problème sur la prise d'image,\nnous envoyons une deuxième demande de prise\nd'image et l'image parvient bien sur le site !","x":788.0357818603516,"y":74.10714626312256,"wires":[]},{"id":"dbf9b4db.6c1488","type":"function","z":"681f8e2c.e4fde","name":"Mise en forme Email","func":"var email = {\n payload : \"L'impression a été stoppée\", \n topic : \"Info commande\", \n description : msg.topic\n};\nreturn email;","outputs":1,"noerr":0,"x":1086.3335266113281,"y":332.33338356018066,"wires":[["3be988a0.7fe888"]]},{"id":"e7ead2bc.1a246","type":"ui_template","z":"681f8e2c.e4fde","group":"8225d448.ce5048","name":"Transcris B64 en image ","order":1,"width":"6","height":"5","format":"\"image\"","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":317.5,"y":668.5,"wires":[[]]},{"id":"8fcbe841.6e85a8","type":"ui_template","z":"681f8e2c.e4fde","group":"8225d448.ce5048","name":"Time and Temp","order":2,"width":"6","height":"2","format":"\n\n\n\n\n
\n\n\t\n\t\n\t\n\n\t0\n\tC\n\t\n\t\n
\n\n","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":772.5,"y":1135,"wires":[[]]},{"id":"37b5fb05.a852a4","type":"mqtt-broker","z":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"17f77e9c.730751","type":"ui_group","z":"681f8e2c.e4fde","name":"Commande","tab":"864ab3c0.f3cf2","order":1,"disp":true,"width":"6"},{"id":"58b335ad.3fc36c","type":"ui_group","z":"681f8e2c.e4fde","name":"Journal des événements (Heure UTC)","tab":"864ab3c0.f3cf2","order":5,"disp":true,"width":"8"},{"id":"8225d448.ce5048","type":"ui_group","z":0,"name":"Live","tab":"864ab3c0.f3cf2","order":2,"disp":true,"width":"6"},{"id":"864ab3c0.f3cf2","type":"ui_tab","z":"681f8e2c.e4fde","name":"Surveillance imprimante GMP","icon":"dashboard"}]