Actions on boot not working

Anyone know why this code isn’t executing when I reboot the esp32 device?

esphome:
  name: esphome-web-6e867c
  friendly_name: esp test board

  on_boot:
    then:
      - if:
          condition:
            lambda: 'return id(kitchen_state).state == "heat"; '
          then:
            - logger.log: "*******************************"
            - logger.log: "The sensor value is heating!"
            - logger.log: "*******************************"
            - switch.turn_on: relay4
          else:
            - logger.log: "*******************************"
            - logger.log: "The sensor value is not heating!"
            - logger.log: "*******************************"

I setup something like this awhile back. I had to add the -priority line.

on_boot:
   - priority: 600
     then:
       - light.turn_on: 
           id: living_room_tv_leds
           effect: "Random"

Look here for more details.
https://esphome.io/components/esphome.html#on-boot