It was narrated from 'Aishah that the Messenger of Allah P.B.U.H said: "The Pen has been lifted from three: from the sleeping person until he awakens, from the minor until he grows up, and from the insane person until he comes to his senses." (Hasan)
In his narration, (one of the narrators) Abu Bakr (Ibn Abu Shaibah) said: "And from the afflicted person, until he recovers." (Hasan)