remove the two comments, or fix the indentation like in the original post. I suspect they cause an error
#If you have issues with the history sensor doubling after restarting HA, add the line below (@BigG)
#availability: "{{ (states('sensor.rain_sensor_flips') not in ('unknown', 'unavailable')) }}"
Yes, I removed the two comments and now Rainfall Today is 0.4 in.
I suspect at this point, the weekly, monthly and annual all should read the same value.
They are reading Unknown. That’s an assignment for me to figure out.
@ekainz Unfortunately, I have to write again. Everything works except for the rain intensity. It always only shows me 0.00mm/h. But I can’t find the error. When I put it in the developer tools, it tells me ‘trigger’ is undefined.
Is this just a formatting issue? I just can’t get to the error and hope someone can help me
Hello, with the help of a friend, I was able to make the rain gauge soldering to work. Now this is working in HA.
However I noticed, an issue. When rain is very weak, let say 1 mm drop in 30 minutes, the rain gauge does not count anything. I noticed the drops remain on the device and don’t fall into the hole. Have you also noticed it ? And did you find a workaround ?
I use a Sonoff DW2 door sensor via the Sonoff custom integration instead Zigbee Aqara sensors didn’t work reliable and were unavailable often. Should work as well, right? Actually it does, only the rain density seems to behave strange though.
Currently it is ‘closed’ - and it doesn’t happen this afternoon. Yesterday it happened. Don’t know the state at that time however. Will keep a eye on it!
If I’m correct, closed is equal to ‘off’ and if you take a look at the history_stats sensor, it counts the ‘off’ states, meaning that every reset at 00:00, it counts a tip because its ‘off’ at that moment.
If you followed the original post method (on->off->on) then your sensor didn’t sent the last ‘on’ signal. If you use another method where one side is ‘on’ and one side is ‘off’ then you need to solve it in another way, described somewhere in this thread.
You can check the history of the sensor to see what the state was, right?
My sensor is indeed a ON-OFF sensor. Each time it tips, the state changes. You are right, I had to change the code for it to work. Got help from a nice user in this forum/thread to achieve it. I need to find it again in the thread.
See the states of the sensors (I have two rain gauges just for fun, about 2m apart from each other at a different height above ground). One called ‘Regensensor 2’ and one ‘Regensensor 3’. If I understand my code in configuration.yaml correct, the intensity is calculated by ‘Regensensor 2’. (I have to admit that after a period of 6-8 months after ‘constructing’ my code, I do not fully understand it. HA code is a bit difficult to master. I have a book 540pages book of Udo Brandes ‘Home Assistant’ - but still struggle a lot to understand the concept of Helpers, Template sensors etc.)
Here is my setup using a Sonoff DW2 window sensor. I’ve 3D printed a Box to keep it dry inside the rain gauge and glued a small ø5mm magnet to the flip mechanism, resulting in ON or OFF (Closed / Open for the door I believe). I placed it on top of my pergola.
Just thinking out loud, you might be able to modify the code in the original post, by adding two history_stat sensors, one counts ‘on’ and one counts ‘off’. In the template sensor, you count both sensors together, and then decrease that value by 1 (because of a false tip each night). The number that you end up with, needs to be multiplied with the rain per tip (default 0.30303) and then you have quite a simple solution.