Try this function
let device = msg.payload.device;
msg.payload = {
"cisnienie" : msg.payload.pressure,
"temperatura" : msg.payload.temperature,
"wilgotnosc" : msg.payload.humidity,
"napieceie_sieciowe" : msg.payload.voltage,
"pobor_pradu" : msg.payload.current,
"moc_pobierana" : msg.payload.power,
"licznik_energii" : msg.payload.energy,
"czestotliwosc" : msg.payload.frequency,
"PF" : msg.payload.power_factor,
"czujnik_gazu" : msg.payload.methane,
"ADC": msg.payload.ADC}
for (let i = 0; i < msg.payload.ADC.length; i++){
let R = Number(msg.payload.ADC[i]);
if (R >= 0){
msg.payload[`kanal${(i+1)}`] = (1 / ( (1/298.15) + (1/3950) * Math.log(R/1000) ))-273.15;
}
}
delete msg.payload.ADC;
msg.payload = [msg.payload, {"ID_urzadzenia" : device, "lokalizacja": "kotlownia"}];
return msg;