‘’ Next plan is to command a relay, that will power on the hot water pump. I want to make a condition, that when water in the heat system is hotter with 30C, than pool water, pump will start. Is this possible? Is it safe to use 5V / 220v relays with esp32 board ? "
Yes, it’s certainly possible, although it’s advisable to isolate the relay from the ESP32, through the use of a transistor and/or an opto-isolator ( as shown below).
The following link may be of help: ESPHOME ESP32 DIY relay and switch module
The link you provide to the relay module with Optocoupler should work, as it already has an opto-isolator which will decouple the 3.3V from the 5.0V coil supply used to energize the relay.
Note: given that you are driving 220VAC, it is critical that you exercise care when working with the switch side of the relay, and that the relay is rated appropriately for the current the the pump will draw.
Typical relays are rated between 10-15 Amps, however check your pump to establish its current requirement
The circuit below explains how it works:
When the output of the ESP32/MCU (GPIO pin) goes high i.e. 3.3V this will activate D1&Q1 (Opto-isolator, note that this is powered by 5V supply). This will put a high (5.0V minus drop across R2) at the base of transistor Q2, which will in turn energize Q2 and the relay (also powered by 5V)