Hello everyone .
I have a function with 88 outputs.
the source comes from a modbus output as an array.
in the function I insert a topic on each value.
is there a simpler way to do this?
var x1 = { payload: msg.payload.data[0]/2}; /*var x = { payload: msg.payload.data[]};*/
var x2 = { payload: msg.payload.data[1]};
var x3 = { payload: msg.payload.data[2]/2};
var x4 = { payload: msg.payload.data[3]/10};
var x5 = { payload: msg.payload.data[4]};
var x6 = { payload: msg.payload.data[5]/2};
var x7 = { payload: msg.payload.data[6]};
var x8 = { payload: msg.payload.data[7]};
var x9 = { payload: msg.payload.data[8]};
var x10 = { payload: msg.payload.data[9]};
var x11 ={ payload: msg.payload.data[10]};
var x12 = { payload: msg.payload.data[11]};
var x13 = { payload: msg.payload.data[12]};
var x14 = { payload: msg.payload.data[13]};
var x15 = { payload: msg.payload.data[14]};
var x16 = { payload: msg.payload.data[15]};
var x17 = { payload: msg.payload.data[16]};
var x18 = { payload: msg.payload.data[17]};
var x19 = { payload: msg.payload.data[18]};
var x20 = { payload: msg.payload.data[19]};
var x21 = { payload: msg.payload.data[20]};
var x22 = { payload: msg.payload.data[21]};
var x23 = { payload: msg.payload.data[22]};
var x24 = { payload: msg.payload.data[23]};
var x25 = { payload: msg.payload.data[24]};
var x26 = { payload: msg.payload.data[25]};
var x27 = { payload: msg.payload.data[26]};
var x28 = { payload: msg.payload.data[27]};
var x29 = { payload: msg.payload.data[28]};
var x30 = { payload: msg.payload.data[29]};
var x31 = { payload: msg.payload.data[30]};
var x32 = { payload: msg.payload.data[31]};
var x33 = { payload: msg.payload.data[32]};
var x34 = { payload: msg.payload.data[33]};
var x35 = { payload: msg.payload.data[34]};
var x36 = { payload: msg.payload.data[35]};
var x37 = { payload: msg.payload.data[36]};
var x38 = { payload: msg.payload.data[37]};
var x39 = { payload: msg.payload.data[38]};
var x40 = { payload: msg.payload.data[39]};
var x41 = { payload: msg.payload.data[40]};
var x42 = { payload: msg.payload.data[41]};
var x43 = { payload: msg.payload.data[42]};
var x44 = { payload: msg.payload.data[43]};
var x45 = { payload: msg.payload.data[44]};
var x46 = { payload: msg.payload.data[45]};
var x47 = { payload: msg.payload.data[46]};
var x48 = { payload: msg.payload.data[47]};
var x49 = { payload: msg.payload.data[48]};
var x50 = { payload: msg.payload.data[49]};
var x51 = { payload: msg.payload.data[50]};
var x52 = { payload: msg.payload.data[51]};
var x53 = { payload: msg.payload.data[52]};
var x54 = { payload: msg.payload.data[53]};
var x55 = { payload: msg.payload.data[54]};
var x56 = { payload: msg.payload.data[55]};
var x57 = { payload: msg.payload.data[56]};
var x58 = { payload: msg.payload.data[57]};
var x59 = { payload: msg.payload.data[58]};
var x60 = { payload: msg.payload.data[59]};
var x61 = { payload: msg.payload.data[60]};
var x62 = { payload: msg.payload.data[61]};
var x63 = { payload: msg.payload.data[62]};
var x64 = { payload: msg.payload.data[63]};
var x65 = { payload: msg.payload.data[64]};
var x66 = { payload: msg.payload.data[65]};
var x67 = { payload: msg.payload.data[66]};
var x68 = { payload: msg.payload.data[67]};
var x69 = { payload: msg.payload.data[68]};
var x70 = { payload: msg.payload.data[69]};
var x71 = { payload: msg.payload.data[70]};
var x72 = { payload: msg.payload.data[71]};
var x73 = { payload: msg.payload.data[72]};
var x74 = { payload: msg.payload.data[73]};
var x75 = { payload: msg.payload.data[74]};
var x76 = { payload: msg.payload.data[75]};
var x77 = { payload: msg.payload.data[76]};
var x78 = { payload: msg.payload.data[77]};
var x79 = { payload: msg.payload.data[78]};
var x80 = { payload: msg.payload.data[79]};
var x81 = { payload: msg.payload.data[80]};
var x82 = { payload: msg.payload.data[81]};
var x83 = { payload: msg.payload.data[82]};
var x84 = { payload: msg.payload.data[83]};
var x85 = { payload: msg.payload.data[84]};
var x86 = { payload: msg.payload.data[85]};
var x87 = { payload: msg.payload.data[86]};
var x88 = { payload: msg.payload.data[87]};
var x89 = { payload: msg.payload.data[88]};
x1.topic = "Tp4"; /* x.topic = " ";*/
x2.topic = "Tfumé";
x3.topic = "Tconsol";
x4.topic = "O2r";
x5.topic = "posclapO2P";
x6.topic = "posclapO2S";
x7.topic = " vitesse ventilateur";
x8.topic = "sonde1 ";
x9.topic = " temp de fumée conden";
x10.topic = " sonde retour";
x11.topic = " m/s ouverture aspi";
x12.topic = " air primaire";
x13.topic = " commande du tirage";
x14.topic = " air secondaire";
x15.topic = " reglage P chaudière";
x16.topic = " consigne fumée";
x17.topic = " regulateur O2";
x18.topic = " temp module pellets";
x19.topic = " temp O2 aspiration";
x20.topic = " A vis extraction";
x21.topic = " heures de fonctionement";
x22.topic = " reserve journaliere pellets";
x23.topic = " nbs demarage bruleur";
x24.topic = " s4 demarage bruleur";
x25.topic = " H de fonctionement maintien du feu";
x26.topic = " alimentation";
x27.topic = " regul d alimentation";
x28.topic = " consigne chaudière";
x29.topic = " sonde accu bas solaire";
x30.topic = " A vis alimentation";
x31.topic = " A ecluse a roue cellulaire";
x32.topic = " stroker";
x33.topic = " dépression du foyer";
x34.topic = " pos moteur tiroir";
x35.topic = "pos moteur grille ";
x36.topic = "regul corection alim ";
x37.topic = " commande des pompes de retour";
x38.topic = " ventil air de combustion";
x39.topic = " ventil air de combustion 2";
x40.topic = " h fonc stroker";
x41.topic = " h fonc vis alim";
x42.topic = " h fonc roue celulaire";
x43.topic = " h fonc vibreur";
x44.topic = " cycles de fonc grille basculante";
x45.topic = " h fonc WOS";
x46.topic = " h vis descendrage";
x47.topic = " h fonc allumage";
x48.topic = " h fonc sonde lambda";
x49.topic = " h fonc turbine aspi";
x50.topic = " h fonc vis extraction";
x51.topic = " cycle aeration secu";
x52.topic = " h fonc tirage";
x53.topic = " cycle fonc clapet coupe feu";
x54.topic = " deplacement du clapet tiroir";
x55.topic = " V sonde lambda";
x56.topic = " h depuis derniere maintenance";
x57.topic = " requet via ecs hk";
x58.topic = " refroidissement foyer par air secondaire";
x59.topic = " alim limiter sur maxi";
x60.topic = " augmentation P par regul foyer";
x61.topic = " pompe prélévement";
x62.topic = " V sonde lambda coriger";
x63.topic = " h fonc pellets";
x64.topic = " h en mode chauffer";
x65.topic = " sonde de la derivation superieur";
x66.topic = " sonde de la derivation inf";
x67.topic = " val consigne retour atteinte";
x68.topic = " vitesse pompe de chargement chaudiére";
x69.topic = " sonde large bande A de chauffage";
x70.topic = " sonde large bande V de chauffage";
x71.topic = " sonde large bande V rendue";
x72.topic = " sonde large bande A pompe";
x73.topic = " slb resistance interne";
x74.topic = " consigne depression";
x75.topic = " h fonc reduit";
x76.topic = "commande du tirage ";
x77.topic = " h fonc buche";
x78.topic = " WOS etat de fonc";
x79.topic = " depression reelle";
x80.topic = " A de la vis1";
x81.topic = " A de la vis2";
x82.topic = " compteur kg a reset";
x83.topic = " compteur T a reset";
x84.topic = " conso totale pellets ";
x85.topic = " rendement quotidien kw";
x86.topic = " rendement totale kw";
x87.topic = " h avant vider cendrier";
x88.topic = " gestion modbus ";
return [x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,
x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,
x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,
x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,
x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,
x51,x52,x53,x54,x55,x56,x57,x58,x59,x60,
x61,x62,x63,x64,x65,x66,x67,x68,x69,x70,
x71,x72,x73,x74,x75,x76,x77,x78,x79,x80,
x81,x82,x83,x84,x85,x86,x87,x88
];
in the absolute I would like to log about 2500 values