☔ DIY Zigbee rain gauge

Thank you for the offer, it is very kind of you! I have Sonoff ZBN-04 sensors, so I don’t think this case would fit them, but I really appreciate the gesture! :slight_smile:

Thanks, but I have a printer myself!

I think the problem I am having is that the the original board has 2 reed switches - in the demonstration GIF, I can see that the gauge is supposed to go from closed to open to closed again, as I tip the "scale from one side to another.

So far I could not manage to position the Sonoff reed switch in a way to simulate this, it is either picking up one side as “closed” continuously or the other.

Could you send a picture of the board with the two reed sensors? My board only had one.

If you count a flip of the bucket as a state change it should not matter that one side is always “closed” and the other always “open” no?

I am just wondering everybody is pretty focused on using a door sensor like the Aqara; dismantle its reed sensor and connect both poles with the rain gauge. Why not using a water leak sensor?, some cases are apparently even waterproof and the connectors are outside the case, with half the price of the Aqura they look like a better deal.

Above version not yet received but another model TS0207_water_leak_detector_2 was added today and in combination with a Raindrops Detection Sensor just works.

(Background the weather forecast of i.e. Buienrader in the Netherlands is not foolproof and I wanted to add a more local rain sensor for my sunscreen)

Well, the code in the OP counts the ‘off’ states and not the ‘on’. So if it tips and changes from off to on, it will not count a state change.

I assumed it would be straight forward to have it count on any state change, maybe that’s not the case, I haven’t actually done much automation stuff.
Either way, I just checked again and my Sonoff gauge does change open-closed-open on every bucket tip.

I’m totally agree with you!

Yes that should work fine and the price is cheap!
However it does look a bit bigger, and I’m not sure if the battery life is the same as an Aqara.

For comparison, my Aqara sensor has been running on the same battery since I created the original post.

Let us know how it goes :slight_smile:

1 Like

It is pretty straightforward to have it count state changes vs. just off. That’s how I implemented it in my post on Jun25.

The main downside I can think of for configuring that way vs. the OP implementation is that battery life might be shortened. From what I’ve read, contact sensors in the closed (on) position use more power than when in the open position. If the sensor only closes briefly when the bucket tips from one side to the other (meaning that it’s open when the bucket is in either resting position), that should maximize battery life. It requires precise sensor positioning, though, as you mentioned.

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