George Beahm writes in his books about Stephen King that the family was in fact in a Room 217 when the idea came to him.
Stephen King from A to Z says:
The genesis of [The Shining] is that when the Kings were in Boulder, they wanted to get away for a weekend. Locals recommended the Stanley Hotel in Estes Park.
The Kings arrived at the Stanley Hotel on October 30, 1974, just as it was closing down for the winter, but the manager let the Kings stay.
And then, for the rest of the story, we go to Stephen King: America’s Best-Loved Boogeyman:
When King left, he got lost in the maze of corridors, then found his way to room 217, where he went to the bathroom, pulled back the pink curtain drawn across the bathtub, and noticed the clawfoot porcelain tub. "What if somebody died here? At that moment, I knew that I had a book.”
It seems apocryphal, but the references are authoritative enough that it's likely true.