======== Date et heure dans Node red ======== Pour **avoir la date du serveur** , ICI le raspberry qui sert de serveur Node-Red ==== Avec le noeud Date/Time Formater ==== Il faut dans le menu " Gerer la palette" installer ==> **node-red-contrib-moment** {{ :start:esp32:nodered:heure:capture_d_ecran_du_2024-01-23_11-02-36.png?direct&600 |}} ===Dans node-red , mettre les noeuds suivant :=== {{ :start:esp32:nodered:heure:capture_d_ecran_du_2024-01-23_11-01-27.png?direct&800 |}} ===Le noeud "Horodatage"=== Intervalle => 1 secondes si vous voulez afficher les secondes .... {{ :start:esp32:nodered:heure:capture_d_ecran_du_2024-01-23_11-05-48.png?direct&400 |}} ===le noeud "Date/Time Formatter" pour la date=== ==> Input From = Horodatage Output format = DD - MM - YYYY et Output to = msg.mytime {{ :start:esp32:nodered:heure:capture_d_ecran_du_2024-01-23_11-08-21.png?direct&400 |}} ===le noeud "Date/Time Formatter" pour l'heure === ==> Input From = Horodatage Output format = h - m - s ( en minuscule ) et Output to = msg.mytime {{ :start:esp32:nodered:heure:capture_d_ecran_du_2024-01-23_11-11-23.png?direct&400 |}} ===Affichage dans le dashboard === {{ :start:esp32:nodered:heure:capture_d_ecran_du_2024-01-23_11-16-41.png?direct&600 |}} === Code javascript === Vous pouvez importer ce code javascript dans un flux Node-Red pour avoir la date et l'heure dans votre dashboard , mais vous pouvez aussi tout refaire à la main en suivant les exemples ci-dessus ... [ { "id": "35ba45dfea2add23", "type": "moment", "z": "cd6db7a86b3ae202", "name": "Format date", "topic": "", "input": "", "inputType": "date", "inTz": "Europe/Paris", "adjAmount": "0", "adjType": "hours", "adjDir": "add", "format": "DD - MM - YYYY", "locale": "fr-FR", "output": "mytime", "outputType": "msg", "outTz": "Europe/Paris", "x": 530, "y": 140, "wires": [ [ "e5b65527ac9c319f" ] ] }, { "id": "e5b65527ac9c319f", "type": "ui_text", "z": "cd6db7a86b3ae202", "group": "932d398289bfe457", "order": 23, "width": 0, "height": 0, "name": "", "label": "Date", "format": "{{msg.mytime}}", "layout": "row-spread", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 850, "y": 140, "wires": [] }, { "id": "446e81bd677607f0", "type": "inject", "z": "cd6db7a86b3ae202", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "1", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 190, "y": 180, "wires": [ [ "35ba45dfea2add23", "6eda1c3d5cedd21b" ] ] }, { "id": "70e3312fe2a2ccbb", "type": "ui_text", "z": "cd6db7a86b3ae202", "group": "932d398289bfe457", "order": 23, "width": 0, "height": 0, "name": "", "label": "Heure minutes", "format": "{{msg.mytime}}", "layout": "row-spread", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 860, "y": 220, "wires": [] }, { "id": "6eda1c3d5cedd21b", "type": "moment", "z": "cd6db7a86b3ae202", "name": "Format heures", "topic": "", "input": "", "inputType": "date", "inTz": "Europe/Paris", "adjAmount": "0", "adjType": "hours", "adjDir": "add", "format": "h - m - s ", "locale": "fr-FR", "output": "mytime", "outputType": "msg", "outTz": "Europe/Paris", "x": 540, "y": 220, "wires": [ [ "70e3312fe2a2ccbb" ] ] }, { "id": "503ce05089ffc9a2", "type": "comment", "z": "cd6db7a86b3ae202", "name": "Noeud dans \"Commun\" ==> inject", "info": "", "x": 140, "y": 140, "wires": [] }, { "id": "2ace59f945371216", "type": "comment", "z": "cd6db7a86b3ae202", "name": "Noeud dans \" formats\" ==> Date/time Formatter", "info": "", "x": 500, "y": 80, "wires": [] }, { "id": "b38d4bc26e9e0a95", "type": "comment", "z": "cd6db7a86b3ae202", "name": "Noeud dans \" dashboard\" ==> texte", "info": "", "x": 920, "y": 80, "wires": [] }, { "id": "932d398289bfe457", "type": "ui_group", "name": "ESP32 ", "tab": "868039c03e1e9bab", "order": 1, "disp": true, "width": "10", "collapse": false, "className": "" }, { "id": "868039c03e1e9bab", "type": "ui_tab", "name": "ESP32_802060", "icon": "dashboard", "order": 2, "disabled": false, "hidden": false } ]