Pour faciliter ton exploitation, voila le flux complet a importer dans node-red
[
{
"id": "36c66f1809962628",
"type": "tab",
"label": "sms",
"disabled": false,
"info": "",
"env": []
},
{
"id": "c270a66f17b33f88",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 6",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 370,
"y": 180,
"wires": []
},
{
"id": "b0818a77b16938fa",
"type": "mqtt out",
"z": "36c66f1809962628",
"name": "",
"topic": "zigbee2mqtt/SMS/sms_recu",
"qos": "1",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "85eab27acca8be67",
"x": 860,
"y": 360,
"wires": []
},
{
"id": "16b353dd68177d06",
"type": "inject",
"z": "36c66f1809962628",
"name": "INSERT",
"props": [
{
"p": "payload",
"v": "",
"vt": "date"
},
{
"p": "topic",
"v": "",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 1960,
"wires": [
[
"7cfec8e0a1aca45c"
]
]
},
{
"id": "7cfec8e0a1aca45c",
"type": "function",
"z": "36c66f1809962628",
"name": "INSERT",
"func": "// INSERT INTO `Domotique`.`sms` (`indexsms`, `content`, `date`, `phone`) VALUES (4000, 'message', '2023-12-20 10:51:59', 33600000000)\n\nmsg.payload = [24, 'example-user','2023-12-31','330669696969'];\nmsg.topic = \"INSERT INTO sms (`indexsms`, `content`,`date`, `phone`) VALUES (?, ?, ?, ?);\"\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 1960,
"wires": [
[
"196d1d7808707b1b"
]
]
},
{
"id": "7bfd3be815b168d0",
"type": "debug",
"z": "36c66f1809962628",
"name": "",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 960,
"y": 1960,
"wires": []
},
{
"id": "7215a29dce2aed44",
"type": "function",
"z": "36c66f1809962628",
"name": "Message Concatenation filter Date + Message",
"func": "var indexsms = msg.payload.index;\nvar content = msg.payload.content;\nvar date = msg.payload.date.toLocaleString(\"fr-FR\");\nvar phone = msg.payload.phone;\nmsg.payload = \" \" + date + \" \" + content;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 400,
"wires": [
[
"1bf279141665f829",
"b0818a77b16938fa"
]
]
},
{
"id": "1bf279141665f829",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 38",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 810,
"y": 260,
"wires": []
},
{
"id": "20852bce882686e6",
"type": "file",
"z": "36c66f1809962628",
"name": "Write Texte File",
"filename": "/share/sms/sms_recu.txt",
"filenameType": "str",
"appendNewline": true,
"createDir": true,
"overwriteFile": "false",
"encoding": "none",
"x": 360,
"y": 360,
"wires": [
[
"b40f86326d1ec45d"
]
]
},
{
"id": "b40f86326d1ec45d",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 39",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 770,
"y": 200,
"wires": []
},
{
"id": "22c8bda041a4e5a5",
"type": "inject",
"z": "36c66f1809962628",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 1900,
"wires": [
[
"edccb716b92c67cc"
]
]
},
{
"id": "7279c8b15f9906c2",
"type": "mqtt out",
"z": "36c66f1809962628",
"name": "",
"topic": "zigbee2mqtt/SMS/short_sms_recu",
"qos": "1",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "85eab27acca8be67",
"x": 1140,
"y": 500,
"wires": []
},
{
"id": "8def04481152e2c2",
"type": "function",
"z": "36c66f1809962628",
"name": "Message French date Format + message",
"func": "var indexsms = msg.payload.index;\nvar content = msg.payload.content;\nvar date = msg.payload.date.toLocaleString(\"fr-FR\");\nvar phone = msg.payload.phone;\nmsg.payload = content;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 500,
"wires": [
[
"7279c8b15f9906c2"
]
]
},
{
"id": "5e372f248c043c9e",
"type": "function",
"z": "36c66f1809962628",
"d": true,
"name": "Forward SMS",
"func": "var indexsms = msg.payload.index;\nvar content = msg.payload.content;\nvar date = msg.payload.date.toLocaleString(\"fr-FR\");\nvar phone = msg.payload.phone;\n\nif (phone == '3300000000') {\n // Si le numéro de téléphone correspond, reformater et renvoyer le payload\n return { \n payload: phone + \" \" + date + \" \" + content \n };\n}",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 360,
"y": 660,
"wires": [
[
"f5932837d13804d8"
]
]
},
{
"id": "31b42fe1705cc015",
"type": "delay",
"z": "36c66f1809962628",
"d": true,
"name": "",
"pauseType": "delay",
"timeout": "10",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 80,
"y": 2080,
"wires": [
[
"af6bf01c6681514f"
]
]
},
{
"id": "c8b38ff88f779b6a",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 42",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1090,
"y": 580,
"wires": []
},
{
"id": "f6d80f1b5b0473e6",
"type": "function",
"z": "36c66f1809962628",
"d": true,
"name": "prepareQuery",
"func": "\nvar indexsms = msg.payload.index;\nvar content = msg.payload.content.replace(/'/g, \"''\"); // Échappement des guillemets simples\nvar ladate = msg.payload.date.toLocaleString(\"fr-FR\") ; // Transorme la date au format FR\nvar phone = msg.payload.phone;\n\nvar query;\nquery = \"INSERT INTO sms (indexsms,content,ladate, phone) VALUES ('\" + indexsms + \"','\" + content + \"','\" + ladate + \"', '\" + phone + \"')\";\n\nmsg.topic = query;\n\nreturn msg;\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 360,
"y": 540,
"wires": [
[
"7c63b1d1f6a2863f",
"c8b38ff88f779b6a"
]
]
},
{
"id": "8b5afbaf42233eef",
"type": "function",
"z": "36c66f1809962628",
"name": "prepareQuery SQL",
"func": "var indexsms = msg.payload.index;\nvar content = msg.payload.content;\nvar ladate = msg.payload.date.toLocaleString(\"fr-FR\");\nvar phone = msg.payload.phone;\n\n// Utilisation d'une requête paramétrée\nvar query = \"INSERT INTO sms (indexsms, content, ladate, phone) VALUES (?, ?, ?, ?)\";\n\n// Attacher les paramètres à l'objet message\nmsg.payload = [indexsms, content, ladate, phone];\nmsg.topic = query;\n\nreturn msg;\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 370,
"y": 580,
"wires": [
[
"7c63b1d1f6a2863f",
"c8b38ff88f779b6a"
]
]
},
{
"id": "f74f075047518ebe",
"type": "inject",
"z": "36c66f1809962628",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 1840,
"wires": [
[
"f905294721bfd7ca"
]
]
},
{
"id": "f905294721bfd7ca",
"type": "file in",
"z": "36c66f1809962628",
"name": "",
"filename": "/share/sms/sms_recu.txt",
"filenameType": "str",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 370,
"y": 1840,
"wires": [
[
"b5f5ec6f37286a88"
]
]
},
{
"id": "f0b61cc50850ff8d",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 47",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 950,
"y": 1840,
"wires": []
},
{
"id": "b19d812482fbb114",
"type": "function",
"z": "36c66f1809962628",
"name": "5 Derniers messages",
"func": "// Récupère les états précédents du contexte de flux\nlet states = flow.get('states') || [];\n\n// Ajoute le nouvel état à la liste\nstates.push(msg.payload);\n\n// Si la liste contient plus de 5 éléments, supprime le plus ancien\nif (states.length > 5) {\n states.shift();\n}\n\n// Enregistre la liste mise à jour dans le contexte de flux\nflow.set('states', states);\n\n// Crée un nouveau msg.payload avec les 5 derniers états\nmsg.payload = states;\n\n// Retourne le message avec le nouveau payload\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 860,
"y": 440,
"wires": [
[
"7b5974b437f6029d",
"55643da252b49316"
]
]
},
{
"id": "55643da252b49316",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 48",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1350,
"y": 380,
"wires": []
},
{
"id": "8866300af0cc5f62",
"type": "mqtt out",
"z": "36c66f1809962628",
"name": "",
"topic": "zigbee2mqtt/SMS/5sms_recu",
"qos": "1",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "85eab27acca8be67",
"x": 1380,
"y": 440,
"wires": []
},
{
"id": "0f6b5476053e36c0",
"type": "function",
"z": "36c66f1809962628",
"name": "Message Concatenation filter Date + Phone + Message",
"func": "var indexsms = msg.payload.index;\nvar content = msg.payload.content;\nvar date = msg.payload.date.toLocaleString(\"fr-FR\");\nvar phone = msg.payload.phone;\nmsg.payload = \" \" + date + \" \" + phone +\" \" + content + \"\\n\";\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 440,
"wires": [
[
"b19d812482fbb114"
]
]
},
{
"id": "7b5974b437f6029d",
"type": "json",
"z": "36c66f1809962628",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 1170,
"y": 440,
"wires": [
[
"8866300af0cc5f62"
]
]
},
{
"id": "ebcda7971c1994a9",
"type": "http request",
"z": "36c66f1809962628",
"name": "",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://ntfy.lab-it.fr/Ecome_1666",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "basic",
"senderr": false,
"headers": [],
"x": 350,
"y": 300,
"wires": [
[
"c042cc078841e09e"
]
]
},
{
"id": "c042cc078841e09e",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 49",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 710,
"y": 140,
"wires": []
},
{
"id": "76b90ba9fb58ddb9",
"type": "inject",
"z": "36c66f1809962628",
"name": "STOP SMS",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "STOP",
"payloadType": "str",
"x": 110,
"y": 2020,
"wires": [
[
"969caa7b0804737c"
]
]
},
{
"id": "063bf9696f68a67a",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 50",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1090,
"y": 620,
"wires": []
},
{
"id": "cb4e72d7bff54284",
"type": "function",
"z": "36c66f1809962628",
"name": "Forward All SMS sur Mobile moi",
"func": "var indexsms = msg.payload.index;\nvar content = msg.payload.content;\nvar date = msg.payload.date.toLocaleString(\"fr-FR\");\nvar phone = msg.payload.phone;\n\nif (phone != '' && !content.includes(\"Onduleur\")) {\n // Si le numéro de téléphone n'est pas vide et renvoyer le payload\n return { \n payload: + phone + \" \" + date + \" \" + content \n };\n}",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 740,
"wires": [
[
"5b87b668b46c9f79"
]
]
},
{
"id": "34de4182c619ce69",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 51",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 950,
"y": 2020,
"wires": []
},
{
"id": "9ff79bd9b095c2c9",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 8",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 740,
"wires": []
},
{
"id": "7087f9749d86a9f1",
"type": "function",
"z": "36c66f1809962628",
"name": "Forward Onduleur SMS sur moi & Cat",
"func": "var indexsms = msg.payload.index;\nvar content = msg.payload.content;\nvar date = msg.payload.date.toLocaleString(\"fr-FR\");\nvar phone = msg.payload.phone;\n\nif (phone != '' && content.includes(\"Onduleur\")) {\n // Si le numéro de téléphone n'est pas vide et que le contenu contient \"Onduleur\", renvoyer le payload\n return {\n payload: content\n };\n}\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 800,
"wires": [
[
"26d7bf6f599acc49"
]
]
},
{
"id": "edccb716b92c67cc",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"name": "",
"phone": "0600000000",
"config": "4d16bb384171d1cd",
"x": 390,
"y": 1900,
"wires": [
[]
]
},
{
"id": "f5932837d13804d8",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"name": "Send SMS Phone 1",
"phone": "0600000000",
"config": "4d16bb384171d1cd",
"x": 790,
"y": 660,
"wires": [
[]
]
},
{
"id": "af6bf01c6681514f",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"d": true,
"name": "Send SMS Phone 2",
"phone": "0600000000",
"config": "4d16bb384171d1cd",
"x": 310,
"y": 2080,
"wires": [
[]
]
},
{
"id": "969caa7b0804737c",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"name": "",
"phone": "36608",
"config": "4d16bb384171d1cd",
"x": 390,
"y": 2020,
"wires": [
[
"34de4182c619ce69"
]
]
},
{
"id": "5b87b668b46c9f79",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"name": "Send SMS Free Pro et xx Pro",
"phone": "0600000000",
"config": "4d16bb384171d1cd",
"x": 850,
"y": 740,
"wires": [
[
"9ff79bd9b095c2c9"
]
]
},
{
"id": "829e43ee042b6f1b",
"type": "huawei-sms-receive",
"z": "36c66f1809962628",
"name": "Read SMS",
"config": "4d16bb384171d1cd",
"x": 80,
"y": 520,
"wires": [
[
"20852bce882686e6",
"7215a29dce2aed44",
"c270a66f17b33f88",
"8def04481152e2c2",
"5e372f248c043c9e",
"8b5afbaf42233eef",
"0f6b5476053e36c0",
"ebcda7971c1994a9",
"cb4e72d7bff54284",
"7087f9749d86a9f1",
"f28b48f39306017a"
]
]
},
{
"id": "7c63b1d1f6a2863f",
"type": "mysql",
"z": "36c66f1809962628",
"mydb": "7ba824a47dd5e522",
"name": "Mysql NAS",
"x": 770,
"y": 600,
"wires": [
[
"063bf9696f68a67a"
]
]
},
{
"id": "196d1d7808707b1b",
"type": "mysql",
"z": "36c66f1809962628",
"mydb": "7ba824a47dd5e522",
"name": "",
"x": 490,
"y": 1960,
"wires": [
[
"7bfd3be815b168d0"
]
]
},
{
"id": "b5f5ec6f37286a88",
"type": "separate-flow-json",
"z": "36c66f1809962628",
"name": "",
"x": 630,
"y": 1840,
"wires": [
[
"f0b61cc50850ff8d"
]
]
},
{
"id": "5597c7a0ceda768c",
"type": "inject",
"z": "36c66f1809962628",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 1780,
"wires": [
[
"ee71e6b13df39169"
]
]
},
{
"id": "ee71e6b13df39169",
"type": "huawei-sms-generic",
"z": "36c66f1809962628",
"name": "",
"url": "online-update/ack-newversion",
"method": "GET",
"config": "4d16bb384171d1cd",
"x": 300,
"y": 1780,
"wires": [
[
"1c5530f92dacb44b"
]
]
},
{
"id": "9fd9c3dfbe88d9ed",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 5",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 690,
"y": 1780,
"wires": []
},
{
"id": "1c5530f92dacb44b",
"type": "xml",
"z": "36c66f1809962628",
"name": "",
"property": "payload",
"attr": "",
"chr": "",
"x": 490,
"y": 1780,
"wires": [
[
"9fd9c3dfbe88d9ed"
]
]
},
{
"id": "6f24f43419f5835d",
"type": "comment",
"z": "36c66f1809962628",
"name": "Liste API",
"info": "mrt:~/huawei/mirror/js$ egrep -oh \"(api/.\\S*?)\" *.js | egrep -o '^api/[a-z/_-]*' | sort | uniq\n\napi/cradle/basic-info\napi/cradle/status-info\napi/device/autorun-version\napi/device/fastbootswitch\napi/device/infomation\napi/device/information\napi/device/powersaveswitch\napi/dhcp/settings\napi/dialup/auto-apn\napi/dialup/connection\napi/dialup/dial\napi/dialup/mobile-dataswitch\napi/dialup/profiles\napi/filemanager/upload\napi/global/module-switch\napi/host/info\napi/language/current-language\napi/monitoring/check-notifications\napi/monitoring/clear-traffic\napi/monitoring/converged-status\napi/monitoring/month_statistics\napi/monitoring/month_statistics_wlan\napi/monitoring/start_date\napi/monitoring/start_date_wlan\napi/monitoring/status\napi/monitoring/traffic-statistics\napi/net/current-plmn\napi/net/net-mode\napi/net/net-mode-list\napi/net/network\napi/net/plmn-list\napi/net/register\napi/online-update/ack-newversion\napi/online-update/cancel-downloading\napi/online-update/check-new-version\napi/online-update/status\napi/online-update/url-list\napi/ota/status\napi/pb/pb-match\napi/pin/operate\napi/pin/simlock\napi/pin/status\napi/redirection/homepage\napi/security/dmz\napi/security/firewall-switch\napi/security/lan-ip-filter\napi/security/nat\napi/security/sip\napi/security/special-applications\napi/security/upnp\napi/security/virtual-servers\napi/sms/backup-sim\napi/sms/cancel-send\napi/sms/cofig\napi/sms/config\napi/sms/delete-sms\napi/sms/save-sms\napi/sms/send-sms\napi/sms/send-status\napi/sms/set-read\napi/sms/sms-count\napi/sms/sms-list\napi/sntp/sntpswitch\napi/user/login\napi/user/logout\napi/user/password\napi/user/remind\napi/user/session\napi/user/state-login\napi/ussd/get\napi/wlan/basic-settings\napi/wlan/handover-setting\napi/wlan/host-list\napi/wlan/mac-filter\napi/wlan/multi-basic-settings\napi/wlan/multi-security-settings\napi/wlan/multi-switch-settings\napi/wlan/oled-showpassword\napi/wlan/security-settings\napi/wlan/station-information\napi/wlan/wifi-dataswitch",
"x": 100,
"y": 1740,
"wires": []
},
{
"id": "cb599d3bb77d3568",
"type": "inject",
"z": "36c66f1809962628",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 1460,
"wires": [
[
"c6bfe59ec0283c28",
"7cfc9b6341a3cb84"
]
]
},
{
"id": "c6bfe59ec0283c28",
"type": "change",
"z": "36c66f1809962628",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "My Message By Form",
"tot": "str"
},
{
"t": "set",
"p": "phone",
"pt": "msg",
"to": "+33600000000",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 420,
"y": 1440,
"wires": [
[
"b2d93da138a0be8b",
"61f9681bc40274f1",
"56b94fa7f4054e2d"
]
]
},
{
"id": "19280d6df6a4ac01",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 11",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 930,
"y": 1440,
"wires": []
},
{
"id": "56b94fa7f4054e2d",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"name": "",
"phone": "06000000000",
"config": "4d16bb384171d1cd",
"x": 690,
"y": 1440,
"wires": [
[
"19280d6df6a4ac01"
]
]
},
{
"id": "7cfc9b6341a3cb84",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 4",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 130,
"y": 1540,
"wires": []
},
{
"id": "b2d93da138a0be8b",
"type": "debug",
"z": "36c66f1809962628",
"name": "Payload",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 390,
"y": 1540,
"wires": []
},
{
"id": "61f9681bc40274f1",
"type": "debug",
"z": "36c66f1809962628",
"name": "Phone",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "phone",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 380,
"y": 1600,
"wires": []
},
{
"id": "a90ce8897c9c4efe",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 21",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 800,
"wires": []
},
{
"id": "26d7bf6f599acc49",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"name": "Send SMS Free moi",
"phone": "+33600000000;+33600000000",
"config": "4d16bb384171d1cd",
"x": 810,
"y": 800,
"wires": [
[
"a90ce8897c9c4efe"
]
]
},
{
"id": "8247d240883ce7ad",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 2",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1090,
"y": 1000,
"wires": []
},
{
"id": "b0422a7423734107",
"type": "huawei-sms-send",
"z": "36c66f1809962628",
"name": "",
"phone": "0600000000",
"config": "4d16bb384171d1cd",
"x": 790,
"y": 1000,
"wires": [
[
"8247d240883ce7ad"
]
]
},
{
"id": "14a6127370d6dfeb",
"type": "inject",
"z": "36c66f1809962628",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Je voulais être le premier, j'ai donc programmé l'envois de mon message, je vous souhaite un joyeux anniversaire. Votre Valentin.",
"payloadType": "str",
"x": 510,
"y": 1000,
"wires": [
[
"b0422a7423734107"
]
]
},
{
"id": "a017f6f0c991026f",
"type": "function",
"z": "36c66f1809962628",
"name": "function 3",
"func": "// Récupère le tableau existant ou initialise un nouveau tableau\nlet smsList = context.global.get(\"lastSms\") || [];\n\n// Ajoute le nouveau SMS au début du tableau\nsmsList.unshift(msg.payload);\n\n// Garde seulement les 10 derniers SMS\nsmsList = smsList.slice(0, 10);\n\n// Stocke le tableau mis à jour dans le contexte global persistant\ncontext.global.set(\"lastSms\", smsList);\n\n// --- DEBUG : Affiche le tableau et le nombre de SMS ---\nnode.warn(\"Contenu du tableau SMS :\");\nnode.warn(smsList);\nnode.warn(\"Nombre de SMS dans le tableau : \" + smsList.length);\n\n// Publie le tableau sous forme de chaîne JSON sur MQTT\nmsg.payload = JSON.stringify(smsList);\nmsg.topic = \"zigbee2mqtt/SMS/last_10\";\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 860,
"wires": [
[
"567d6b27f750bb17"
]
]
},
{
"id": "567d6b27f750bb17",
"type": "mqtt out",
"z": "36c66f1809962628",
"name": "",
"topic": "zigbee2mqtt/SMS/last_10",
"qos": "1",
"retain": "true",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "85eab27acca8be67",
"x": 950,
"y": 860,
"wires": []
},
{
"id": "f28b48f39306017a",
"type": "function",
"z": "36c66f1809962628",
"name": "Last 10 message contexte persistant",
"func": "// 1. Récupère le tableau des SMS depuis le contexte persistant\nlet smsPersist = context.get('last_sms', 'persist') || [];\n\n// 2. Ajoute le nouveau SMS\nsmsPersist.unshift({\n index: msg.payload.index || 40041,\n content: msg.payload.content,\n date: msg.payload.date || new Date().toISOString(),\n phone: msg.payload.phone\n});\n\n// 3. Garde uniquement les 10 derniers SMS\nsmsPersist = smsPersist.slice(0, 10);\n\n// 4. Met à jour le contexte persistant\ncontext.set('last_sms', smsPersist, 'persist');\n\n// 5. Logs pour vérification\nnode.warn(\"SMS stockés : \" + JSON.stringify(smsPersist));\nnode.status({ fill: \"blue\", shape: \"dot\", text: `SMS: ${smsPersist.length}` });\n\n// 6. Transmet le tableau pour la suite (MQTT, API, etc.)\nmsg.payload = smsPersist;\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 920,
"wires": [
[
"218914f697dae589",
"567d6b27f750bb17"
]
]
},
{
"id": "218914f697dae589",
"type": "debug",
"z": "36c66f1809962628",
"name": "debug 36",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 910,
"y": 920,
"wires": []
},
{
"id": "a1057345720a7f8c",
"type": "inject",
"z": "36c66f1809962628",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 330,
"y": 1160,
"wires": [
[
"6f2ce26c3a3abc06"
]
]
},
{
"id": "d1fe1d4234eb0ff6",
"type": "function",
"z": "36c66f1809962628",
"name": "Clear Datas",
"func": "// Fonction lecture context 'mesures'\nlet mesures = context.get('mesures', 'persist') || [];\nnode.warn(\"Lecture contexte mesures: \" + JSON.stringify(mesures));\nmsg.payload = mesures.length;\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 610,
"y": 1080,
"wires": [
[
"58c6a6aeb2f8c768"
]
]
},
{
"id": "58c6a6aeb2f8c768",
"type": "debug",
"z": "36c66f1809962628",
"name": "Valeur compteur",
"active": false,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 930,
"y": 1160,
"wires": []
},
{
"id": "6f2ce26c3a3abc06",
"type": "function",
"z": "36c66f1809962628",
"name": "function 5",
"func": "const mesures = context.get('94b5dc8f64f7e3ad', 'persist') || [];\nnode.warn(\"Nombre d'enregistrements après reset : \" + mesures.length);\nreturn null;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 600,
"y": 1160,
"wires": [
[
"58c6a6aeb2f8c768"
]
]
},
{
"id": "85eab27acca8be67",
"type": "mqtt-broker",
"name": "VM-MQTT",
"broker": "192.168.00.0",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]