Calculate flow/rate from meter reading


I have a water meter connected to Homey. Now I would like to calculate the water rate, like litre/min or m^3/h. Is there any example flow for this, please?

Regards, Metatron

Pls provide the data it sends now, longpress the watermeter tile and share the screenshot.

Example of my power/gasmeter:

Maybe you can use;

1 Like


thank you for your answers!
First of all, I have only “analogue” water and gas meters, which I have “digitalized” myself with AI-on-the-edge-device. This means, I get meter readings about every 3-4 minutes. This solution works pretty good. In Homey, I created MQTT devices respectively.
I am also using “Power by the hour”.
But if I calculated the flow by (last_meter_reading-current_reading)/(last_time-this_time), then I could use this information to start other flows, right? Like someone is taking a shower in the morning, I lift the shutters and start heating the living room or the kitchen?
This would me more reliable then simply using a meter change? Bear in mind, that time stepping could change with my AI reader.
Regards, Metatron

This is very hard to do. Every time you get a pulse, the amount of water used changes. But you’ll never know if you’ll get another pulse quickly or not for hours.

There’s an app [APP] Insight Trends that might help you to do what you need. It uses the insights to detect for instance rapid changes. I think it will allow you to trigger on the things you wish, even though it may not give you the actual flow rate per se.

Hi Edwin,

thank you for your reply. Why should I not get a measure for hours? I configure the interval for the AI Raeder, like very 3 minutes, and it is taking pictures within this interval and recognizing the reading. Only if it missreads, then it might skip the results?

It may get new values, but usually Homey does not trigger when a value remains unchanged. It will probably be the same for you. You also mention 3 min per reading. That could be a really short, really big waterflow, or a long and low one. But the more polling you need, the more load on Homey. But I think the application I mentioned will do about what it can with the data you got.

Your solution sounds very sophisticated, but a Youless combined with a water meter reader (usually pulse based, what I’ve got) seems to give more detail than what you’ve got. It also does flow calculations, so that may also be an option, albeit with less AI.

I use this: Water- of gasverbruik Monitoren? - Cedel webshop
With YouLess LS120 energiemeter - for both energy and water. The [APP] YouLess, Enelogic, PVOutput - Belgian and Dutch P1 Smart Meter Reader does the water flow calculations.

1 Like

I try to calculate the difference of water, but it is not working. I triggers fine, but does not caculate a difference?
Here is the flow:

there is no “and”,

And here the output

The equation is a bit odd, because I wanted to make sure, that the difference is not too small and rounded off. I tried other equations, but it does not work either. What do I do wrong?

One thing to check if there are no spaces in the equation. Homey seems to have problems with that. Maybe It will mean the equation ends up being a string or something like that. (I didn’t look into what you’re calculating per se, I assume the fact it isn’t a number that is your biggest problem). Did you build it using the web editor, IOS or Andriod? they seem to behave differently in adding unwanted spaces, so another platform might help as well.

An other thing I warned about earlier: the flow triggers a few times per hour. How do you intend to calculate waterflow without taking the time passed since the previous value into account, and isn’t it so that a long time nothing means no flow?

It is also not per se the case that the difference you see is the flow for the last three minutes, because it is depending on the moment the snaphot is taken after the water started flowing. So you might see a high value on a 2,5 min low flow, or a low value on a 1 sec high flow. You need more data points to calculate accurate flow.

Hello Edwin,
I generated the equation on IOS and indeed, I found spaces, thanks! Let’s see how it works now.
I see you points, but don’t think they are too severe. My meter send data in a fixed interval, let’s say 3min.
So whenever I encounter a change, it must have happened within the last 3min. So calculating the difference by *1000/3 should give me l/min, with, that is true, a lot of “smoothing”.
Now what do I try to detect? Not every second of an open tab, but somebody taking a shower of something like this.
I will test it. Let’s see what I get, as soon as the calculation is working. BTW, it is not unlikely, that the developer is implementing my feature request of a flow calculation - with the same interval issues, als the ESP32 need some minutes for the AI recognition.

Anyway, I will have a look, thanks again, Metatron

1 Like

For showering, I and many others use a humidity sensor (Aqara or similar) to see a steep humidity rise in order to turn op ventilation and such. Advantage is you can separate it from e.g. the washing machine taking in a lot of water. It is also more to the point in case of ventilation, as it is the humid air you want to get rid of.

1 Like


yes, you were right, there were spaces in there. I removed them, but still, sometimes I get NaN, sometimes Zero. I rearranged the equation several times. Frustration is growing. I did a lot of programming in my past and got a MSc in maths, and still … No matter, it this makes sense, it should calculate something, shouldn’t it?

All “Dann” cards will start concurrently, not sequentially, so when Simple LOG is logging something the calculation may not yet have completed. Try adding delays in between cards.


Hell! Really? :blush:
Thank you!!

Yes, that is true, but still something puzzles me. I can imagine logging a stale value, but NaN suggests something not initialized or division by 0 or something. From the screenshots that is not immediately evident.

Hi Edwin,

I totally agree. I introduced delays, but the problem remains. I have to admit, that I am pretty new to Homey, and, btw, the problem is being solved, as the programmer of the AI interface is now evaluating the flow, but I still would like to understand, what is happening. But how?

One way to get around this parallelism trouble is to split the flows and trigger on variable changes. So one flow with the calculation, one flow that triggers when the variable holding the result changes. But also a delay should be sufficient to avoid the race condition.

If you have a division in there I would also make flows to try to catch 0 values for that variable with a similar approach. If variable or tag changes, log the new value. Maybe the app has moments when key values are undefined?

BTW: when sharing flows, it is better to use the share button and paste the link, when pasting schreenshots you often miss part of the flow.

And then one other advice: also try to replace simple log with a normal timeline log from Athom. I had some other thread where Simple Log seemed to be misbehaving. It would be infuriating to find out the variable is fine but the logging is broken.