[FOR REVIEW] Code error sending more than 3 variables

Hi,
I’m using arduino UNO-Eth, I’m having a very strange problem when I try to send more than 3 variables to Ubidots, I use a function to collect data from a website, It gets it perfectly but if I use indexOf function to save variables it doesn’t work when I send more than 3 variables.
Everything is ok for 3 or less but when I put 4 variables indexOf and also string.substring doesn’t work properly. I attach the code. I check it out putting delays but without success.

const char* server = "afeelink.com"; // server's address
const char* resource = "/tado.php";
const unsigned long HTTP_TIMEOUT = 1000;  // max respone time from server

float valorM,valueV,Tempint,Tempset;
int retardo = 2 ;    // (tiempo (s.) entre visionados)
int StatusTado,StatusSTAY,mark;
String STAYHOME;
float lectura,ff,pKW,iA,vV,vS,S_Ratio;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 0, 177);// Set the static IP address to use if the DHCP fails to assign
Ubidots client(TOKEN);
EthernetClient cliente;

void setup(){
    Serial.begin(9600);
    emon1.current(A0, 30);             // Current: pin de entrada A1, calibracion.
    pinMode(3, INPUT);
    pinMode(4, OUTPUT);
    digitalWrite(4, LOW);
    // lectura electric
    S_Ratio = 36.5;      // Sensor/ratio (mV/mA ) : 36.5
    vV = 237;            // valor de tension a computar
    ff = 5; // freq. factor / (50Hz -> 5 / 60Hz -> 4.15)
    // start the Ethernet connection:
    initEthernet();
    // give the Ethernet shield a second to initialize:
    //delay(1000);

}

void initEthernet() {
  byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
  if (!Ethernet.begin(mac)) {
    Serial.println("Failed to configure Ethernet");
    return;
  }
  Serial.println("Ethernet ready");
  delay(1000);
}
int actialarma()
{
      digitalWrite(4, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);              // wait for a second 
      digitalWrite(4, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);                       // wait for a second
      
}


void loop(){

    connect(server);
    if (sendRequest(server, resource) && skipResponseHeaders())
    {
      readReponseContent() ;
    }
    disconnect();
  
    float value = client.getValue(ID);
    if (value==0){ valorM = 1;}
    if ((valorM==1) and (value==1))
    {actialarma();  
    valorM = 0;}
    //envio dades electric
    double Irms = emon1.calcIrms(1480);  // Calculamos Irms
    valueV=Irms*237.0;
    float valuesend = digitalRead(3);

    client.add(IDtempsetTado, Tempset);
    client.add(IDopTado, StatusSTAY);
    client.add(IDtempintTado, Tempint);
    
    client.sendAll();
    /*
    if (mark==0)
    {
    client.add(IDsend, valuesend);
    client.add(IDV, valueV);
    client.add(IDstatusTado,StatusTado);
    mark=1;
    Serial.println ("mark=0");
    }
    else 
    {
    client.add(IDtempsetTado, Tempset);
    client.add(IDopTado, StatusSTAY);
    client.add(IDtempintTado, Tempint);
    mark=0;
    Serial.println ("mark=1");
    }
    
   client.sendAll();
    delay(1000); 
    */
}
// Open connection to the HTTP server
bool connect(const char* hostName) {
  Serial.print("Connect to ");
  Serial.println(hostName);

  bool ok = cliente.connect(hostName, 80);

  Serial.println(ok ? "Connected" : "Connection Failed!");
  return ok;
}
// Send the HTTP GET request to the server
bool sendRequest(const char* host, const char* resource) {

  cliente.print("GET ");
  cliente.print(resource);
  cliente.println(" HTTP/1.0");
  cliente.print("Host: ");
  cliente.println(host);
  cliente.println("Connection: close");
  cliente.println();

  return true;
}

// Skip HTTP headers so that we are at the beginning of the response's body
bool skipResponseHeaders() {
  // HTTP headers end with an empty line
  char endOfHeaders[] = "null";

  cliente.setTimeout(HTTP_TIMEOUT);
  bool ok = cliente.find(endOfHeaders);

  if (!ok) {
    Serial.println("No response or invalid response!");
  }

  return ok;
}


bool readReponseContent() {
 
String s = cliente.readString();
Serial.println(s);
int heatingOn = s.indexOf("heatingOn");
Serial.println(heatingOn);
Serial.println(s.substring(11,15));
Serial.println(s.substring(heatingOn+11,heatingOn+15));

int radar = s.indexOf("autoOperation");
int intemp = s.indexOf("insideTemp");
int settemp = s.indexOf("setPointTemp");

//String StringheatingOn = (s.substring(heatingOn+11,heatingOn+15));
//String STAYHOME = (s.substring(radar+16,radar+20));
Serial.println(s.substring(radar+16,radar+20));
Serial.println(s.substring(intemp+12,intemp+16));
Serial.println(s.substring(settemp+14,settemp+18));
Tempint = (s.substring(intemp+12,intemp+16).toFloat());
Tempset = (s.substring(settemp+14,settemp+18).toFloat());


if ((s.substring(heatingOn+11,heatingOn+15)) == "true")
{
  StatusTado=1;
}
else if ((s.substring(heatingOn+11,heatingOn+15)) == "fals")
{
  StatusTado=0;
}
if ((s.substring(radar+16,radar+20)) == "HOME")
{
  StatusSTAY=1;
}
else if ((s.substring(radar+16,radar+20)) == "AWAY")
{
  StatusSTAY=0;
}
 
  }

 
// Close the connection with the HTTP server
void disconnect() {
  Serial.println("Disconnect");
  cliente.stop();
}

// Pause for a 1 minute
void wait() {
  Serial.println("Wait 5 seconds");
  delay(1000);
}

Hi lluis,

Let me check and I give you an answer as soon is possible.

All the best,
Kath