Even though the esp can be powered with 5v, it’s stepped down to 3.3v. The max out from the pin is ~3.3v, You will still need a logic level shifter and 1 will work for 2 fans.
There are speed_count
settings, default is 1-100. To use multiple temps and different fan speeds on board you will need to use a lambda. This isn’t exact but something like this under the temp sensor
on_value:
then:
lambda: |-
if ((id(my_temp).state >= 50) and (id((my_temp).state <= 60)) {
auto call = id(my_fan).turn_on();
call.set_speed(50);
call.perform();}
else if ((id(my_temp).state >= 61) and (id((my_temp).state <= 70)) {
auto call = id(my_fan).turn_on();
call.set_speed(100);
call.perform();}
else {
logger.log: "temp out of range!";}