Madrid's mayor on Sunday advised all residents to stay at home as the capital braced itself for torrential rain and storms affecting parts of Spain.