write a code for esp32 that can process signal from a float switch and send it to another esp32 via wifi and then second esp32 will control a relay based on that new information.
Here is a sample code in C++ for the first ESP32 that will process the signal from a float switch and send it to another ESP32 via WiFi:

#include <WiFi.h>

const char* ssid = "YourSSID";
const char* password = "YourPassword";

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}

Serial.println("Connected to WiFi");
}

void loop() {
int floatSwitchStatus = digitalRead(D0); // D0 is the pin connected to the float switch
WiFiClient client;
if (client.connect("SecondESP32IPAddress", 80)) {
client.println(floatSwitchStatus);
client.stop();
}
delay(1000);
}

And here is a sample code in C++ for the second ESP32 that will receive the signal from the first ESP32 and control a relay based on the new information:

#include <WiFi.h>

const char* ssid = "YourSSID";
const char* password = "YourPassword";

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}

Serial.println("Connected to WiFi");
pinMode(D2, OUTPUT); // D2 is the pin connected to the relay
}

void loop() {
WiFiServer server(80);
server.begin();

WiFiClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
int floatSwitchStatus = client.read();
if (floatSwitchStatus == 1) {
digitalWrite(D2, HIGH);
} else {
digitalWrite(D2, LOW);
}
break;
}
}
client.stop();
}
delay(1000);
}

Note: This code is just a sample and might need modification to fit your specific use case and hardware setup.