In retrospect perhaps he should have known. The firing on the Star of the West in January should have been a good indication of the southern lack of interest in a peaceful solution. Southern hostile intentions were later made evident when they fired on the Rhoda Shannon merely because she flew the Stars and Stripes, but it's doubtful that Lincoln would have been aware of that incident coming, as it did, about a week before the attack. Still Lincoln held out hope that if he made his it clear that he wanted to land supplies only then Davis wouldn't attack. As it turned out Lincoln was mistaken.
He did know it was going to happen. He only had half of his cabinet plus all the common sense in the world telling him that fact. Thus his mission to Sumter was nothing short of a conscious decision to provoke war.
He had no legitimate reason in the world to believe that he would be allowed entrance to Charleston harbor with a fleet of warships. That would be like you coming to my front door at 2 AM with a shotgun over your shoulder demanding "peaceful" entrance and, when I denied you as any sane person would, you started threatening to kick the door in on your own and fight your way through me with your gun.
The good people of Charleston percieved Lincoln's fleet as a very real and very hostile threat to their safety and well being so they preempted it before it had a chance to sting them. How you fail to see this is baffling considering that this exact same strategy was used to remove Saddam from power for the exact same reasons only a few months ago.