[SOLVED] Problems publishing more than 2 vaiables

Hello everyone

I´m trying to make a project where the devices send 4 variables

 client.add("temperatura", temp); //Insert your variable Labels and the value to be sent
  client.add("humedad", hum);
  client.add("temperaturaagua", watertemp);
  client.add("ph",phvalue);

if i understodd properly it should work like this ( for sure i´m doing something wrong), the issue is that i can just publish two variables instead of 4, in the dasboard or device tab in ubidots i just see the update of two variables

PD: No matter if it is in educational or bussiness platform
Anyone can help ???

Thanks!!!
Code:

/****************************************
 * Include Libraries
 ****************************************/
#include "UbidotsESPMQTT.h"

/****************************************
 * Define Constants
 ****************************************/
#define TOKEN "A1E-I5kmo5adEl7XwTrIdYQA2XkrpPH0mX" // Your Ubidots TOKEN
#define WIFINAME "xxxxx" //Your SSID
#define WIFIPASS "xxxxx" // Your Wifi Pass


float temp;
float hum;
float watertemp;
float phvalue;


Ubidots client(TOKEN);
/****************************************
 * Auxiliar Functions
 ****************************************/
void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i=0;i<length;i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();
}
/****************************************
 * Main Functions
 ****************************************/
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  client.wifiConnection(WIFINAME, WIFIPASS);
  client.begin(callback);
  }
void loop() {
  // put your main code here, to run repeatedly:
  if(!client.connected()){
      client.reconnect();
      }
  
  
  
  temp = random(1,70);
  hum = random (1,100);
  watertemp = random(1,50);
  phvalue = random(1,9);
    
  client.add("temperatura", temp); //Insert your variable Labels and the value to be sent
  client.add("humedad", hum);
  client.add("temperaturaagua", watertemp);
  client.add("ph",phvalue);
    delay(10000);

Serial.println("***********************************************************************************");
    
  Serial.print("temperatura: ");
  Serial.print(temp);
  Serial.println(" ºC");
  
  Serial.print("humedad: ");
  Serial.print(hum);
  Serial.println(" %");
  
  Serial.print("temperatura del agua: ");
  Serial.print(watertemp);
  Serial.println(" ºC");
  

  Serial.print("ph: ");
  Serial.print(phvalue);
  Serial.println(" ");

Serial.println("***********************************************************************************");  
  
  client.ubidotsPublish("proto");
  
  client.loop();
  }

Greetings,

As this library depends on a Pubsubclient client, the max length of the JSON dictionary to send by default is 128 bytes, if you want to publish more than 3 variables and they have context or long names you should set at PubSubclient.h the MQTT_MAX_PACKET_SIZE to 512. For more information, please refer here.

You can also just split your data into two requests:

client.add("temperatura", 10);
client.add("humedad", 10);
client.ubidotsPublish("proto");
client.add("temperaturaagua", 10);
client.add("ph", 10);
client.ubidotsPublish("proto");

All the best

Thank you for your reply!!!
Solved!!!