[ { "id": "e97b17fb398bd142", "type": "tab", "label": "Flow 1", "disabled": false, "info": "", "env": [] }, { "id": "b7e5bee5810efbee", "type": "junction", "z": "e97b17fb398bd142", "x": 700, "y": 120, "wires": [ [ "70492a9caca5df14", "7d10ca43f1cbc11f", "580eec8125a98a82", "3fd370d97ec99d6c" ] ] }, { "id": "795b49360fe54226", "type": "junction", "z": "e97b17fb398bd142", "x": 160, "y": 40, "wires": [ [ "bf724fd696a8129f" ] ] }, { "id": "aaab317d03fbc73b", "type": "mysql", "z": "e97b17fb398bd142", "mydb": "e6aa57aa4aecb96c", "name": "", "x": 630, "y": 40, "wires": [ [] ] }, { "id": "ad60f2405ec74733", "type": "function", "z": "e97b17fb398bd142", "name": "Insert BDD", "func": "var temperature = msg.payload.temperature;\nvar humidite = msg.payload.humidite;\nvar pression = msg.payload.pression;\nvar gas = msg.payload.gas;\n\n// Construction de la requête SQL\nvar sql = `INSERT INTO patate (temperature, humidite, pression, gas) VALUES (${temperature}, ${humidite}, ${pression}, ${gas});`;\n\n// Envoi de la requête au noeud de base de données MYSQL\nreturn { topic: sql };\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 430, "y": 40, "wires": [ [ "aaab317d03fbc73b" ] ] }, { "id": "b966e24c56d94ef5", "type": "mqtt in", "z": "e97b17fb398bd142", "name": "", "topic": "esp32/bme", "qos": "2", "datatype": "json", "broker": "9c9dca47cea6d88d", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 80, "y": 40, "wires": [ [ "d8bd9017e1a2ec2e", "795b49360fe54226" ] ] }, { "id": "d8bd9017e1a2ec2e", "type": "json", "z": "e97b17fb398bd142", "name": "", "property": "topic", "action": "str", "pretty": false, "x": 270, "y": 40, "wires": [ [ "ad60f2405ec74733" ] ] }, { "id": "cba3058273d79299", "type": "ui_gauge", "z": "e97b17fb398bd142", "name": "", "group": "c1379e738be9ccdb", "order": 1, "width": 3, "height": 3, "gtype": "donut", "title": "Temperature", "label": "°C", "format": "{{value}}", "min": "0", "max": "50", "colors": [ "#62a0ea", "#ffa348", "#ca3838" ], "seg1": "20", "seg2": "30", "diff": false, "className": "", "x": 1070, "y": 40, "wires": [] }, { "id": "3fd370d97ec99d6c", "type": "function", "z": "e97b17fb398bd142", "name": "Temperature", "func": "// Récupération de l'objet\nvar objet = msg.payload[0];\n\n// Récupération de la valeur de la propriété \"temperature\"\nvar temperature = objet.temperature;\n\n// Conversion de la valeur en nombre\nvar nombre = parseFloat(temperature);\n\n// Envoi du nombre au noeud suivant\nreturn { payload: nombre};\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 40, "wires": [ [ "cba3058273d79299" ] ] }, { "id": "580eec8125a98a82", "type": "function", "z": "e97b17fb398bd142", "name": "Pression", "func": "// Récupération de l'objet\nvar objet = msg.payload[0];\n\n// Récupération de la valeur de la propriété \"pression\"\nvar pression = objet.pression;\n\n// Conversion de la valeur en nombre\nvar nombre = parseFloat(pression);\n\n// Envoi du nombre au noeud suivant\nreturn { payload: nombre};\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 880, "y": 100, "wires": [ [ "e28975d7ac1a761f" ] ] }, { "id": "7d10ca43f1cbc11f", "type": "function", "z": "e97b17fb398bd142", "name": "humidite", "func": "// Récupération de l'objet\nvar objet = msg.payload[0];\n\n// Récupération de la valeur de la propriété \"humidite\"\nvar humidite = objet.humidite;\n\n// Conversion de la valeur en nombre\nvar nombre = parseFloat(humidite);\n\n// Envoi du nombre au noeud suivant\nreturn { payload: nombre};\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 880, "y": 160, "wires": [ [ "500ccdad72bc63a3" ] ] }, { "id": "70492a9caca5df14", "type": "function", "z": "e97b17fb398bd142", "name": "Gaz", "func": "// Récupération de l'objet\nvar objet = msg.payload[0];\n\n// Récupération de la valeur de la propriété \"gas\"\nvar gas = objet.gas;\n\n// Conversion de la valeur en nombre\nvar nombre = parseFloat(gas);\n\n// Envoi du nombre au noeud suivant\nreturn { payload: nombre};\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 870, "y": 220, "wires": [ [ "1293cd3b6682a2e0" ] ] }, { "id": "e28975d7ac1a761f", "type": "ui_text", "z": "e97b17fb398bd142", "group": "c1379e738be9ccdb", "order": 4, "width": 6, "height": 1, "name": "", "label": "Pression", "format": "{{msg.payload}} hPa", "layout": "row-spread", "className": "", "x": 1060, "y": 100, "wires": [] }, { "id": "1293cd3b6682a2e0", "type": "ui_text", "z": "e97b17fb398bd142", "group": "c1379e738be9ccdb", "order": 3, "width": 6, "height": 1, "name": "", "label": "Gaz", "format": "{{msg.payload}} ppm", "layout": "row-spread", "className": "", "x": 1050, "y": 220, "wires": [] }, { "id": "500ccdad72bc63a3", "type": "ui_gauge", "z": "e97b17fb398bd142", "name": "", "group": "c1379e738be9ccdb", "order": 2, "width": 3, "height": 3, "gtype": "wave", "title": "Humidité", "label": "%", "format": "{{value}}", "min": 0, "max": "100", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "diff": false, "className": "", "x": 1060, "y": 160, "wires": [] }, { "id": "0ec05e52197b5fa5", "type": "ui_switch", "z": "e97b17fb398bd142", "name": "", "label": "LED ESP", "tooltip": "", "group": "5a56ae1a635f3a41", "order": 4, "width": 6, "height": 1, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": true, "className": "", "x": 80, "y": 380, "wires": [ [ "316f2f52586d8291" ] ] }, { "id": "1ada4016ea3bcae7", "type": "ui_template", "z": "e97b17fb398bd142", "group": "419d1a9600b629d8", "name": "", "order": 1, "width": 6, "height": 12, "format": "\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n
Temp.HumiditePressionGaz
{{row.temperature}} °C{{row.humidite}} %{{row.pression}} hPa{{row.gas}} ppm
", "storeOutMessages": true, "fwdInMessages": true, "resendOnRefresh": true, "templateScope": "local", "className": "", "x": 880, "y": 260, "wires": [ [] ] }, { "id": "f15d8483d0559a28", "type": "mysql", "z": "e97b17fb398bd142", "mydb": "e6aa57aa4aecb96c", "name": "", "x": 630, "y": 120, "wires": [ [ "b7e5bee5810efbee", "1ada4016ea3bcae7" ] ] }, { "id": "bf724fd696a8129f", "type": "function", "z": "e97b17fb398bd142", "name": "Affichage tableau", "func": "var sql = 'SELECT * FROM patate ORDER BY id DESC LIMIT 100;';\nreturn { topic: sql };\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 450, "y": 120, "wires": [ [ "f15d8483d0559a28" ] ] }, { "id": "316f2f52586d8291", "type": "mqtt out", "z": "e97b17fb398bd142", "name": "", "topic": "esp32/ledE", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "9c9dca47cea6d88d", "x": 270, "y": 380, "wires": [] }, { "id": "134d4ef865de22cc", "type": "mqtt out", "z": "e97b17fb398bd142", "name": "", "topic": "esp32/motor", "qos": "0", "retain": "true", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "9c9dca47cea6d88d", "x": 270, "y": 260, "wires": [] }, { "id": "94fa295fdd5c72ee", "type": "ui_switch", "z": "e97b17fb398bd142", "name": "", "label": "LED Rouge ", "tooltip": "", "group": "5a56ae1a635f3a41", "order": 5, "width": 6, "height": 1, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": true, "className": "", "x": 90, "y": 460, "wires": [ [ "540c9af9894adcb9" ] ] }, { "id": "540c9af9894adcb9", "type": "mqtt out", "z": "e97b17fb398bd142", "name": "", "topic": "esp32/ledR", "qos": "0", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "9c9dca47cea6d88d", "x": 270, "y": 460, "wires": [] }, { "id": "c454874f69fe7b17", "type": "ui_button", "z": "e97b17fb398bd142", "name": "", "group": "5a56ae1a635f3a41", "order": 2, "width": 3, "height": 1, "passthru": false, "label": "Gauche", "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "rotate_left", "payload": "Rotation Gauche", "payloadType": "str", "topic": "topic", "topicType": "msg", "x": 80, "y": 260, "wires": [ [ "3bf7807b13227c93", "134d4ef865de22cc" ] ] }, { "id": "88d194a029a1533c", "type": "ui_button", "z": "e97b17fb398bd142", "name": "", "group": "5a56ae1a635f3a41", "order": 3, "width": 3, "height": 1, "passthru": false, "label": "Droite", "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "rotate_right", "payload": "Rotation Droite", "payloadType": "str", "topic": "topic", "topicType": "msg", "x": 70, "y": 320, "wires": [ [ "3bf7807b13227c93", "134d4ef865de22cc" ] ] }, { "id": "3bf7807b13227c93", "type": "ui_text", "z": "e97b17fb398bd142", "group": "5a56ae1a635f3a41", "order": 1, "width": 6, "height": 1, "name": "", "label": "Moteur", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 260, "y": 320, "wires": [] }, { "id": "aabc1757a80ddec7", "type": "ui_ui_control", "z": "e97b17fb398bd142", "name": "", "events": "all", "x": 80, "y": 200, "wires": [ [ "4ca52a290b7e3f8b" ] ] }, { "id": "4ca52a290b7e3f8b", "type": "function", "z": "e97b17fb398bd142", "name": "Notifications Status", "func": "var nbU;\n\nif (msg.payload.includes(\"connect\")) {\n nbU =\"+1 utilisateur\";\n msg.payload = nbU;\n return msg;\n} else if (msg.payload.includes(\"lost\")) {\n nbU = \"-1 utilisateur\";\n msg.payload = nbU;\n return msg;\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 270, "y": 200, "wires": [ [ "6bb6195cae7c1ff7" ] ] }, { "id": "6bb6195cae7c1ff7", "type": "ui_toast", "z": "e97b17fb398bd142", "position": "top right", "displayTime": "4", "highlight": "", "sendall": true, "outputs": 0, "ok": "OK", "cancel": "Cancel", "raw": false, "className": "", "topic": "Infos", "name": "Connection/Deconnection", "x": 510, "y": 200, "wires": [] }, { "id": "e9f35de287f233e0", "type": "mqtt out", "z": "e97b17fb398bd142", "name": "", "topic": "esp32/lcd", "qos": "0", "retain": "true", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "9c9dca47cea6d88d", "x": 380, "y": 520, "wires": [] }, { "id": "e2f39162309260a3", "type": "ui_form", "z": "e97b17fb398bd142", "name": "", "label": "", "group": "5a56ae1a635f3a41", "order": 6, "width": 6, "height": 1, "options": [ { "label": "", "value": "Msg", "type": "text", "required": false, "rows": null } ], "formValue": { "Msg": "" }, "payload": "", "submit": "submit", "cancel": "cancel", "topic": "topic", "topicType": "msg", "splitLayout": "", "className": "", "x": 70, "y": 520, "wires": [ [ "d2958985c50e2742" ] ] }, { "id": "d2958985c50e2742", "type": "split", "z": "e97b17fb398bd142", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 230, "y": 520, "wires": [ [ "e9f35de287f233e0" ] ] }, { "id": "e6aa57aa4aecb96c", "type": "MySQLdatabase", "name": "", "host": "127.0.0.1", "port": "3306", "db": "patate", "tz": "", "charset": "UTF8" }, { "id": "9c9dca47cea6d88d", "type": "mqtt-broker", "name": "RPI", "broker": "127.0.0.1", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "30", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" }, { "id": "c1379e738be9ccdb", "type": "ui_group", "name": "Capteur BME680", "tab": "0fd2062b0acece06", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "5a56ae1a635f3a41", "type": "ui_group", "name": "Modification d'états", "tab": "0fd2062b0acece06", "order": 2, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "419d1a9600b629d8", "type": "ui_group", "name": "Historique", "tab": "0e6e0a70dad84974", "order": 1, "disp": true, "width": "6", "collapse": true, "className": "" }, { "id": "0fd2062b0acece06", "type": "ui_tab", "name": "Menu", "icon": "menu", "order": 2, "disabled": false, "hidden": false }, { "id": "0e6e0a70dad84974", "type": "ui_tab", "name": "Historique", "icon": "history", "order": 2, "disabled": false, "hidden": false } ]