I have a tank with a water pump. I want to use two XKC-Y25 water level sensors to fill the tank, one sensor for the high level (let's call it SW1) and one for the low level (SW2). The sensors provide an open-collector output. Both PNP and NPN versions are available, and each sensor can be configured to have NO (normally open) or NC (normally closed) outputs.
In the diagrams I have shown the two water sensors (SW1 and SW2) as two switches to simplify things.
Basically, if the water goes below the SW2, the pump starts and fills the tank until the water triggers the SW1 sensor and the pump shuts down. Using both sensors in series doesn't work because when the pump starts, the water rises and deactivates the SW2 sensor, shutting down the pump. After many researches, I came up with this schematic with I think latching relays:
The lamp is the water pump. I tested with Tinkercad but it doesn't work. Before burning anything, what do you think?
EDIT. Thanks to your suggestions, here is the second version. Since I don't have a DPDT I used two SPST in parallel. The relays are the "SRD-12VDC-SL-C" (from the datasheet it says the nominal coil current is 30mA for "High sensitivity" and 37mA for "Standard", not sure which one I should consider). I added also the schematic of the two water level sensors: both are the "PNP version" where both of them have the MODE pin grounded so they output current only when there is no water. The PNP transistor is inside the sensor. The water pump in reality is a 24V DC electrovalve (I thought that it wasn't important). I added also a push button to trigger the valve even if the tank is not empty (thanks to @AnalogKid). I'm sorry for my ignorance but I'm not an engineer, this is just my hobby.