je n’ai recuperer que partiellement les infos avant d’aller trop loin si ca fonctionne pas …
Code du flow à tester
[
{
"id": "88300a67.53f0d8",
"type": "tab",
"label": "Envoy-Metered",
"disabled": false,
"info": ""
},
{
"id": "3667807e.0ac338",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 550,
"y": 60,
"wires": []
},
{
"id": "df69fc85.a7a448",
"type": "inject",
"z": "88300a67.53f0d8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "10",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"x": 130,
"y": 40,
"wires": [
[
"d6cbe207.df8cb8"
]
]
},
{
"id": "7645b785.6450c",
"type": "function",
"z": "88300a67.53f0d8",
"name": "production[0].activeCount",
"func": "msg.payload = msg.payload.production[0].activeCount;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 490,
"y": 200,
"wires": [
[
"2db3982a.9c5968"
]
]
},
{
"id": "2db3982a.9c5968",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 200,
"wires": []
},
{
"id": "e741d624.e9b6f",
"type": "json",
"z": "88300a67.53f0d8",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 130,
"y": 180,
"wires": [
[
"97ba04be.dfe66"
]
]
},
{
"id": "6c16d231.b1be1c",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].measurementType",
"func": "msg.payload = msg.payload.consumption[0].measurementType;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 520,
"y": 620,
"wires": [
[
"a9208a75.585b7"
]
]
},
{
"id": "a9208a75.585b7",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 620,
"wires": []
},
{
"id": "dc5f82da.000cf8",
"type": "function",
"z": "88300a67.53f0d8",
"name": "storage[0].type",
"func": "msg.payload = msg.payload.storage[0].type;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 420,
"y": 1400,
"wires": [
[
"93c6fc56.20df8"
]
]
},
{
"id": "1704c510.a558c3",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1080,
"wires": []
},
{
"id": "cb332ed3.570bc",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].wNow",
"func": "msg.payload = msg.payload.consumption[0].wNow;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 480,
"y": 740,
"wires": [
[
"e8a6df01.3a4458"
]
]
},
{
"id": "e8a6df01.3a4458",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 740,
"wires": []
},
{
"id": "e8eb2058.570c7",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[1].wNow",
"func": "msg.payload = msg.payload.consumption[1].wNow;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 460,
"y": 1140,
"wires": [
[
"63927498.4be8e4"
]
]
},
{
"id": "63927498.4be8e4",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1140,
"wires": []
},
{
"id": "10f2f863.b9178",
"type": "function",
"z": "88300a67.53f0d8",
"name": "production[0].wNow",
"func": "msg.payload = msg.payload.production[0].wNow;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 470,
"y": 320,
"wires": [
[
"954d1306.4b65"
]
]
},
{
"id": "954d1306.4b65",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 320,
"wires": []
},
{
"id": "e6a69e10.0e268",
"type": "function",
"z": "88300a67.53f0d8",
"name": "production[0].readingTime",
"func": "msg.payload = msg.payload.production[0].readingTime *1000;\n\n\n\nvar dt = new Date(msg.payload);\n msg = {\n\t'month':\tdt.getMonth() + 1,\n\t'day':\t\tdt.getDate(),\n\t'year':\t\tdt.getFullYear(),\n\t'hours':\tdt.getHours(),\n\t'mins':\t\tdt.getMinutes(),\n\t'sec':\t\tdt.getSeconds(),\n\t'msecs':\tdt.getMilliseconds()\n}\n\nif(msg.day < 10 ){msg.day = \"0\" + msg.day;}\nif(msg.month < 10 ){msg.month = \"0\" + msg.month;}\nif(msg.hours < 10 ){msg.hours = \"0\" + msg.hours;}\nif(msg.mins < 10 ){msg.mins = \"0\" + msg.mins;}\nif(msg.sec < 10 ){msg.sec = \"0\" + msg.sec;}\n\nmsg.payload = msg.day + \"/\" + msg.month + \"/\" + msg.year +\" - \"+ msg.hours + \":\" + msg.mins +\":\" +msg.sec;\n\n\n\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 490,
"y": 260,
"wires": [
[
"ef6dc308.12fe9"
]
]
},
{
"id": "ef6dc308.12fe9",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 260,
"wires": []
},
{
"id": "aaab119e.dfd8e",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].readingTime",
"func": "msg.payload = msg.payload.consumption[0].readingTime *1000;\n\n\n\nvar dt = new Date(msg.payload);\n msg = {\n\t'month':\tdt.getMonth() + 1,\n\t'day':\t\tdt.getDate(),\n\t'year':\t\tdt.getFullYear(),\n\t'hours':\tdt.getHours(),\n\t'mins':\t\tdt.getMinutes(),\n\t'sec':\t\tdt.getSeconds(),\n\t'msecs':\tdt.getMilliseconds()\n}\n\nif(msg.day < 10 ){msg.day = \"0\" + msg.day;}\nif(msg.month < 10 ){msg.month = \"0\" + msg.month;}\nif(msg.hours < 10 ){msg.hours = \"0\" + msg.hours;}\nif(msg.mins < 10 ){msg.mins = \"0\" + msg.mins;}\nif(msg.sec < 10 ){msg.sec = \"0\" + msg.sec;}\n\nmsg.payload = msg.day + \"/\" + msg.month + \"/\" + msg.year +\" - \"+ msg.hours + \":\" + msg.mins +\":\" +msg.sec;\n\n\n\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 500,
"y": 680,
"wires": [
[
"cb74d2b2.bcc788"
]
]
},
{
"id": "cb74d2b2.bcc788",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 680,
"wires": []
},
{
"id": "9d3f6a0e.f2abe8",
"type": "function",
"z": "88300a67.53f0d8",
"name": "production[0].type",
"func": "msg.payload = msg.payload.production[0].type;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 470,
"y": 140,
"wires": [
[
"12e7a721.14e579"
]
]
},
{
"id": "12e7a721.14e579",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 140,
"wires": []
},
{
"id": "a8c327b8.4c9b3",
"type": "function",
"z": "88300a67.53f0d8",
"name": "production[0].whLifetime",
"func": "msg.payload = msg.payload.production[0].whLifetime;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 490,
"y": 380,
"wires": [
[
"f7345ac2.a36048"
]
]
},
{
"id": "f7345ac2.a36048",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 380,
"wires": []
},
{
"id": "85bd0579.bb072",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].type",
"func": "msg.payload = msg.payload.consumption[0].type;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 470,
"y": 480,
"wires": [
[
"fc879866.ece798"
]
]
},
{
"id": "fc879866.ece798",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 480,
"wires": []
},
{
"id": "f5605759.1cffe8",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].activeCount",
"func": "msg.payload = msg.payload.consumption[0].activeCount;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 500,
"y": 540,
"wires": [
[
"70d0063b.c3e86"
]
]
},
{
"id": "70d0063b.c3e86",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 540,
"wires": []
},
{
"id": "5252fd2e.0aa32c",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1520,
"wires": []
},
{
"id": "49746a3e.027254",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1580,
"wires": []
},
{
"id": "fdb697d9.28ebe",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[1].type",
"func": "msg.payload = msg.payload.consumption[1].type;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 450,
"y": 1080,
"wires": [
[
"1704c510.a558c3"
]
]
},
{
"id": "93c6fc56.20df8",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1400,
"wires": []
},
{
"id": "bb32a29f.48117",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1460,
"wires": []
},
{
"id": "98065e02.6f1058",
"type": "function",
"z": "88300a67.53f0d8",
"name": "storage[0].activeCount",
"func": "msg.payload = msg.payload.storage[0].activeCount;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 440,
"y": 1460,
"wires": [
[
"bb32a29f.48117"
]
]
},
{
"id": "f7f612e7.1e074",
"type": "function",
"z": "88300a67.53f0d8",
"name": "storage[0].readingTime",
"func": "msg.payload = msg.payload.storage[0].readingTime *1000;\n\n\n\nvar dt = new Date(msg.payload);\n msg = {\n\t'month':\tdt.getMonth() + 1,\n\t'day':\t\tdt.getDate(),\n\t'year':\t\tdt.getFullYear(),\n\t'hours':\tdt.getHours(),\n\t'mins':\t\tdt.getMinutes(),\n\t'sec':\t\tdt.getSeconds(),\n\t'msecs':\tdt.getMilliseconds()\n}\n\nif(msg.day < 10 ){msg.day = \"0\" + msg.day;}\nif(msg.month < 10 ){msg.month = \"0\" + msg.month;}\nif(msg.hours < 10 ){msg.hours = \"0\" + msg.hours;}\nif(msg.mins < 10 ){msg.mins = \"0\" + msg.mins;}\nif(msg.sec < 10 ){msg.sec = \"0\" + msg.sec;}\n\nmsg.payload = msg.day + \"/\" + msg.month + \"/\" + msg.year +\" - \"+ msg.hours + \":\" + msg.mins +\":\" +msg.sec;\n\n\n\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 440,
"y": 1520,
"wires": [
[
"5252fd2e.0aa32c"
]
]
},
{
"id": "6ec22066.4fd228",
"type": "function",
"z": "88300a67.53f0d8",
"name": "storage[0].wNow",
"func": "msg.payload = msg.payload.storage[0].wNow;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 420,
"y": 1580,
"wires": [
[
"49746a3e.027254"
]
]
},
{
"id": "3fe391ea.296a8e",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1640,
"wires": []
},
{
"id": "44dc3fea.7fc768",
"type": "function",
"z": "88300a67.53f0d8",
"name": "storage[0].whNow",
"func": "msg.payload = msg.payload.storage[0].whNow;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 430,
"y": 1640,
"wires": [
[
"3fe391ea.296a8e"
]
]
},
{
"id": "1c341fa8.3def58",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 770,
"y": 1700,
"wires": []
},
{
"id": "79c38bd9.0491f4",
"type": "function",
"z": "88300a67.53f0d8",
"name": "storage[0].state",
"func": "msg.payload = msg.payload.storage[0].state;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 420,
"y": 1700,
"wires": [
[
"1c341fa8.3def58"
]
]
},
{
"id": "1340ce9.6001631",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].whLifetime",
"func": "msg.payload = msg.payload.consumption[0].whLifetime;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 490,
"y": 800,
"wires": [
[
"839701c1.7f1338"
]
]
},
{
"id": "839701c1.7f1338",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 800,
"wires": []
},
{
"id": "8126bc8.14758c",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].vahLifetime",
"func": "msg.payload = msg.payload.consumption[0].vahLifetime;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 500,
"y": 920,
"wires": [
[
"6ffbb590.c304cc"
]
]
},
{
"id": "6ffbb590.c304cc",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 920,
"wires": []
},
{
"id": "8163c05f.e439d8",
"type": "function",
"z": "88300a67.53f0d8",
"name": "consumption[0].varhLeadLifetime",
"func": "msg.payload = msg.payload.consumption[0].varhLeadLifetime;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 510,
"y": 860,
"wires": [
[
"4ca434c1.69e194"
]
]
},
{
"id": "4ca434c1.69e194",
"type": "debug",
"z": "88300a67.53f0d8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 860,
"wires": []
},
{
"id": "1e2a0b33.402aad",
"type": "switch",
"z": "88300a67.53f0d8",
"name": "Switch batterie",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "payload",
"vt": "msg"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 160,
"y": 1520,
"wires": [
[
"dc5f82da.000cf8",
"98065e02.6f1058",
"f7f612e7.1e074",
"6ec22066.4fd228",
"44dc3fea.7fc768",
"79c38bd9.0491f4"
]
]
},
{
"id": "ceb74871.1f63f",
"type": "switch",
"z": "88300a67.53f0d8",
"name": "Switch Net-conso",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "payload",
"vt": "msg"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 150,
"y": 1120,
"wires": [
[
"1e2a0b33.402aad",
"fdb697d9.28ebe",
"e8eb2058.570c7"
]
]
},
{
"id": "87dc0bad.9684b8",
"type": "switch",
"z": "88300a67.53f0d8",
"name": "Switch Total conso",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "payload",
"vt": "msg"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 150,
"y": 720,
"wires": [
[
"ceb74871.1f63f",
"85bd0579.bb072",
"f5605759.1cffe8",
"6c16d231.b1be1c",
"aaab119e.dfd8e",
"cb332ed3.570bc",
"1340ce9.6001631",
"8163c05f.e439d8",
"8126bc8.14758c"
]
]
},
{
"id": "97ba04be.dfe66",
"type": "switch",
"z": "88300a67.53f0d8",
"name": "Switch production",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "payload",
"vt": "msg"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 150,
"y": 240,
"wires": [
[
"87dc0bad.9684b8",
"9d3f6a0e.f2abe8",
"7645b785.6450c",
"e6a69e10.0e268",
"10f2f863.b9178",
"a8c327b8.4c9b3",
"3667807e.0ac338"
]
]
},
{
"id": "d6cbe207.df8cb8",
"type": "http request",
"z": "88300a67.53f0d8",
"name": "production.json",
"method": "GET",
"ret": "txt",
"paytoqs": false,
"url": "http://192.168.0.248/production.json",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 140,
"y": 100,
"wires": [
[
"e741d624.e9b6f"
]
]
}
]