Well, here's my thoughts on this problem. The plumbing issues are the responsibility of the LL, unless there is absolute proof that you were the cause of all this damage. His proof would be something in writing from the plumber on what was found to be the cause, meaning you.
If you had no fault in the plumbing issue, then the carpet was also the responsibility of the LL. His rental had a malfunction, and he must fix it. I feel new carpet and padding should have been installed due to a further possibility of mold, etc. (health reason)
Not having the ceilings repaired for a month I can understand for various reasons. Sometimes repairs can take awhile due to many things, such as scheduling contractors, etc. So I wouldn't make a big deal of this.
And the same for the microwave. It was an inconvenience, but it was replaced.
Unless you damaged the walls, painting is also the LL responsibility. Normal wear and tear. But I do hope the home was cleaned prior to your exit, otherwise the LL can deduct for that.
As far as the LL/plumber entering the property without notice, I am on the fence with this. Notifying you is the proper and right thing to do. But a LL does have the right to enter in an emergency to fix things if his property is in jeopardy. Personally, I think he should have advised you, but don't think it would be an issue to take up in court unless you had something stolen, etc.
The water heater is the LL's responsibility. I would want proof of the age of the old water heater in court. I can't imagine what you could have done to damage the unit. I bet it was older and due to be replaced. And as far as wanting to keep your deposit because you did not notice or report the leak, this is a joke. Your LL is responsible for doing his inspections on his property to look for these types of things. He didn't do his job. A LL has the right to inspect his property. I have heard of some LL that do it every 3 months and others once a year.
As far as what the lawyer said to you, I don't believe he is correct. If the LL sues you, it will be his responsibility to prove you did all this and are responsible. That means a plumber as witness along with photos, receipts for everything, correspondence, etc.
And if your security deposit was not returned within 21 days of vacating the property, you should have received a letter itemizing every thing he is deducting from your deposit along with an explanation and copies of the repair receipts. If he has not done this, he has already violated the law. Judges don't look kindly on this type of thing from a LL.
Be sure to keep photos, medical expense records and receipts for the pneumonia treatment, all correspondence, etc. to submit in court.
You did not elaborate on why the LL wanted to keep your deposit for landscaping? Did your animals destroy the yard? If not, this should be returned.
My opinion is your LL wants you to pay all expenses plus, other than what his insurance will pick up. I think a judge will see this too. Be concise and organized. Don't state the petty stuff. Go after the money. I'd take this turd to small claims court myself. My guess is this isn't the first tenant he's tried to stick it to. Good luck.
Beth
I'm assuming this home was in California:
California Tenant Law - Non-profit legal advice for California renters' rights