Good Evening all,
I am creating a water meter as per this link:
https://www.pieterbrinkman.com/2022/02/02/build-a-cheap-water-usage-sensor-using-esphome-home-assistant-and-a-proximity-sensor
I have copied the code and
sensor:
- platform: pulse_counter
pin: GPIO12
update_interval : 6s
name: "water pulse"
id: water_pulse
- platform: pulse_meter
pin: GPIO12
name: "Water Pulse Meter"
unit_of_measurement: "liter/min"
icon: "mdi:water"
total:
name: "Water Total"
unit_of_measurement: "liter"
- platform: template
name: "Water Usage Liter"
id: water_flow_rate
accuracy_decimals: 1
unit_of_measurement: "l/min"
icon: "mdi:water"
lambda: return (id(water_pulse).state * 10);
update_interval: 6s
ESP doesn’t seem to like the code and giving me the following error:
ERROR Error while reading config: Invalid YAML syntax:
mapping values are not allowed here
in "/config/esphome/water-meter.yaml", line 27, column 8:
pin: GPIO12
^
Does anyone have any ideas where I am going wrong?
Kindly appreciated
blissarts
(Blissart)
November 7, 2022, 6:46pm
2
I think your indentation is wrong
whats that? / What do you mean?
blissarts
(Blissart)
November 7, 2022, 6:56pm
4
It should be like this
sensor:
- platform: pulse_counter
pin: GPIO12
update_interval : 6s
name: "water pulse"
id: water_pulse
1 Like
thermiek
(thermiek)
June 18, 2023, 11:28am
6
i’m have the same problem , and the solution supposed here , creates new errors
what is the solution of this cascade of errors?
SEE image with my error below
image
#https://www.pieterbrinkman.com/2022/02/02/build-a-cheap-water-usage-sensor-using-esphome-home-assistant-and-a-proximity-sensor/
sensor:
- platform: pulse_counter
pin: GPIO12
update_interval : 6s
name: "water pulse"
id: water_pulse
- platform: pulse_meter
pin: 6
name: "Water Pulse Meter"
unit_of_measurement: "liter/min"
icon: "mdi:water"
total:
name: "Water Total"
unit_of_measurement: "liter"
- platform: template
name: "Water Usage Liter"
id: water_flow_rate
accuracy_decimals: 1
unit_of_measurement: "l/min"
icon: "mdi:water"
lambda: return (id(water_pulse).state * 10);
update_interval: 6s
thermiek
(thermiek)
June 19, 2023, 6:28pm
7
found a working solution in this topic
My code is working properly but I have 2 issues.
I’m working with a wemos D1 mini, and this is my sensor :
[image]
It has no LED to show when it’s detecting a pulse. Is it possible to blink the blue onboard LED every time a pulse is detected? How do I do that?
Is there a way to hold the values when rebooting/ reflashing? now it always starts from zero. For the energy dashboard that’s no problem, but i’d like to use those values for calculations.
This is my code :
sensor:
- platform: pulse_…
and i used this code a user replied
sensor:
- platform: pulse_counter
pin:
number: GPIO4
mode:
input: true
pullup: true
update_interval : 5s
name: "water pulse"
id: water_pulse
- platform: pulse_meter
pin:
number: GPIO4
mode:
input: true
pullup: true
name: "Water Pulse Meter"
unit_of_measurement: "liter/min"
icon: "mdi:water"
- platform: pulse_meter
pin:
number: GPIO4
mode:
input: true
pullup: true
name: "Water Liter Meter"
unit_of_measurement: "liter/min"
icon: "mdi:water"
total:
name: "Water Meter Total"
unit_of_measurement: "m³"
id: water_meter_total_esp
accuracy_decimals: 3
device_class: water
state_class: total_increasing
filters:
- multiply: 0.001
- platform: template
name: "Water Usage Total"
id: water_usage_total_esp
accuracy_decimals: 0
unit_of_measurement: "liter"
icon: "mdi:water"
device_class: water
state_class: total_increasing
lambda: return (id(water_meter_total_esp).state * 1000);
update_interval: 10s
Wilko
February 14, 2024, 12:40pm
8
There are several issues with the instruction provided by Pieter. At least in my case. The indentation is incorrect. ESPhome does not allow to use Pins several times, anymore. On my NodeMCUv3 there is 3V on VIN but I could get 5V from VU. Anyhow, the sensor requires 6V minimum and does not work on 5V. I am now waiting for some step-up modules
Below the code I could at least flash:
sensor:
- platform: pulse_counter
pin:
number: GPIO12
allow_other_uses: true
mode:
input: true
pullup: true
update_interval : 6s
name: "water pulse"
id: water_pulse
- platform: pulse_meter
pin:
number: GPIO12
allow_other_uses: true
mode:
input: true
pullup: true
name: "Water Pulse Meter"
unit_of_measurement: "liter/min"
icon: "mdi:water"
total:
name: "Water Total"
unit_of_measurement: "liter"
- platform: pulse_meter
pin:
number: GPIO12
allow_other_uses: true
mode:
input: true
pullup: true
name: "Water Pulse Meter"
unit_of_measurement: "liter/min"
icon: "mdi:water"
total:
name: "Water Meter Total"
unit_of_measurement: "m³"
id: water_meter_total
accuracy_decimals: 3
device_class: water
state_class: total_increasing
filters:
- multiply: 0.001
- platform: template
name: "Water Usage Liter"
id: water_flow_rate
accuracy_decimals: 1
unit_of_measurement: "l/min"
icon: "mdi:water"
lambda: return (id(water_pulse).state * 10);
update_interval: 6s
Wilko
February 17, 2024, 3:25pm
9
It works.
This is what I get in Home assistant:
The folowing sensors are not working:
-water pulse
-Water Total
-Water Usage Liter