Ender 4 problem

Hello
I have a problem with the MKS 1.3 board. It is a hotend fan. In the configuration I have set up like this:

# Switch module for fan control
switch.fan.enable                            true             # Enable this module
switch.fan.input_on_command                  M106             # Command that will turn this switch on
switch.fan.input_off_command                 M107             # Command that will turn this switch off
switch.fan.output_pin                        2.4              # Pin this module controls
switch.fan.output_type                      pwm             # PWM output settable with S parameter in the input_on_comand
switch.fan.max_pwm                          255              # Set max pwm for the pin default is 255
switch.fan.startup_state true

#switch.misc.enable                          true             # Enable this module
#switch.misc.input_on_command                M42              # Command that will turn this switch on
#switch.misc.input_off_command               M43              # Command that will turn this switch off
#switch.misc.output_pin                      2.4              # Pin this module controls
#switch.misc.output_type                     digital          # Digital means this is just an on or off pin

##################################################################################

# Temperatureswitch.  See http://smoothieware.org/temperatureswitch
# Automatically toggle a switch at a specified temperature. Different ones of these may be defined to monitor different 
# temperatures and switch different swithxes. Useful to turn on a fan or water pump to cool the hotend

temperatureswitch.hotend.enable              true            #
temperatureswitch.hotend.designator          T0               # first character of the temperature control designator to use as the temperature sensor to monitor
temperatureswitch.hotend.switch              misc            # select which switch to use, matches the name of the defined switch
temperatureswitch.hotend.threshold_temp      40.0            # temperature to turn on (if rising) or off the switch
temperatureswitch.hotend.heatup_poll         15              # poll heatup at 15 sec intervals
temperatureswitch.hotend.cooldown_poll       60              # poll cooldown at 60 sec intervals
##################################################################################

The fan works well according to the setting right after start. I choose the file to print. The straw heats up and then hotend and when it reaches the set temperature, the fan stops and the printer starts printing. I need to manually turn it on. What could be wrong?