☔ DIY Zigbee rain gauge

I think I did this as you suggested already. Right ?

Yes that’s what I mean! So that does give 1 flip each night/reset?

Can you show the history of one of the rainsensors:

  • the sonoff sensor (binary sensor)
  • on count (history stats)
  • off count (history stats)
  • flip count (the template sensor)


Guess this is what you’ve asked for ?

Yes, that night looks OK, initially at reset, it was 0. Do you have an example where it didn’t reset to zero?

Can’t find any at present. I’ve added the intensity to the history stats on the 17th of May when it happened in the afternoon, when the intensity value didn’t reach 0. It reached it at about 14:20.

This is the correct relation, the above posts shows rain sensor 3 with the intensity if rain sensor 2. Here we go. So there we see the flip at 14:20. I think all is working fine and there is no bug. :wink: as I thought.

1 Like

Sorry, I just reread your initial question and noticed that we’re talking about the intensity sensor, not the mm sensor, oops.

What I think is that the intensity sensor reacts to the fast state changes that happen when the history stat sensors are reset.

You mean at midnight, the intensity drops all of a sudden. It recovered to its about previous value again at 00:20 approx.
Can this be solved ?

But looking again at the time between 07:00 and 14:20: There was one flip within these 7 hours at 14:20. Means that there was ~0.3mm of rain within 7 hrs. the intensity remains at 0.3mm / h for the whole 7 hrs. which appears to be too high. Better would be 0.3/7=0.042

I think the drop of the intensity can only be fixed if the source of the intensity sensor does not reset, for example a number that always increases (all time rain sensor)

understood. Makes sense.

1 Like

Another question @parrel !
How can I create a ‘switch’ in home assistant to temporary disable rain logging in order to do tests with the flip mechanism ? I still like to see the flips and able to reset them a value freely chosen after my tests are concluded. Can you assist how to add a helper or whatever is needed in configuration.yaml ? Thanks a lot !

Hi,

This looks like a great sensor! Nicely done.

I would like to know how sensitive this sensor is? Because I would like to trigger some automations or notifications as soon as it starts raining a little bit. (Close car windows, warning to close doors if they are open, close the freaking window in the attic etc)

However this sensor looks to me that there must be quite some rainfall before the flip flips :slight_smile:

I hope I’m wrong but who can tell me?

Yes you can, somebody has already done this somewhere in this thread, not too long ago.

For the purpose of detecting if it’s raining, there is a better way: a rain drop sensor. There are projects on here, also using the aqara sensor!

1 Like

Thanks ! Tried to find it - but didn’t succeed so far :pensive:

hi @Johncoffee

i did is this way…
i created a helper input boolean called “input_boolean.rainsensor_mainswitch”
the binary sensor in configuration.yaml looks like this…

binary_sensor:
# RAIN binary_sensor start
  # restartsafe invertsensor
  - platform: template
    sensors:
      regensensor_contact_invert:
        value_template: >-
          {% if ( (is_state('input_boolean.rainsensor_mainswitch','on')) ) %}   
            {{ is_state('binary_sensor.aqara_rs_59_contact', 'off') }}
          {% elif ( (is_state('input_boolean.rainsensor_mainswitch','off')) ) %}   
            {{ is_state('binary_sensor.aqara_rs_59_contact', 'unavailable') }}
          {% endif %}
  
          #{{ is_state('binary_sensor.aqara_rs_59_contact', 'off') }}
        device_class: door

Thanks a lot @FrankRy ! Will do the same and see whether I understand it !

Just try to understand your script. You create a new ‘variable’ named ‘…inverted’ that is the inverted rain sensor condition if the main switch is ‘ON’ and ‘unavailable’ when the main switch is ‘OFF’. Question - why do you do it as a inverted signal ?

Hi,

i built this rain gauge and it worked flawlessly for like 6 months. Today it rained 50mm which it measured without a problem. But suddenly it stopped sending any measurements. It does log every 50 minutes that it is still in the network but no measuring is happening.

I suspect that the mechanical part is stuck or so and was asking myself if someone else also had a similar problem with their sensor

Thank you

@Johncoffee as i remember, there was an Problem with unwanted counting of flips just when HA restarts… inverting solved that… not sure if it was only by using ZHA or zigbee2mqtt as well, but i used that code to be safe… pls search in this topic for “inverted” and you will find the orginal post…

br Frank