Those familiar with the works of Roald Dahl, or even just the Johnny Depp film, will no doubt remember Prince Pondicherry, who had a palace in India made out of chocolate. Every part was made from chocolate. Even the taps, from which would flow hot chocolate. Mister Wonka did warn the prince that he should start eating quickly as it would likely melt in the heat of summer, which sure enough it did.
A couple of pages before this palace is mentioned, Dahl tells us that Willy Wonka could make ice cream that wouldn't melt, even in hot sunshine. So the obvious question is, why not make a tropical palace out of chocolate that didn't melt?
The only sensible answer is that he was using the phase change of chocolate to maintain room temperature in the palace. While the phase changes of water, at zero degrees to ice and 100 degrees to steam, are too high and too low for a comfortable ambient climate or efficient heat production, chocolate changes its phase at a much more useful temperature.
The melting point of the best chocolate is around 34 degrees Celsius. This is an ideal temperature from a culinary perspective as it is low enough to melt in your mouth and high enough not to melt in your pocket. Unlike water, which is predominantly H2O molecules, chocolate contains a variety of substances in various forms of crystalinity, so the melting point will vary. The art of great chocolate making is to get the right kind of crystals of fat in there, but hearing about this suddenly makes its taste much less appealing.
There's also likely to be a lot of hysteresis. This means that it may melt at 34 degrees, but you have to cool it down below 28 degrees to get it to solidify again. I usually put it in the freezer.
So if Mr Wonka, who elsewhere exhibits a great mastery of the physical sciences, was indeed trying to make a phase change building, it would work something like this.
The temperature inside would stay below the melting point of the chocolate. On a hot day the chocolate would start melting. As it melted, it would absorb heat from its surroundings, therefore having a cooling effect. Later, the melted chocolate would solidify, emitting heat into the inevitable coolness of the night.
If he was trying to make a phase change palace, though, he didn't do a very good job, and shouldn't really have been advising Prince Pondicherry to eat this thermodynamic wonder.
In the winter, chocolate could work in the opposite way, absorbing heat from the sun in the day time, and melting in the process. As it cooled later inside the building, it would solidify and release heat as it changed its phase. The best thing to do with this chocolate would be to line a south-facing internal wall with it, so that it would catch the sun coming through south-facing windows. Painting a wall with chocolate is probably not to be recommended as it would run down the wall when it melted, and all end up at the bottom. Fixing chocolate in sealed bars, preferably in heat-absorbant black, would be much more effective.
And if it got really cold, you could always eat the chocolate.