You have to answer the unlawful detainer (UD), as you stated, within five days. The landlord is obligated to serve some kind of written notice prior to the UD - what notice was that? Was it a demand to pay or quit?
You have a habitability issue . If the building inspector is involved, and you get a copy of that report, you will be able to prove the habitability issue. Get the plumber's bills, too - both if you can (you may have to get the first one's notes through the discovery process). The harder part for you is proving that you gave the landlord appropriate notice and reasonable time to fix the issue: You have a problem with your documentation. Although you took proper steps by notifying the landlord of the issue, waiting a reasonable time for repairs and then repairing and deducting (though you should have given landlord notice before you repaired and deducted), you can't prove it without a document trail. (You should always put requests in writing and keep a copy.) Your job then is to figure out how to prove the notice without the writings. Records of phone calls? Landlord's maintenance records?
You've been there 26 years. Can you negotiate? Is the house even safe to live in? There is just too much information needed to answer any more completely. This issue is worth consulting an attorney.
Attorney Farley has given you an excellent response. You have many viable defenses, but any defenses must be timely asserted. Hopefully, you have already hired an attorney to respond to the summons and complaint.
Frank W. Chen has been licensed to practice law in California since 1988. The information presented here is general in nature and is not intended, nor should be construed, as legal advice for a particular case. This Avvo.com posting does not create any attorney-client relationship with the author. For specific advice about your particular situation, please consult with your own attorney.