Rain gauge data presentation

I have a rain gauge based around ESPHome that reports a rain rate in mm/h every few seconds whilst it is raining. It will then report nothing at all until there is next some rain, going into deep sleep mode to save battery.

Currently in HA that means that in between rain showers, the rain rate reported by HA shows as constant at the last reported rate - when in fact zero would be more accurate. It also means that the sensor sometimes reports as “offline” - when in fact it is just not raining.

It feels like some kind of moving window that reset the displayed sensor value to zero after a short period of no reports would help - but I’m unsure how best to achieve that…

Looks to me like you must set up a 60s timer after the last reading to repeat the reading and, if there is no rain at that time, you report zero and truly go to sleep indefinitely until you are woken by GPIO.

I have fair success creating sliding windows as discussed in this thread:

https://community.home-assistant.io/t/statistics-sensor-becomes-intermittent/591213

But in that thread I also raised a question about a problem that I’m having where some data is just being ignored during heavier rain events. No feedback as of yet. And I haven’t fought with it much the last few days to try and find a solution.

One of the things I also generated from the 1 hour sliding window statistics sensor is a bar graph like this using the ‘statistics graph card’:

ha_rain_graph

It does a pretty good job of giving you a sense of the rain rate hour by hour. Though there is some flakiness with how it updates between rain events.

Hopefully what I have done will offer you some ideas or inspiration.

Thanks both - I’ll read into both your answers properly now!