Pastebin
Retrouvez, créez et partagez vos snippets en temps réel.
Rechercher un Pastebin
Aucun paste trouvé.
Créer un paste
Pastebin
Blog
rtezt
[ { "id": "7db3b30dc762d89d", "type": "tab", "label": "Flux 1", "disabled": false, "info": "", "env": [] }, { "id": "42aa7c056847c85b", "type": "ui_template", "z": "7db3b30dc762d89d", "group": "6ed62c5740adf91e", "name": "", "order": 2, "width": 30, "height": 6, "format": "<style>\n /* --- THEME BLANC / CLAIR --- */\n .atv-panel {\n font-family: 'Helvetica Neue', Arial, sans-serif;\n background: #ffffff;\n color: #333;\n padding: 15px;\n border-radius: 8px;\n border: 1px solid #e0e0e0;\n box-shadow: 0 2px 12px rgba(0,0,0,0.08);\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n }\n\n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 2px solid #f0f0f0;\n padding-bottom: 10px;\n margin-bottom: 15px;\n }\n .title { font-weight: 600; color: #555; font-size: 14px; text-transform: uppercase; }\n\n /* Zone Centrale : Vitesse Réelle */\n .lcd-screen {\n background: #f9f9f9;\n color: #27ae60; /* Vert par défaut */\n font-family: 'Roboto Mono', monospace;\n padding: 15px;\n font-size: 32px;\n font-weight: bold;\n text-align: center;\n border-radius: 6px;\n border: 1px solid #ddd;\n margin-bottom: 20px;\n transition: color 0.3s;\n }\n .unit { font-size: 14px; color: #999; font-weight: normal; }\n\n /* Boutons */\n .controls-row {\n display: flex;\n gap: 12px;\n margin-bottom: 20px;\n }\n .btn-custom {\n flex: 1;\n padding: 14px;\n border: 1px solid #ddd;\n border-radius: 6px;\n background: #f0f0f0;\n color: #666;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n text-transform: uppercase;\n font-size: 18px;\n display: flex;\n flex-direction: column;\n align-items: center;\n box-shadow: 0 2px 4px rgba(0,0,0,0.05);\n }\n\n /* États Actifs */\n .btn-custom.active-green {\n background: #2ecc71;\n color: white;\n border-color: #27ae60;\n box-shadow: 0 4px 8px rgba(46, 204, 113, 0.4);\n }\n /* AVANT (Bleu) */\n .btn-custom.active-blue {\n background: #3498db;\n color: white;\n border-color: #2980b9;\n box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4);\n }\n /* ARRIERE (Rouge) */\n .btn-custom.active-red {\n background: #e74c3c;\n color: white;\n border-color: #c0392b;\n box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4);\n }\n\n /* Slider */\n .slider-container {\n padding: 10px 0;\n background: #fafafa;\n border-radius: 8px;\n padding: 10px;\n border: 1px solid #eee;\n }\n input[type=range] {\n -webkit-appearance: none;\n width: 100%;\n background: transparent;\n }\n input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n height: 22px;\n width: 22px;\n border-radius: 50%;\n background: #3498db;\n cursor: pointer;\n margin-top: -9px;\n box-shadow: 0 0 5px rgba(0,0,0,0.2);\n }\n input[type=range]::-webkit-slider-runnable-track {\n width: 100%;\n height: 4px;\n background: #ddd;\n border-radius: 2px;\n }\n .slider-infos {\n display: flex;\n justify-content: space-between;\n font-size: 20px;\n color: #888;\n margin-top: 8px;\n font-weight: 500;\n }\n</style>\n\n<div class=\"atv-panel\">\n \n <div class=\"header\">\n <span class=\"title\">Contrôle Moteur</span>\n <div style=\"width:10px; height:10px; border-radius:50%;\" \n ng-style=\"{'background': status.enable ? '#2ecc71' : '#ccc'}\">\n </div>\n </div>\n\n <div class=\"lcd-screen\">\n {{ displaySpeed }} <span class=\"unit\">Hz (x10)</span>\n </div>\n\n <div class=\"controls-row\">\n <button class=\"btn-custom\" \n ng-class=\"{'active-green': status.enable}\" \n ng-click=\"toggleEnable()\">\n {{ status.enable ? 'MARCHE' : 'ARRÊT' }}\n </button>\n\n <button class=\"btn-custom\" \n ng-class=\"{'active-blue': status.forward, 'active-red': !status.forward}\" \n ng-click=\"toggleDirection()\">\n {{ status.forward ? 'AVANT' : 'ARRIÈRE' }}\n </button>\n </div>\n\n <div class=\"slider-container\" style=\"opacity: {{ status.enable ? 1 : 0.5 }}\">\n <input type=\"range\" min=\"0\" max=\"500\" step=\"1\" \n ng-model=\"status.speedRef\" \n ng-change=\"updateSpeed()\"\n ng-disabled=\"!status.enable\">\n \n <div class=\"slider-infos\">\n <span>0</span>\n <span style=\"color:#3498db\">Consigne : {{ status.speedRef }}</span>\n <span>500</span>\n </div>\n </div>\n\n</div>\n\n<script>\n (function(scope) {\n scope.status = scope.status || {\n enable: false,\n forward: true,\n speedRef: 0\n };\n scope.displaySpeed = 0; \n\n // --- CORRECTION POINT 2 (AFFICHER LA VITESSE) ---\n // On surveille tous les messages entrants\n scope.$watch('msg', function(data) {\n // Si on reçoit un message avec un payload numérique, c'est la vitesse réelle\n // On vérifie aussi le topic \"feedback\" pour être sûr, mais on est plus souple\n if (data && (data.topic === 'feedback' || typeof data.payload === 'number')) {\n scope.displaySpeed = data.payload; \n }\n });\n\n scope.toggleEnable = function() {\n scope.status.enable = !scope.status.enable;\n if(!scope.status.enable) {\n scope.status.speedRef = 0;\n scope.send({ topic: \"set_speed\", payload: 0 }); \n }\n scope.send({ topic: \"set_enable\", payload: scope.status.enable ? 1 : 0 });\n };\n\n scope.toggleDirection = function() {\n scope.status.forward = !scope.status.forward;\n scope.send({ topic: \"set_direction\", payload: scope.status.forward ? \"fwd\" : \"rev\" });\n };\n\n scope.updateSpeed = function() {\n scope.send({ topic: \"set_speed\", payload: parseInt(scope.status.speedRef) });\n };\n\n })(scope);\n</script>", "storeOutMessages": true, "fwdInMessages": true, "resendOnRefresh": true, "templateScope": "local", "className": "", "x": 800, "y": 1260, "wires": [ [ "4470421be09f5ed2" ] ] }, { "id": "6d5130e2ddeae5ad", "type": "modbus-read", "z": "7db3b30dc762d89d", "name": "", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "7", "quantity": "1", "rate": "1", "rateUnit": "s", "delayOnStart": false, "enableDeformedMessages": false, "startDelayTime": "", "server": "ae9de57610f83d51", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 150, "y": 1260, "wires": [ [ "e233584986714034" ], [] ] }, { "id": "5944236befcac78e", "type": "change", "z": "7db3b30dc762d89d", "name": "", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "feedback", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 560, "y": 1260, "wires": [ [ "42aa7c056847c85b" ] ] }, { "id": "4470421be09f5ed2", "type": "switch", "z": "7db3b30dc762d89d", "name": "", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", "v": "set_enable", "vt": "str" }, { "t": "eq", "v": "set_direction", "vt": "str" }, { "t": "eq", "v": "set_speed", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 1000, "y": 1260, "wires": [ [ "eac09440fec0690e" ], [ "3648a884b58b6334" ], [ "34a294d76e89990a", "de5e84f968799bd8" ] ] }, { "id": "eac09440fec0690e", "type": "modbus-write", "z": "7db3b30dc762d89d", "name": "", "showStatusActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "0", "quantity": "1", "server": "ae9de57610f83d51", "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 1200, "y": 1180, "wires": [ [], [] ] }, { "id": "34a294d76e89990a", "type": "modbus-write", "z": "7db3b30dc762d89d", "name": "", "showStatusActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "5", "quantity": "1", "server": "ae9de57610f83d51", "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 1200, "y": 1340, "wires": [ [], [] ] }, { "id": "3648a884b58b6334", "type": "function", "z": "7db3b30dc762d89d", "name": "function 4", "func": "// Si demande Forward\nif (msg.payload === \"fwd\") {\n return [\n { payload: 1, topic: \"write_fwd\" }, // Vers Adr 1\n { payload: 0, topic: \"write_rev\" } // Vers Adr 2\n ];\n}\n// Si demande Reverse\nelse {\n return [\n { payload: 0, topic: \"write_fwd\" }, // Vers Adr 1\n { payload: 1, topic: \"write_rev\" } // Vers Adr 2\n ];\n}", "outputs": 2, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1160, "y": 1260, "wires": [ [ "ace36ff6f570ae2c" ], [ "d397ae243ce68de6" ] ] }, { "id": "ace36ff6f570ae2c", "type": "modbus-write", "z": "7db3b30dc762d89d", "name": "", "showStatusActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "1", "quantity": "1", "server": "ae9de57610f83d51", "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 1420, "y": 1240, "wires": [ [], [] ] }, { "id": "d397ae243ce68de6", "type": "modbus-write", "z": "7db3b30dc762d89d", "name": "", "showStatusActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "2", "quantity": "1", "server": "ae9de57610f83d51", "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 1420, "y": 1300, "wires": [ [], [] ] }, { "id": "e233584986714034", "type": "function", "z": "7db3b30dc762d89d", "name": "function 5", "func": "// On suppose que la vitesse arrive dans msg.payload\nlet vitesse = msg.payload;\n\n// Etat du bloc provenant de l'adresse 169c37afd3826d09\nlet etat = msg[\"169c37afd3826d09\"]; // adapter si nécessaire\n\n// Si l’état est FALSE → vitesse négative\nif (etat === false) {\n vitesse = -Math.abs(vitesse);\n} else {\n vitesse = Math.abs(vitesse);\n}\n\n// On renvoie la nouvelle valeur\nmsg.payload = vitesse;\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 320, "y": 1260, "wires": [ [ "5944236befcac78e", "97302040f8f6a656" ] ] }, { "id": "de5e84f968799bd8", "type": "ui_chart", "z": "7db3b30dc762d89d", "name": "", "group": "6ed62c5740adf91e", "order": 1, "width": 30, "height": 11, "label": "Consigne et vitesse", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "500", "removeOlder": "30", "removeOlderPoints": "", "removeOlderUnit": "1", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1210, "y": 1480, "wires": [ [] ] }, { "id": "97302040f8f6a656", "type": "function", "z": "7db3b30dc762d89d", "name": "function 6", "func": "let v = msg.payload;\n\n// (Optionnel) Correction 16 bits si le variateur déborde\nif (v > 32767) {\n v = v - 65536;\n}\n\n// Sortie graphique = valeur absolue\nmsg.payload = Math.abs(v);\n\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 700, "y": 1500, "wires": [ [ "de5e84f968799bd8" ] ] }, { "id": "087bd0e55e5735eb", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 3, "width": 30, "height": 1 }, { "id": "68e07674a67e276f", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 4, "width": 30, "height": 1 }, { "id": "85b9488f757b00f3", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 5, "width": 30, "height": 1 }, { "id": "367eeb6f2830e9f1", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 6, "width": 30, "height": 1 }, { "id": "0a380afbf8082f8d", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 7, "width": 30, "height": 1 }, { "id": "d5aa5b06fb2b0993", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 8, "width": 30, "height": 1 }, { "id": "56f993bb15c99019", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 9, "width": 30, "height": 1 }, { "id": "389beaa24afe9290", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 10, "width": 30, "height": 1 }, { "id": "999935182ebad271", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 11, "width": 30, "height": 1 }, { "id": "67b84842eb91c778", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 12, "width": 30, "height": 1 }, { "id": "2eee8f043f5818ab", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 13, "width": 30, "height": 1 }, { "id": "7a4043dc915922a7", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 14, "width": 30, "height": 1 }, { "id": "69c4b5d188238555", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 15, "width": 30, "height": 1 }, { "id": "08ec72686f88e7e1", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 16, "width": 30, "height": 1 }, { "id": "fa79ff0cf8cddc18", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 18, "width": 5, "height": 1 }, { "id": "42eb264431d78ffd", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 20, "width": 2, "height": 1 }, { "id": "f83cb4689ac979b5", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 21, "width": 5, "height": 1 }, { "id": "216cb37a6420edb7", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 24, "width": 7, "height": 1 }, { "id": "8f6fc2a63cbc1167", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 25, "width": 4, "height": 1 }, { "id": "d4487cbb281a7419", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 27, "width": 7, "height": 1 }, { "id": "b8d360a8bd19d21e", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 30, "width": 6, "height": 1 }, { "id": "3223321343045e8e", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 31, "width": 6, "height": 1 }, { "id": "cb9f09fe1715c576", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 32, "width": 6, "height": 1 }, { "id": "d0cbf3b2756744ed", "type": "ui_spacer", "z": "7db3b30dc762d89d", "name": "spacer", "group": "6ed62c5740adf91e", "order": 33, "width": 6, "height": 1 }, { "id": "6ed62c5740adf91e", "type": "ui_group", "name": "Main", "tab": "7e77918b2f96f16a", "order": 1, "disp": true, "width": 30, "collapse": false, "className": "" }, { "id": "ae9de57610f83d51", "type": "modbus-client", "name": "", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": false, "failureLogEnabled": true, "tcpHost": "10.172.6.145", "tcpPort": 502, "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": 9600, "serialDatabits": 8, "serialStopbits": 1, "serialParity": "none", "serialConnectionDelay": 100, "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": 247, "commandDelay": 1, "clientTimeout": 1000, "reconnectOnTimeout": true, "reconnectTimeout": 2000, "parallelUnitIdsAllowed": true, "showErrors": false, "showWarnings": true, "showLogs": true }, { "id": "7e77918b2f96f16a", "type": "ui_tab", "name": "Home", "icon": "dashboard", "disabled": false, "hidden": false }, { "id": "95d9d75edac95ca4", "type": "global-config", "env": [], "modules": { "node-red-dashboard": "3.6.6", "node-red-contrib-modbus": "5.45.2" } } ]
Créé il y a 1 mois.