Need help with autodiscovery

Hi,
I have simple code with two autodiscovery objects.
One is sensor - it’s work without problems.

But second is number (slider).
I don’t know why but always I have publish failed. MQTT Explorer doesn’t show this topic, payload.
Connection to mqtt broker is working.
Can anyone help me?
Code on esp8266 Arduino, pubsubclient library.

#define MQTT_MAX_PACKET_SIZE = 512;
const char* device_id = "schodyDuze";
const char* hass_prefix = "homeassistant";
const char* topic_jasnoscLED = "schodyDuze/jasnoscLED";

 String discTopic = String(hass_prefix) + "/number/" + String(device_id) + "_jasnoscLED/config";
    StaticJsonDocument<512> doc;
    
    doc["name"] = "SchodyDuze Jasnosc LED";
    doc["unique_id"] = String(device_id) + String("_jasnoscLED");
    doc["state_topic"] = String(topic_jasnoscLED);
    doc["command_topic"] = String(topic_jasnoscLED) + "/set";
    doc["platform"] = "number";
    doc["min"] = 10;
    doc["max"] = 100;
    doc["step"] = 5;
    doc["mode"] = "slider";
    doc["unit_of_measurement"] = "%";
    JsonObject device = doc.createNestedObject("device");
    JsonArray identifiers  = device.createNestedArray("identifiers");
    identifiers.add(String(device_id));
    device["name"] = String(device_id);
    String payload; serializeJson(doc, payload);
    
    Serial.println(discTopic);
    Serial.println(payload);
    Serial.print("Payload length: ");
    Serial.println(payload.length());
    
    if(client.publish(discTopic.c_str(), payload.c_str(), true))
    {
      Serial.println("Published successfully");
    }
    else
    {
      Serial.println("Publish failed");
    }
  }

I change library to below, and works!

hmueller01/pubsubclient3: A client library for the Arduino Ethernet Shield that provides support for MQTT.