Sayyiduna Ibn Abbas (may Allah be pleased with them both) narrated from the Prophet (peace and blessings be upon him): "When Allah's Prophet Sulayman (peace be upon him) stood in his place of prayer, he would see a tree growing in front of him, and he would ask it: 'What is your name?' It would say: 'Kharrub (carob).' He (peace be upon him) would ask: 'For what purpose have you grown?' It would say: 'For the ruin of this house.' So Sayyiduna Sulayman (peace be upon him) said: 'O Allah, conceal my death from the jinn, so that mankind may know that the jinn do not know the unseen.'" The narrator said: Then he (peace be upon him) carved a staff from that tree on which he would lean, and the termites ate it, so it fell and he (peace be upon him) fell down. The people estimated how long the termites had been eating it and found it to be a year. Then it became clear to mankind that if the jinn had known the unseen, they would not have remained for a year in that humiliating punishment. Sayyiduna Ibn Abbas (may Allah be pleased with them both) used to recite this (verse) in this way.
The jinn thanked the termites, and wherever they (the termites) were, the jinn would bring water to them.
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12229