@Wladekcz If you want to have the water cooler run at coolant temperature rather than hot end temperature then you need to do the following:
Install your coolant temperature sensor
Create the sensor using M308. If you already have a bed and hot end temperature sensors, then this likely be sensor number 2 (the others being S0 and S1). So your sensor will be something like this M308 S2 A"Coolant Temp" P"2.temp2" Y"thermistor" T100000 B4725 C7.06e-8. Changer the "P" to suit the pin that the sensor is connected to. Change "Y" if it's not a thermistor. Change the T B and C parameters to suit the sensor that you are using. The example used is for a commonly used E3D type ntc.
Create the fan using M950. e.g M950 F2 C"0.out8". Change the "C" to suit the pin that it's connected to. Change the "F" if you want to some other fan number of your choice. Make sure it doesn't conflict with any other fan numbers that you might have used.
Use M106 to control the fan. e.g. M106 P2 H2 T40. Where P is the fan number, H is the sensor number, T is the temperature that you want it to switch on at.
Note. You don't need to create a heater. The "H" parameter is the sensor number (confusing I know).