☔ DIY Zigbee rain gauge

Hey all,

This build is awesome!!! upon finding the topic i immediately purchased the rain meter and this is on the way.

I was already in possession of a Aqara door sensor so I went ahead with the code. But so far the code is not working for me and after 2 hours trying it’s driving me crazy. The sensor works perfect but the flips count is not working at all! my question is what am I doing wrong…:

#### History stats ####
- platform: history_stats
  type: time
  name: Rainsensor flips
  entity_id: binary_sensor.rainsensor_on_off
  state: "off"
  start: "{{ now().replace(hour=0, minute=0, second=0) }}"
  end: "{{ now() }}"
1 Like

You do see the binary sensor change statuses?
Try single quotes for the values instead of double quotes. Any errors in the logs?

Nevermind, your type should be count not time. Where did you get this code from, you can copy the working code from the main thread :slight_smile:

Yeah sorry that was after trying 2 hours of all kinds of ways getting it to work or at least to generate some values…

You mean like this?

#### History stats ####
- platform: history_stats
  type: count
  name: Rainsensor flips
  entity_id: binary_sensor.rainsensor_on_off
  state: 'off'
  start: "{{ now().replace(hour=0, minute=0, second=0) }}"
  end: "{{ now() }}"

Edit1: Sadly this still leaves me with rain flips at 0 :frowning:
In Which log should I be able to find how helpers/history_stats are performing

Edit2: !I got a second stats now working by generating 1 from the helpers page but I’m so frustrated why code wise the first stats is not generating any output

1 Like

I think it’s the double quotes in the start and end keys

Got the rest to work via the second history stats sensor configured(with the same state/type/start/end) in the Helper tab but the code still is not functioning. if somebody has a hunch in what it could be in the configuration or setting is, I would love to know. Hate these kind of situation :wink:

#### History stats ####
- platform: history_stats
  type: count
  name: Rainsensor flips
  unique_id: rainsensor_flips
  entity_id: binary_sensor.rainsensor_on_off
  state: 'off'
  start: '{{ now().replace(hour=0, minute=0, second=0) }}'
  end: '{{ now() }}'

Amazing project! thank you very much for sharing.
For me the reed switch didn’t work well because the magnet moves too fast, so I moved it so that there is a contact when the rain flip is not moving.

Now I have rain amount in my weather stat graph :star_struck:

1 Like

Little update.

Some weeks ago it rained and the sensor did not report rain. I thought it finally ran out of battery and opened it. I found out that a spider had attached the bucket to one side with its web! :spider_web:

Almost 4 years with the same battery, and still going strong!

Long term statistics of the battery:

1 Like

Thanks for the project. I have read the entire thread but I can’t get anything. I don’t know if the complete code must be copied into configuration.yaml or if two different files must be created: sensors.yaml and templates.yaml, each with its own code.
I have tried every possible way, but nothing, I am not able to get anything to appear. I’m trying to do it with @parrel original code
Any help is welcome. thank you

What is the top sensor in your screenshot? Do you have a sensor from zigbee2mqtt that reports an open/closed state?

Yes. it´s an Aqara door sensor

I have this in configuration.yaml

I think sensor.sensor_lluvia_flips does not exist.
Try to keep everything the same as in the original post first, then change names if you got it working and want other names. Only change the binary sensor to your aqara sensor.

I have change the id sensor of my Aqara to “rainsensor” and the rest are the same that the original post.
rainsensor_flips exists but only in history. The card… only shows the sensor status.

Thanks for the help

And this is the history…

What is the value of the rainsensor flips sensor? Add all sensors to your dashboard, that’s easier.

Is there a Matter over Thread door sensor that would also work with this? I bought the Aqara P2 and it does not have the same kind of switch to desolder. I see a couple of others on Amazon but I wanted to ask and see if anyone has tried any of them successfully

Sorry for late reply… Yes, I know that it should be easy, but I’m not able to make it appear in the card like yours. Still show me only the status (wet / dry). I’ve been trying for several days, but nothing…

You’re on the device page and it won’t show there. Add the entities to your dashboard or view them under ‘entities’.