Skip to content

Commit

Permalink
Migrated to a nodemcuv2 and updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
golles committed Jul 19, 2024
1 parent 2245f0a commit 949268f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
26 changes: 13 additions & 13 deletions docs/WATERMETER.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# Watermeter

Device description.
This ESPHome integration utilizes a proximity sensor to monitor my water meter. The sensor detects the presence of metal, providing a pulse each time a full meter cycle is completed by recognizing the metal piece placed on the meter.

# Hardware

- Board: Wemos D1 mini
- NPN proximity sensor
- Board: ESP8266 NodeMCU V2
- NPN proximity sensor (LJ18A3-8-Z/BX-5V)

# Wiring

| Board | NPN sensor cable |
| ---------- | ---------------- |
| D2 / GPIO4 | Black |
| GND | Blue |
| 5V | Brown |

Add a 10K resistor between D2 and 5V.
| Board | NPN sensor cable |
| ----------- | ---------------- |
| D6 / GPIO12 | Black |
| GND | Blue |
| 5V | Brown |

# Configuration

Expand All @@ -37,14 +35,16 @@ watermeter_ota_password: ota_password
watermeter_encryption_key: abcdefghijklmnopqrstuvwxyz1234567890ABCDEFG=
```
# Other
# Proximity sensor
Choosing the right proximity sensor can be tricky; buying the LJ18A3 sensor eliminates the need for additional resistors. Ensure you select the LJ18A3-8-Z/BX-5V variant from AliExpress.com, as it comes with a built-in resistor and operates on 5V, allowing direct power from the ESP.
## Service
This device exposes a service to Home Assistant which let you set or update the meter value from within Home Assistant without recompiling this firmware. For example when the `totalWaterUsage` value is no longer in sync with the water meter.
This device offers a Home Assistant service for adjusting the meter value without firmware recompilation. For instance, if the `totalWaterUsage` deviates from the actual water meter reading, you can update it directly within Home Assistant.

```yaml
service: esphome.watermeter_set_water_usage
data:
meter_value: 123.456
meter_value: 123,456
```
35 changes: 18 additions & 17 deletions watermeter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ packages:

esphome:
platform: ESP8266
board: d1_mini
board: nodemcuv2
name: ${name}
friendly_name: ${friendly_name}

Expand All @@ -28,42 +28,43 @@ api:
globals:
- id: totalWaterUsage
type: float
restore_value: true # When updating below value, change this to false for 1 run.
initial_value: "264.904" # 23-1-2022 20:30
restore_value: true
initial_value: "367.853" # 08-02-2024 13:00

sensor:
- platform: pulse_counter
pin:
number: D2
mode:
input: true
pullup: true
id: watermeter_pulse
- platform: pulse_meter
pin: D6
# name: Verbruik
name: Pulse
update_interval: 1s
unit_of_measurement: L/min
state_class: measurement
icon: mdi:water-pump
internal_filter_mode: PULSE
internal_filter: 50ms
filters:
- lambda: |-
if (x > 0) {
id(totalWaterUsage) += 0.001;
}
return x * (60.0 / 1000.0);
total:
id: sensor_pulse_meter_total
name: Pulse totaal
name: Totaalverbruik
icon: mdi:cube-outline
device_class: water
state_class: total_increasing
unit_of_measurement:
accuracy_decimals: 3
disabled_by_default: true
filters:
- lambda: |-
if (x > 0) {
id(totalWaterUsage) += 0.001;
}
return x;
- multiply: 0.001

- platform: template
id: watermeter_total
name: Totaal
icon: mdi:water
update_interval: 1s
update_interval: 5s
unit_of_measurement:
device_class: water
state_class: total_increasing
Expand Down

0 comments on commit 949268f

Please sign in to comment.