hi all im triying to create a water flow sensor
Just to be sure… if the manual says 595 pulse x min
the flow meter works and send signals … but not accurated
If im not wrong.
595 pulses per liter of water from the manual
platform: pulse_counter
pin: x
unit_of_measurement: “l/min”
name: “Liter per minute”
filters:
multiply: 0.001680672269
total:
unit_of_measurement: “l”
name: “Total no of Liter”
filters:
multiply: 0.001680672269
option with Lambda
sensor:
platform: pulse_counter
state_class: measurement
name: “Sensor agua”
id: flujo_agua_test
pin:
number: GPIO15
mode: INPUT_PULLUP
update_interval: 1s
unit_of_measurement: “L/min”
icon: “mdi:water”
filters:
lambda: return (x+4)/10/60;
Its not very accurate in my case:(
Stream range: 2~50L|MIN$5%
Specification
Model: YF-B10
Interface size: G1
Rated voltage: DC3.5~24V
Inner/Outer Diameter: 24.38mm/32.9mm
Thread length: 13mm
Material: Stainless steel
Water pressure resistance: >1.75MPa
Output pulse high level: >DC4.7V (input voltage DC5V)
Output pulse duty cycle: 50%10%
Insulation resistance: >100M2
Stream range: 2~50L|MIN$5%
Airtightness: close each hole, add 1.7Mpa water pressure test for 1 minute without leakage and deformation Stream pulse characteristics: F=(10*Q-4)÷5%, F is the frequency Q is L/Min, that is, 595 pulses per liter of water
Helllo @parautenbach, partly ChatGPT, but I really took time to read and answer Kiloptero’s question. I have a long active thread on this topic with ChatGPT 4 Plus. I’m not just pasting what it spits out, I take time to read and challenge every output and review it to make sure it might help. English is not my first language, so it helps to double check my answers are written with a good English syntax. And not everyone have a paid subscription to ChatGPT.
Which doesn’t contain the information about 5V tolerant GPIOs anymore in more recent revisions according to the CEO of Espressif
When asked why this information is not in the datasheet, he responded
“the reason is too many users took it to mean that the chip is 5 V tolerant. When we say 5 V tolerant, we are only referring to the IOs. So some users mistook this to make that they can power the chip entirely off the 5 V supply. The correct usage is to use 5 V open for these 5 V tolerant pins, and only via only drain configuration.”
I have setup as per your instructions, however the above sensor (binary_sensor.water_flow_on_off - as I have named it) is always off.
I think is to do with point 5 above.
@donparlor - How do you ensure that binary_sensor.water_flow_on_off is set up to detect water flow?
Many thanks.
Just a follow up on my original question - @donparlor will really appreciate your help.
As soon as your flow sensor is above 0 (this sensor is inside your ESPHome configuration and mine is named sensor.debit_d_eau_instantane), it will trigger the binary sensor as being ON.
- platform: template
sensors:
cost_of_the_last_shower:
friendly_name: "Cost of the Last Shower"
unit_of_measurement: '$'
value_template: >
{{ (states('sensor.volume_last_water_utilization') | float * 0.90) | round(2) }} #change the multiplier (0.01) by your local cost of energy to heat up 1 litre of water to you tank set temperature
I have tried and checked and double check all but I cant get it to display any values at all.
Your cost_of_the_last_shower sensor seems well structured, my only concern is where you put it inside your configuration.yaml file. This should be below your sensor: section.
sensor:
- platform: template
sensors:
cost_of_the_last_shower:
friendly_name: "Cost of the Last Shower"
unit_of_measurement: '$'
value_template: >
{{ (states('sensor.volume_last_water_utilization') | float * 0.90) | round(2) }}
Beside that, the only difference would be the format display of your Last Water Usage Volume, number is displayed with a dot (.) while mine is with a coma (,), but I guess it’s just a regional setting and won’t affect the output of the value_template calculation.
Check at the location of your cost_of_the_last_shower sensor sensor and let me know if you respect the position below your sensor section.
I have all 3 sensors defined in a sensors.yaml file using sensor: !include sensors.yaml statement in configuration.yaml file
- platform: template
sensors:
duration_of_last_water_usage:
friendly_name: "Duration of Last Water Usage"
unit_of_measurement: "sec"
value_template: >
{% set t = states('sensor.duration_of_last_water_usage') | float if states('binary_sensor.water_flow_on_off') == 'off' else now().timestamp() - states.binary_sensor.water_flow_on_off.last_changed.timestamp() %}
{{ t | round(2) }}
- platform: template
sensors:
volume_last_water_utilization:
friendly_name: "Last Water Usage Volume"
unit_of_measurement: 'L'
value_template: >
{{ (states('sensor.total_water_use_in_l') | float - states('input_number.starting_water_volume') | float) | round(2) }}
- platform: template
sensors:
cost_of_the_last_shower:
friendly_name: "Cost of the Last Shower"
unit_of_measurement: '$'
value_template: >
{{ (states('sensor.volume_last_water_utilization') | float * 0.90) | round(2) }} #change the multiplier (0.01) by your local cost of energy to heat up 1 litre of water to you tank set temperature
I am not using this approach with sensors.yaml, I guess you did it correctly but I can’t confirm. My best guess is that it’s a syntax issue… It’s working in my system.
Hi,
I’m also using the YF-DN50 to measure the water flow in my pool filtration system.
In “your” data sheet, you read that Frequency (Hz) = 0.2 * Flow (l/min)
In other data sheets, you can find that 12 pulses = 1 liter. Those 2 formulas are contradictory.
Indeed:
12 pulses = 1 liter
12 pulses / second = 1 liter / second = 60 liter / minute
1 pulse / second = 5 liters / minutes
Frequency (Hz) = 5 * Flow (l/mn)
So, I disregarded the first formula and assumed the second is correct.
hi i have the same flowmeter as you are using but I don’t get it to show correct value in one minute I manage to fill 8L white the below flow
ccuracy
[18:57:14][D][pulse_counter:174]: ‘Vannforbruk’: Retrieved counter: 5113.02 pulses/min
[18:57:14][D][sensor:094]: ‘Vannforbruk’: Sending state 12.91167 L/min with 2 decimals of accuracy
i will be grateful if you can point me in the correct direction