Thank you for your question.
In California, a lanlord must repair problems that make the rental unit unfit to live in or uninhabitable. If there are electrical and/or plumbing problems which do not comply with local code, then the landlord must repair those problems. If your rental agreement does not otherwise assign you with responsibility for making all repairs, then you have a claim against your landlord for breach of the lease and the implied warranty of habitability.
The first thing you need to do is identify the repairs that need to be made and send these in a letter by certified mail return receipt requested. You should date the letter and keep a copy. If the landlord fails to make the repairs in a satisfactory manner and correct the problems with the house which keep it out of compliance with the building code, then you have several options.
The "repair and deduct" remedy allows you to deduct money from the rent, up to the amount of one month's rent, to pay for the repair of th problems in the rental unit which affect your health and safety. This does not cover non serious repairs that are needed, but things like a leak in the rough, leaky plumbing, no hot water, etc. If the repairs cost more than one months rent, this is not the remedy you want to use
The next remedy is to abandon (i.e., move out). This is what you should do if the repairs needed would cost a lot more than one months rent and the defects are a serious and direct threat to your health and safety. You need to make sure that the defects were not caused by you (based on what you've said they are not). You must give the written notice described above and give the landlord 30 days to repair. If the landlord doesn't repair, then you send another certified letter explaining that you are moving out because he didn't repair and then you have to actually move out.
The next remedy you can chose is to simply withhold rent. You can stop payment of some or all of the rent if the landlord does not fix very serious defects, such as a collapsed ceiling; continued presence of rats, mice or roaches because of a refusal to exterminate; lack of any heat in the apartment; plumbing blockages; exposed and faulty wiring; and/or an illegally installed and dangerous stove. You want to be very very careful in using this remedy. You would follow the written notice and time to repair guideliness stated earlier. In this situation, determining how much to reduce your rent payment is done pursuant to a determination by you of how much the damages make your living space uninhabitable. If the damages make it so that you cannot truly use certain rooms, you can deduct a percetnage for that room. For example, if one of a rental unit's four rooms is unihabitable, the tenant would withold 25 percent of the rent and pay the other 75 percent. Most importantly, if you do withhold the rent, you cannot spend it. You have to set it aside, as you may be ordered to pay it back to the landlord after a court decides what to do.
Finally, you have the option of suing the landlord ro recover money damages if the landlord does not repair the serious defects in a timely manner. This lawsuit may be filed in small claims court or the Superior Court . Here you can ask for damages (such as what you have to spend to remedy the situation, or if you have to actually move into a motel because of the unrepaired damages). The court can also order the landlord to repair the apartment. In order to win this suit, you actually have to have a city inspector come by and inspect the building for its defects and send a written report to the landlord.
Please let me know if this answers your questions or whether you have other questions you need answered on this issue.