opened
z4nD4R
username_0
Hello everyone,

I'm using `pubsubclient` and works without issue, except one which I'm not sure if coupled with the lib itself. On my ESP32 I'm running simple code to publish humidity and temperature to MQTT broker. After some time the weird values are sending to MQTT. 
The interesting thing is, when I comment the code about publishing it works withou issue - no weird values are displayed.

My code:

```
void loop()
{
  LoopCounter++;
  client.loop();
  getDHT();
  if (LoopCounter > 10)
  {
    if (!client.connected())
    {
      connect_mqtt();
    }
    digitalWrite(LED_BUILTIN, HIGH);
    Serial.println("Publishing");
    sprintf(hum,"analog_actuator=%4g",localHum);
    Serial.print(hum);Serial.print(", "); Serial.println(localHum);
    client.publish("v1/some/topic/data/151",hum); // if I commet this line no weird sensor data anymore
    sprintf(temp,"analog_actuator=%4g",localTemp);
    delay(100);
    Serial.print(temp);Serial.print(", "); Serial.println(localTemp);
    client.publish("v1/some/topic/data/150",temp); // if I commet this line no weird sensor data anymore
    LoopCounter = 0;
    digitalWrite(LED_BUILTIN, LOW);
  }
  delay(2000);
}
```

I'd appreciate any help.

Y
client.publish modify the sending data?
issue
created
z4nD4R
username_0
@slavino ,
not sure if coupled with the issue but could be. What kind of timer would you recomend to use?

Y
comment