J’ai modifié le code car les node ‹ delay › étaient en millisecondes au lieu de minutes…oops la boulette ! Et j’ai ajouté une focntion ‹ heure d’envoi › pour tracer l’heure à laquellle est envoyé le message « lever de soleil » pour la seconde fois (la 1ère à 00h01), il suffit de dupliquer pour tracer les autres.
Code du flow
[
{
"id": "7ff8481b0e530218",
"type": "tab",
"label": "Suncalc API",
"disabled": false,
"info": "",
"env": []
},
{
"id": "467565bd915a2a8d",
"type": "group",
"z": "7ff8481b0e530218",
"name": "Suncalc API",
"style": {
"stroke": "#000000",
"fill": "#e3f3d3",
"label": true
},
"nodes": [
"eae0976220b585b3",
"5dda4437af0bff5e",
"9ed546b6886bbafa",
"f6ea59633d3bb98b",
"e5be0b9d45a8b6c2",
"38e643d99efa7a95",
"846f914fd081c13f",
"152afaf0fdc6be38",
"59307f7f63590e5d",
"838df80a9f965a6d",
"a4397d1a98150a4d",
"5d1de6bc5497c087",
"c2b15889e9096be1",
"b8a6dca76c04f480",
"3a99ad9a2f752241",
"3ea4979d2eaf146b",
"901f952626786b11",
"1d040814b1befb3a",
"8f7e50836226d1ee",
"8c49858b8bbfe11c",
"9e462a3d9f69bee0",
"048c1578dc7d13d5",
"bee1fb0b9897f334",
"3dd556977ebeb003",
"17d36d7e51f3c5aa",
"89002c75327e8e5f",
"2e8b434a55627e7a",
"21097eb9222e6af0",
"e389303bb28be230"
],
"x": 54,
"y": 79,
"w": 1312,
"h": 722
},
{
"id": "eae0976220b585b3",
"type": "inject",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "00 00 * * *",
"once": true,
"onceDelay": "1",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 170,
"y": 400,
"wires": [
[
"5dda4437af0bff5e"
]
]
},
{
"id": "5dda4437af0bff5e",
"type": "http request",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "api.sunrise-sunset.org",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.sunrise-sunset.org/json?lat={42.555}&lng={2.833}&date=today",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 220,
"y": 460,
"wires": [
[
"9ed546b6886bbafa",
"38e643d99efa7a95",
"846f914fd081c13f",
"152afaf0fdc6be38",
"59307f7f63590e5d",
"838df80a9f965a6d",
"a4397d1a98150a4d",
"5d1de6bc5497c087",
"c2b15889e9096be1",
"b8a6dca76c04f480",
"3a99ad9a2f752241"
]
]
},
{
"id": "9ed546b6886bbafa",
"type": "debug",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 470,
"y": 460,
"wires": []
},
{
"id": "f6ea59633d3bb98b",
"type": "debug",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "msg",
"x": 700,
"y": 120,
"wires": []
},
{
"id": "e5be0b9d45a8b6c2",
"type": "mqtt out",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "Publish au broker Mqtt IP Gladys:1883",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "f4ab211ed11dc81c",
"x": 1190,
"y": 460,
"wires": []
},
{
"id": "38e643d99efa7a95",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "sunrise",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:sunrise/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString = msg.results.sunrise;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = (hours * 60) + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 160,
"wires": [
[
"e5be0b9d45a8b6c2",
"f6ea59633d3bb98b",
"3ea4979d2eaf146b",
"2e8b434a55627e7a"
]
]
},
{
"id": "846f914fd081c13f",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "sunset",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:sunset/text\";\n\n\n// chaîne de temps au format AM/PM\nvar timeString =msg.results.sunset;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 450,
"y": 220,
"wires": [
[
"e5be0b9d45a8b6c2",
"901f952626786b11"
]
]
},
{
"id": "152afaf0fdc6be38",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "solar_noon",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:solar_noon/text\";\n\n\n// chaîne de temps au format AM/PM\nvar timeString =msg.results.solar_noon;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 280,
"wires": [
[
"e5be0b9d45a8b6c2",
"1d040814b1befb3a"
]
]
},
{
"id": "59307f7f63590e5d",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "day_length",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:day_length/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString =msg.results.day_length;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 340,
"wires": [
[
"e5be0b9d45a8b6c2",
"8f7e50836226d1ee"
]
]
},
{
"id": "838df80a9f965a6d",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "civil_twilight_begin",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:civil_twilight_begin/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString = msg.results.civil_twilight_begin;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 400,
"wires": [
[
"e5be0b9d45a8b6c2",
"8c49858b8bbfe11c"
]
]
},
{
"id": "a4397d1a98150a4d",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "civil_twilight_end",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:civil_twilight_end/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString = msg.results.civil_twilight_end;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours * 60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 480,
"y": 520,
"wires": [
[
"e5be0b9d45a8b6c2",
"17d36d7e51f3c5aa"
]
]
},
{
"id": "5d1de6bc5497c087",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "nautical_twilight_begin",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:nautical_twilight_begin/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString =msg.results.nautical_twilight_begin;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 500,
"y": 580,
"wires": [
[
"e5be0b9d45a8b6c2",
"3dd556977ebeb003"
]
]
},
{
"id": "c2b15889e9096be1",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "nautical_twilight_end",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:nautical_twilight_end/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString =msg.results.nautical_twilight_end;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 500,
"y": 640,
"wires": [
[
"e5be0b9d45a8b6c2",
"bee1fb0b9897f334"
]
]
},
{
"id": "b8a6dca76c04f480",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "astronomical_twilight_begin",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:astronomical_twilight_begin/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString = msg.results.astronomical_twilight_begin;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 700,
"wires": [
[
"e5be0b9d45a8b6c2",
"048c1578dc7d13d5"
]
]
},
{
"id": "3a99ad9a2f752241",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "astronomical_twilight_end",
"func": "var topic = msg.topic;\nvar msg = msg.payload;\n\nmsg.topic = \"gladys/master/device/mqtt:suncalc/feature/mqtt:astronomical_twilight_end/text\";\n\n// chaîne de temps au format AM/PM\nvar timeString =msg.results.astronomical_twilight_end;\n\n// Convertir la chaîne en objet Date\nvar date = new Date(\"2000-01-01 \" + timeString);\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\n// calcul le delai après minuit en minutes pour envoyer le message\nvar delai = hours *60 + minutes + 1;\nmsg.delay = delai;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 510,
"y": 760,
"wires": [
[
"e5be0b9d45a8b6c2",
"9e462a3d9f69bee0"
]
]
},
{
"id": "3ea4979d2eaf146b",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "1",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 900,
"y": 160,
"wires": [
[
"e5be0b9d45a8b6c2",
"21097eb9222e6af0"
]
]
},
{
"id": "901f952626786b11",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 880,
"y": 220,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "1d040814b1befb3a",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 840,
"y": 280,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "8f7e50836226d1ee",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 820,
"y": 340,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "8c49858b8bbfe11c",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 800,
"y": 400,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "9e462a3d9f69bee0",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 900,
"y": 760,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "048c1578dc7d13d5",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 880,
"y": 700,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "bee1fb0b9897f334",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 860,
"y": 640,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "3dd556977ebeb003",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 840,
"y": 580,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "17d36d7e51f3c5aa",
"type": "delay",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "délai avant envoi mqtt",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 800,
"y": 520,
"wires": [
[
"e5be0b9d45a8b6c2"
]
]
},
{
"id": "89002c75327e8e5f",
"type": "debug",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "debug 13",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1260,
"y": 160,
"wires": []
},
{
"id": "2e8b434a55627e7a",
"type": "debug",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "delay",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "delay",
"targetType": "msg",
"statusVal": "delay",
"statusType": "msg",
"x": 690,
"y": 180,
"wires": []
},
{
"id": "21097eb9222e6af0",
"type": "function",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "heure d'envoi",
"func": "// Convertir la chaîne en objet Date\nvar date = new Date();\n\n// Formater l'heure en format 24 heures\nvar hours = date.getHours();\nvar minutes = date.getMinutes();\n\n// ajouter un zéro devant les chiffres si nécessaire\nhours = hours < 10 ? \"0\" + hours : hours;\nminutes = minutes < 10 ? \"0\" + minutes : minutes;\n\n// Afficher l'heure au format 24 heures\nvar formattedTime = hours + \":\" + minutes;\n\n// envoyer au format 24h\nmsg.payload = formattedTime;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1110,
"y": 160,
"wires": [
[
"89002c75327e8e5f"
]
]
},
{
"id": "e389303bb28be230",
"type": "inject",
"z": "7ff8481b0e530218",
"g": "467565bd915a2a8d",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 940,
"y": 120,
"wires": [
[
"21097eb9222e6af0"
]
]
},
{
"id": "f4ab211ed11dc81c",
"type": "mqtt-broker",
"name": "192.168.0.125:1883",
"broker": "192.168.0.125",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]