Try a 1-wire counter, e.g. the DS2423 [0] for the rain gauge. It can be powered either from the ESP or via a coin-cell. You read the counters whenever you need to.
You can talk to 1-wire either via I2C (e.g. the DS2482 [1]), or you can easily bit-bang 1-wire via a GPIO or UART [2].
You can talk to 1-wire either via I2C (e.g. the DS2482 [1]), or you can easily bit-bang 1-wire via a GPIO or UART [2].
[0] https://www.maximintegrated.com/en/products/digital/one-wire...
[1] https://www.maximintegrated.com/en/products/interface/contro...
[2] https://www.maximintegrated.com/en/app-notes/index.mvp/id/21...