Yeni: Yapay zekâ güvenlik duvarı tüm platformu izliyor ve her olayı sade bir dille açıklıyor. Nasıl çalıştığını görün

Reply To: Broker address typed into a config page as text: how do I turn the string into something the ESP32 can use?

IPAddress has fromString(), so no splitting needed:

IPAddress ip;
if (ip.fromString(brokerStr)) {
  client.setServer(ip, 1883);
}

But Ciaran’s point: for Hermetry you don’t want an IP at all. Its broker is TLS on 8883 and needs SNI, so you must connect by host name. setServer() has a version that takes a host name, which works for your Pi too if you type its name or IP as text:

char brokerHost[64];   // global, lives as long as the program

void applyConfig(const String &s) {
  s.toCharArray(brokerHost, sizeof(brokerHost));
  client.setServer(brokerHost, 8883);
}

The global buffer is the important bit. PubSubClient keeps the pointer you pass, it doesn’t copy the text. If you pass brokerStr.c_str() from a String that goes out of scope at the end of setup(), the pointer dangles and it’ll try to connect to garbage later. I lost an afternoon to that in my final year project, the board connected on first boot and then never again after a reconnect.

Make the parameter long enough for the Hermetry host on your device’s Connection details card, 64 characters is plenty.

Timestamps in UTC or it didn't happen.
Kabul edilen çözüm♥ 5