Nice post @gdschut , i used the code from @bernat.albet and so far so good, but how do you all work with deep_sleep? after around 30 secs and pushing all other sensor data, my wemos is going to deep_sleep. It seems because of that not always rain is passed, because it is not counted while it was online.
my output is giving this:
[12:01:14][D][pulse_counter:159]: 'SolarWeatherStation Rain': Retrieved counter: 30.00 pulses/min
[12:01:14][D][sensor:092]: 'SolarWeatherStation Rain': Sending state 10.77763 mm with 2 decimals of accuracy
Is this correct? because i only flipped the Rain sensor just once! now it is giving 30 pulses? 10 mm ?
no problem. How about the measuring?
Perhaps i donāt understand the calculations, but my output is something around the 120-190 pulses/min with the rain sensor and around 50-80 mm sending to Home assistant. But , really? 50-80 mm? if i read the local weather authority they talk most of the times about 0,5 - 3 mm ?
or does the 'update_interval: 2s ā which i have now need to be at 60 sec?
The calculation depend on the type of sensor, you should calibrate it yourself if you have another type of sensor. The update interval should be the times HA is updated about the value.
To be honest I changed the whole setup to be more independant from network troubles. I do pulse counting and storing on the ESP side, and update an HA sensor from the ESP In HA I calculate Daily Rain. My esp yaml:
I did by calculating the top area of the sensor.
Than I measured 200ml of water and dripped it slowly into the sensor, counting the wips of the sensor.
area: 49mm x 110mm,
200ml ā 101 pulses.
1mm rainfall = 5,39 ml.
1ml = 0,1855 mm.
1 pulse = 1,98 ml.
1 pulse = 0,367 mm rain.
why are you using delayed_off as 100ms?
on my sensor (identical with yours) flips are much faster than 100ms so if I keep this number, it discards a lot of transitions (pulses).
For now I removed completely the delayed_off and it seems to count all pulses (I also have a pull-up between D5 and 3.3v)
It works different, read about it here: Binary Sensor Component ā ESPHome
I never experienced missed pulses, but very rare I have false positives, but I still do not know what caused that.
What do you mean it works differently?
Line stays on ON. When a pulse occurs, it goes to OFF for the duration of the pulse, then back to ON.
So delayed_off simply requires the OFF to stay for 100ms in this case. Meaning that the pulse must be at least 100ms long, otherwise is completely discardedā¦
And I am seeing much shorter āoffā pulses - probably 3 or 10 times fasterā¦
From documentation: āOr in other words: Only send an OFF value if the binary sensor has stayed OFF for at least the specified time periodā
Hi Gerben,
Iām a newbie in Home Assistant. Im trying to migrate from Domoticz)
My pair of espeasy and Domoticz worked flawless for years. I found your setup for the rain gauge. Unfortunately, i have not any date. Iām sure that iām doing something wrong. Therefore pls, sorry for silly questions)
I have created the country via Helpers, however it looks like the HASS doesnāt see it:
What I find in the log:
Unable to find referenced entities input_number.rain_pulse_count
Hi, no problem, and welcome to Home Assistant!
I think I would first check under developer tools if the entity really exist. Perhaps a typo in the name?
Than check in configuration, integrations if your esp has connection with HA.
With ESPhome you can monitor your esp with ālogā from command line or HA user interface if you use ESPHome addon.
Hope this helps! good luck!
ok, that explains itā¦ so GND connected to the relay, with a possible pull-down on the pin instead of my pull-up.
Wiring is completely reversed compared with what I have.
In this case delayed_off simply makes sure there are no 2 pulses faster than 100ms (which seem OK at 1 pulse =0.36mm/m2. Faster than 1 pulse every 100ms means actually more than 3 liters of rain per second for each m2 and if I had that I would have bigger drowning problems than the functionality of this sensor).
I simply could not get it to work properly, so I changed the setup so all the calculations are done bij HA instead of on the ESP. There is now a global var on the ESP counting all the pulses for the day, and uploading the number into HA by using a service call every minute or so, so HA knows all the actual pulses of today and calculates the amount of rain. Now this makes it also not depending on a stable network.
The count of pulses is reset by midnight, to start on the new day with zero again.
Edit: now with the right code
Found out I had two sensors (daily_rain and rain) and I thought I was using the daily_rain but in fact it was the other. For strange reasons I only get this working in configuration.yaml instead of in sensors.yaml. Does anybody know how to move this to sensors.yaml???
Now with the new statistics it is also nice to add this sensor with a statistics lovelace card
You need the state_class: measurement to get it into the statistics.
Another strange thing: No icon is accepted for this type of sensorā¦ (donāt know why)
As you can see the sensor I use is named ārainā only, as it increases over the day, and is in fact a daily rain sensor. I use the utility meter for monthly calculations.
Haha, thanks, very stupid but I didnāt immediately think of that place and that while it is already completely full. But thanks a lot!! Gonna try it right away