An armed neighbour turned up at the house next door with a kitchen knife three times in one day.
Rayhan Miah was "angry" and "shouting" during the visits to the family home and caused upset to the occupants due to his behaviour.
The 46-year-old, of Cleveland Road, Sunderland, who has a history of mental health problems, admitted harassment.
Newcastle Crown Court heard Miah had been drinking alcohol and taking cannabis, on top of his regular medication, before the three visits.
He told police after his arrest that he had been trying to alert the family to a fire.
Julie Clemitson, mitigating, told the court: "In the doctor's opinion he was ill at the time. He was ill enough he may or may not have been insane."
Judge Jeremy Freedman sentenced Miah to a community order for 12 months with requirements and a five-year restraining order to keep him away from the neighbours.
Judge Freedman said: "Whether he was ill or not at the time, the fact remains he posed a serious risk, having a knife outside of someone else's house. The potential for harm was very great."
Judge Freedman said the visits caused "distress, alarm and upset" to the neighbours but concluded Miah, who has been banned from going home since the incident and spent seven weeks in custody, "needs ongoing help".
The incident happened on July 2 last year.