☔ DIY Zigbee rain gauge

I use the Aqara leak sensors for connecting external sensors, but currently for other purposes like pressure sensors in chairs or under doormats to detect presence.

My original plan for the rain sensor was to do exactly as you described - connect the screw terminals on the leak sensor to the wiring for the rain gauge sensor. However, the Aqara leak sensor has a delay when going from wet to dry. It responds almost instantly when water is detected (contacts closed), but it has a 5-15s delay from when the contacts are opened to when it reports dry. I tried multiple Aqara leak sensors, and they all behaved the same way.

That’s why I went with the contact sensor as in this thread. I haven’t tried other brands of leak sensors, but if others have immediate respose to changes in the contacts, they should work. Anyone else have experience with other Zigbee leak sensor with external terminals? Do they respond immediately?

I tested Water Leak Sensor TS0207_water_leak_detector_2 (no alarm luckily) with a reset switch/push button; first impression it does not suffer from delays but I experienced an occasional no-counts. However this was likely due to the frequency / instant release of the push button, if the frequency is more than a second (for each flip) it seems to work good. Clueless about ZigBee signal and battery life. When I receive the other one I will do a similar test.

@parrel Do I just copy and paste your code into my configuration.yaml and I’m all set?

Yes, should be, and if not, please let me know :slight_smile:

F.Y.I As alternative ZigBee device also a Aubess IH-K665 can be used. Pro’s and cons’s are:

  • casing claims to be waterproof
  • soldering possible without opening casing (but will be nearby plastic)
  • easy pairing due to big reset button ever under the rain drop (had to RTFM to find it)
  • works in Zigbee2MQTT
  • reaction between wet - dry - wet looks good
  • battery life unknown
  • reception ZigBee signal unknown

I will not use this device as a counter but for instant indication of rain to control my awning, this can be “as-is” but in that case the delay is likely too long because it needs to fill with water and this can be too late for my awning so I attached an additional rain sensor (like MH-RD) for better reaction (see picture).

I just set this up, and I need some help fixing my code. I used the apex chart, but it is showing 19", even though the “rainfall today” is only at 1.2"

Also, since I simulated all of this rain during my testing, how can I clear all of the data and reset it to zero?


Which sensor do you use for the graph?

sensor.rainfall_today

The graph matches now. Simulated 34 flips.

Do you know of a way to delete all of my testing data?

The fastest way would be to just rename the entity ids in YAML

this was great, very easy to convert this thing to wireless.
I 3D-printed an extension bucket to have a bigger receptor for better accuracy.
Wanted to share with the community.
Link to 3D file

the larger surface area of this one is 231 cm2, so you’ll need to re-calibrate using these numbers.

in return i hope someone can show me yaml code for how to get the past dayly rain and forcast rain for next days into one graph using apexcharts-card as shown in first post.

Cool! Thanks for sharing the 3D file.

Which weather service you want to integrate the forecast with?

im using Open Weather Map

To make a graph like that, you need data points with the amount of rain in the following way

12:00 → 1mm
12:10 → 1.1mm
12:20 → 1.3mm

I don’t think Open Weather Map provides that looking at the documentation, but if you find something like that, let me know.

1 Like

which weather provider did you use for creating that forecast graph from your original post? for me it doesnt matter yet which service to use as i am still setting my entire HA up from scratch

It’s a Dutch weather service so the question is, are you Dutch? :wink:

yep, dutchie here too, but i live in spain. looks like buienalarm works here too. I now saw your earlier post of the code for the apexchart of sept22. So i’ll use that (though i’m strugling to understand the code for the “data_generator”)
Another interesting usable integration would be openweathermapHISTORY. It supports rainforecast per day for the next 7 days. so you could make another chart with that for a longer period.

You’ll need this custom component: GitHub - aex351/home-assistant-neerslag-app: Neerslag app for Home Assistant. All-in-one package (Sensors + Card).

That will create a sensor that contains the precipitation data in it’s attributes.

The code converts it into data that the graph understands.

It’s been almost 3 years since I created the rain gauge and it’s still running on the same battery. Great piece of hardware that Aqara made.

2 Likes

Great, printed it and installed the extension bucket.
Perfect fit.

I recalculated the mm/pulse value to be (based on 231,66 cm2 area)

mm_per_pulse = 0.072088405

I wonder how much this will affect battery life, as it will flip 4x more than the original situation :wink:

3 Likes

hi @jjansen85 , nice solution on roof of garage mounted on a simple piece of wood :+1:
But I would be concerned that the electronics would be flooded in heavy rain (tropic thunder storms) if the roof was “under water” for a short time? :thinking:

br Frank