Weather hat rain total

Hi,

After cleaning out a spider egg case, I’m getting readings from the rain sensor.

I watched the rain_mm_total.total() grow and then it went down and would eventually go up (raining through the whole time) - using averaging.py example.

I created a test version av.py:

(pimoroni) pi@weather:~/weatherhat-python/examples $ diff av.py averaging.py
5d4
< import datetime
68,69d66
< with open (“/tmp/readings”, “a”) as f :
< print(f"{datetime.datetime.now():%Y-%m-%d %H:%M:%S} rain total: {rain_mm_total.total():0.2f} mm", file=f)
71c68
< time.sleep(5.0)

time.sleep(5.0)

\ No newline at end of file


The results in /tmp/reading:2025-02-01 15:19:12 rain total: 0.00 mm
2025-02-01 15:19:17 rain total: 0.00 mm
2025-02-01 15:19:22 rain total: 0.00 mm

2025-02-01 15:22:32 rain total: 0.28 mm
2025-02-01 15:22:37 rain total: 0.28 mm

2025-02-01 15:46:00 rain total: 1.40 mm
2025-02-01 15:46:05 rain total: 1.68 mm

2025-02-01 17:07:49 rain total: 4.19 mm
2025-02-01 17:07:54 rain total: 4.19 mm
2025-02-01 17:07:59 rain total: 3.91 mm

2025-02-01 17:11:39 rain total: 3.91 mm
2025-02-01 17:11:44 rain total: 3.63 mm

2025-02-01 17:15:54 rain total: 3.63 mm
2025-02-01 17:15:59 rain total: 3.35 mm

2025-02-01 17:19:50 rain total: 3.35 mm
2025-02-01 17:19:55 rain total: 3.63 mm
2025-02-01 17:20:00 rain total: 3.63 mm
2025-02-01 17:20:05 rain total: 3.63 mm
2025-02-01 17:20:10 rain total: 3.35 mm

Any suggestions?

.

Using chat gpt’s suggestion I found a history_depth=1200 in class History - 1200 * 5 second interval makes 100 minutes.