Or at least, my original did. I am currently updating at 20s intervals, only because I also use this data to detect air in the pipe (ie borehole empty). It does not make any difference to HA or to the RSI sensor.
I have to point out, your config is missing a very important part: the number of pulses that equals 1L. You can find this on the spec sheet of your sensor, but it is very unlikely to be 1. In my example, my sensor pulses 27 times for 1L of water (I am using a YF-DN40 water meter).
@phdelodder Hereās the problem. ESPHome does most of the heavy lifting, and already returns the flow rate in pulses per minute, without you having to use a formula at all. Your problem is that you are trying to apply the wrong formula to that output.
I mean, in fairness, itās the right formula, if you were coding this raw in Arduino IDE. But all you really need to know is how many pulses = 1L. For example, my lambda looks like this:
- lambda: return (x / 27.0) * 60.0;
It looks like that because the spec sheet for my sensor says that that itās 27 pulses per litre, and I then turn that into litres per hour by multiplying by 60.
You need to google what the pulse rate is for your sensor. And it will be a gross, frustrating google because I just tried it and I could only find the formula youāre using, not a practical number.
Otherwise, failing that, youāre going to need to write an arduino sketch to count pulses, and pour a litre jug through the sensor a few times, then average your result. Many people feel that this approach is best for accuracy, but I would still start by googling.
If you tell us more about your errors, or better yet, post the log output, weāll be better able to help. Bear in mind that when you use Utility Meter, the output will always be wrong until the second cycle. So if you configure it hourly, it will only be accurate from hour 2. If you configure daily, it will only be accurate from the second day.
Thanks for the explanation. I have done some digging and found that according to this thread on tasmota (https://github.com/arendst/Tasmota/issues/3390): it does 4500 pulses per 10L, so for 1 L it would be 450 pulses.
Iāll also do some test by tapping a 1L and see how many pulses I get. The meter is already installed.
I have tested it and it seems to correct/not correct it depends on the rate the water is flowing I have been spot on with 1L for 450 pulses. If I do other tests I also have 850 pulses for 0.5L.
That works. However, what Iām after is a totaliser over hour/day/week/month and HA utility_meter seems to be giving me flow rates over those periods.
Hi @ashscott, Utility Meter is a totaliser, thatās why it changes as new values come in.
I have them in the front end as an Entity card, next to each other: Hourly, Daily, Weekly, Monthly. If you click on one, it pops up the UM card, where you can see what the previous total was.
Ok, Sorry I havenāt been back in touch. So Thank you so much for your time on this. I have updated my Home Assistant and I believe it is set up correctly but will need to do some more testing.
Assuming that itās not faulty and you donāt have any cavitation, with it being a turbine meter, each rotation of the turbine will generate a pulse from the hall effect sensor which will equate to a set
displacement of fluid. It has to be constant, or more correctly, consistent.
ESPhome will allow you to count the pulses correctly over time for rate, or as a totaliser.
If youāre not getting the readings or accuracy you expect then Iād look at the possibility of cavitation or a faulty meter.
Another thought. Do you have it installed at the end of the line or mid line?
// per datasheet; pulse characteristic (6*Q-8) Q=L/MinĀ±5%
// aka pulses=6*L_per_min-8;
// solved for L_per_min = 1/6*pulses + 4/3
// except, if we didn't see any pulses, we don't add the constant factor
// because it's not plausible that we're actually consistently consuming
// 1.3L/min of water, which is what that would imply.
That data sheet spec (here) makes very little practical sense. The code youāre using does its best to produce an output aligned to it, but as the author points out, itās not possible to measure less than 1.3L/min according to the spec. Iād be inclined to take some empirical measurements at different flow rates and plug them into the polynomial filter I linked above.
To be fair, the sensor data also shows 1ā30L/min as its working range (and the label on the sensor says 2ā50L/min!)
However, if itās working accurately enough for you, great!