Section 1942.5 is a timing rule with teeth. Subdivision (a) says that where the landlord retaliates because the tenant exercised rights under the chapter or complained to an appropriate agency about tenantability, and the tenant is not in default on rent, the landlord may not recover possession, cause the tenant to quit involuntarily, increase the rent or decrease any services within 180 days of five listed events: the tenant's good faith notice under § 1942, a bed bug notice or an oral complaint about tenantability; a good faith written complaint, or a recorded oral complaint, to an agency of which the landlord has notice; an inspection or citation resulting from such a complaint even where the landlord had no notice of it; the filing of documents commencing a judicial or arbitration proceeding about tenantability; and entry of judgment or an arbitration award where tenantability was decided against the landlord. Where several apply, the 180 days runs from the latest.
Two limits sit on subdivision (a). The tenant must not be in default on rent, and under subdivision (b) may not invoke the subdivision more than once in any 12-month period. Subdivision (c) adds that reporting or threatening to report the tenant, or people the landlord knows are associated with the tenant, to immigration authorities is retaliatory conduct under subdivision (a).
Subdivision (d) is a separate and wider prohibition that is not tied to the 180 days: it is unlawful for a landlord to increase rent, decrease services, cause a tenant to quit involuntarily, bring an action to recover possession, or threaten any of those, to retaliate because the tenant lawfully organised or took part in a tenants' association or lawfully and peaceably exercised any rights under the law. Under subdivision (d) the tenant bears the burden of producing evidence that the conduct was in fact retaliatory. Subdivision (f) preserves the landlord's rights under the lease and other law, so the section prohibits a motive, not an act — which is why these disputes are decided on chronology and documents, and are worth taking to a lawyer.