I want to implement an “energy flow meter” or “heat meter” in ESPHome, for which in its core we need to multiply the water volume going trough a cycle loop with the back-minus-forth temperature difference (the effective energy loss). The resulting sensors in ESPHome should be:
Water volume through the loop, total counter (Liter)
Current water flow rate (Liter per minute)
Current energy loss/investment rate (kW)
Energy counter, today or total counter (kWh)
I have sensors for water flow (1 impulse per liter) and temperature sensors on the forward position and the return position of the loop (a°C - b°C = c K).
Any ideas how I can implement this? The pulse_counter and pulse_meter components seem not suited, because the multiplication must happen per water flow impulse under the temperature difference at this point. Do I need to resort to handle flow sensor signal edges myself or is there any other ESPHome component suited to solve this? Thanks
I think the pulse_counter is still suited to get the total flow and flow rate. This sensor isn’t providing an instantaneous flow rate so it will need some finite update interval to provide the average rate. Performing the multiplication per pulse would require extra logic to track time between pulses and some assumptions about the temperature change between pulses.
A template sensor can be used for the energy. The lambda for the template sensor would perform the multiplication constant * flow_rate * delta_T It’s update would get triggered when the flow rate gets updated and use the current flow and temperature values. The integration sensor could then be used to get accumulated energy usage from the energy sensor.
Hey @mulcmu and thanks for your answer.
This is kind of where it becomes muddy. You suggest to use the pulse_counter component but agree that it provides an averaged rate rather than total flow volumes over an aggregation interval. One could probably make my use case work this way, however, as I want to (ideally) compute the differential product of flow volume and temperature difference, it just feels way more intuitive and more accurate to do calculations on a per-impulse basis.
I will play around with the idea.
Pulse meter provides the current frequency and converts it to pulses/min. You can set update period to say a second or you can request an instantaneous number as and when requested. In addition, you can set it to count pulses over a period of time and then reset when needed. I also use the raw data from the sensor in say a sensor template to calculate something else. So I have 4 different values from the pulse meter.
I am assuming if you set the update interval to say 1 second, this would be sufficiently accurate enough to do your calculations … I have not set to less to 1 second but worth a shot!
Then set up a template to calculate your next step off this number.
Hey @JulianDH please correct my if I missed something.
This sounds like a binary sensor with extra steps and a bit of obscured timing manipulation. I could just define a Binary Sensor Component — ESPHome and define its on_press automation. Correct? I will give it a try.
You are correct it is a binary count reader, but I think you underestimate what it is trying to do. It provides you with a very accurate frequency which you can read when you want to. It was written for a specific purpose. I would read it first and all the posts on how it is used
I might use binary gpio and either on_click to use a lambda to calculate or template which updates on a change of the gpio. Bit of fiddling and I suppose dependent on how many Brora toons you are getting per second
Thing is that it seems that I need to know the flow, and the manufacturers of the pumps aren’t that helpful, and the flow will ofc vary, depending on several factors.
So I figured I would like to install flow meters and get their data, then I found your brilliant project here.
What kind of hardware do you have? The thing I struggle with is to find flow meters that will fit my existing pipes (pipes will have to be cut ofc), withstand heat up to ~90°C AND be able to solder to some kind of ESPHome micro controller.
I am using this device, there are versions in all sizes and conventions, for cold and hot water, etc. Hope you can buy something similar where you live.
Which detail are you interested in?
The solution works perfectly, as good as it possibly can. I’m getting the total amount of water in 0.25 liter steps. The energy calculation is as good as the formula physically can be, and the deravative sensors generated in Home Assistant are quite useful in UI and automations…
Hi @ThomDietrich,
thanks for this awesome Project.
I already have the Zenner Watercounter with 1L Impulse.
I’m able to dectect the consuming water, but i want to create a sensor was tell me the water ist flowing or not. I want to detect if a water tap is forget to close or a hose is come off.
Your Solution works but only show me the last rate in l/min it freeze in last value and not going down to zero.
Thanks