Raw Payload

Raw Payload

Hello everyone! I need your help. I'm connecting a device via MQTT but I'm having a problem entering the data. I've already connected another device to the tago and it was pretty smooth, but this one is giving me these problems below in the photos:

      
The raw_payload ends up not being in the correct format so that you can search for the data and filter it to display on the dashboard. It doesn't stay as a variable and ends up giving this error. However, it arrives as a payload variable from my device.




If I use the emulator with the payload variable and the data as the value, then it inserts it into the bucket and runs normally.




Does anyone know what I'm doing wrong or what I can fix so that my raw_payload is in the variable/value format so I can get the data?

Agradeço pela ajuda.

My Payload Parser:
const rawValues = payload.find(item => item.variable === 'payload'); //LOCALIZANDO O PAYLOAD(DADOS)



if(rawValues)
{
  const valuesString = rawValues.value;
  const splitValues = valuesString.split(","); //SEPARANDO TODO O DADO ATRAVÉS DO ";". ASSIM CONSIGO SEPARAR TODOS E FILTRA-LOS.

  //FAZENDO O FILTRO DOS DADOS DE ACORDO COM SUA POSIÇÃO
  const filterX = splitValues[0];
  const filterY = splitValues[1];
  const filterZ = splitValues[2];
  const filterBAT = splitValues[3];
  const filterDEVICEID = splitValues[4];
  const filterTEMP = splitValues[5];
  const filterUMID = splitValues[6];
  const filterENDERECO = splitValues[7];
  const filterPACKET1 = splitValues[8];
  const filterPACKET2 = splitValues[9];
  const filterPACKET3 = splitValues[10];
  const filterBC = splitValues[11];
  const filterPACKETTYPE = splitValues[12];
  const filterCHECKSUM = splitValues[13];


  /* AQUI PASSO OUTRO FILTRO PARA SEPARAR O VALOR DO NOME. EX.: TEMPERATURA:29.54
  ENTÃO ATRAVÉS DOS ":" PEGO SOMENTE O VALOR DE 29.54 E DESCARTO A STRING TEMPERATURA*/

  const XValues = filterX.split(":");
  const YValues = filterY.split(":");
  const ZValues = filterZ.split(":");
  const BATValues = filterBAT.split(":");
  const DEVICEIDValues = filterDEVICEID.split(":");
  const TEMPValues = filterTEMP.split(":");
  const UMIDValues = filterUMID.split(":");
  const ENDERECOValues = filterENDERECO.split(":");
  const PACKET1Values = filterPACKET1.split(":");
  const PACKET2Values = filterPACKET2.split(":");
  const PACKET3Values = filterPACKET3.split(":");
  const BCValues = filterBC.split(":");
  const PACKETTYPEValues = filterPACKETTYPE.split(":");
  const CHECKSUMValues = filterCHECKSUM.split(":");
   
  // FEITO A SEPARAÇÃO AGORA PEGO SOMENTE O DADO COMO EXPLICADO ACIMA, SOMENTE NA HORA QUE NÃO DA CERTO POIS JÁ TEM :, AÍ FILTREI POR STRING
  // NECESSÁRIO TAMBÉM FAZER A CRIAÇÃO DA VARIAVEL TIMESTAMP PARA O GRAFICO FUNCIONAR CORRETAMENTE E PEGAR A HORA CORRETAMENTE.

  const EIXO_X = XValues[1];
  const EIXO_Y = YValues[1];
  const EIXO_Z = ZValues[1];
  const BATERIA = BATValues[1];
  const TEMPERATURA = TEMPValues[1];
  const UMIDADE = UMIDValues[1];
  const ENDERECO = ENDERECOValues[1];
  const DEVICEID1 = DEVICEIDValues[1];
  const PACKET1 = PACKET1Values[1];
  const PACKET2 = PACKET2Values[1];
  const PACKET3 = PACKET3Values[1];
  const BC = BCValues[1];
  const PACKETTYPE = PACKETTYPEValues[1];
  const CHECKSUM1 = CHECKSUMValues[1];
 
  const DEVICEID = DEVICEID1.substring(2,17);
  const CHECKSUM = CHECKSUM1.substring(0,2);

  //AQUI INTRODUZO OS DADOS PARA O BUCKET
   
  payload.push({ "variable": "eixo_x", "value": EIXO_X});
  payload.push({ "variable": "eixo_y", "value": EIXO_Y});
  payload.push({ "variable": "eixo_z", "value": EIXO_Z});  
  payload.push({ "variable": "Temperatura", "value": TEMPERATURA, "unit": "°C"});
  payload.push({ "variable": "Bateria", "value": BATERIA, "unit": "V"});
  payload.push({ "variable": "endereco", "value": ENDERECO});
  payload.push({ "variable": "umidade", "value": UMIDADE, "unit": "%UR"});
  payload.push({ "variable": "packet_1", "value": PACKET1});
  payload.push({ "variable": "packet_2", "value": PACKET2});
  payload.push({ "variable": "packet_3", "value": PACKET3});
  payload.push({ "variable": "device_id", "value": DEVICEID});
  payload.push({ "variable": "byte_config", "value": BC});
  payload.push({ "variable": "tipo_pacote", "value": PACKETTYPE});    
  payload.push({ "variable": "checksum", "value": CHECKSUM});
 
}