I try to build a battery driven Water Meter. For it a have ordered me some ESP32_Bat_Pro devices from EzSBC. I want to track my water usage on the ZENNER ETKDI-N with preinstalled reed contact which counts ≥1L/Impuls. I connected it to the ESP between IO14 and GND.
The reed closes, when a Liter water passed the counter and opens again, when a new liter starts to pass the counter.
My first problem is, that the counting works not like I expect it. I had it already counting something, but it got not saved. I seams that ESPHome does not save the values from pulse_meter / pulse_counter (I tested both, but only got pulse_meter working) when deep_sleep is used.
WakeUp is working, when GPIO14 get connected to GND, but it seams to me, that there are also two other problems/questions:
is a pulse also counted, when he wakes up, or get those pulses dropped?
the ESP goes to sleep also when water flows
Save the state of pulse_meter before deep_sleep - maybe its not available in ESPHome right now - like it was on ESPEasy
The idea was to always count the pulses. Best will be that it counts in the ULP. At every X minutes it will wake up report battery and pulse count over wifi.
EDIT: the ZENNER LoRa/M-Bus devices and others do for sure the same. They are also attached with a battery with a lifetime from 10 years (like this module does) - I don’t know what type of processor they use, but they must be also really ultra low power capable.
I will report the logfiles later when the ESP wake up again…
INFO Trying to connect to gwz-vorne.local in the background
INFO Successfully connected to gwz-vorne.local
[10:01:55][I][app:102]: ESPHome version 2023.5.1 compiled on May 23 2023, 21:54:54
[10:01:55][C][wifi:505]: WiFi:
[10:01:55][C][wifi:363]: Local MAC: 94:3C:C6:C2:73:1C
[10:01:55][C][wifi:364]: SSID: [redacted]
[10:01:55][C][wifi:365]: IP Address: 192.168.99.46
[10:01:55][C][wifi:367]: BSSID: [redacted]
[10:01:55][C][wifi:368]: Hostname: 'gwz-vorne'
[10:01:55][C][wifi:370]: Signal strength: -86 dB ▂▄▆█
[10:01:55][C][wifi:374]: Channel: 1
[10:01:55][C][wifi:375]: Subnet: 255.255.255.0
[10:01:55][C][wifi:376]: Gateway: 192.168.99.1
[10:01:55][C][wifi:377]: DNS1: 192.168.99.1
[10:01:55][C][wifi:378]: DNS2: 0.0.0.0
[10:01:55][C][logger:301]: Logger:
[10:01:55][C][logger:302]: Level: DEBUG
[10:01:55][C][logger:303]: Log Baud Rate: 115200
[10:01:55][C][logger:305]: Hardware UART: UART0
[10:01:55][C][i2c.arduino:054]: SDA Pin: GPIO21
[10:01:55][C][i2c.arduino:059]: Recovery: bus successfully recovered
[10:01:56][C][uptime.sensor:031]: State Class: 'total_increasing'
[10:01:56][C][template.sensor:022]: Template Sensor 'Wasser Verbrauch'
[10:01:56][C][template.sensor:023]: Update Interval: 10.0s
[10:01:56][D][sensor:094]: 'Uptime': Sending state 21.69300 s with 0 decimals of accuracy
[10:01:56][C][switch.gpio:031]: Pin: GPIO16
[10:01:56][C][switch.gpio:068]: GPIO Switch 'LED Green'
[10:01:56][C][version.text_sensor:021]: Version Text Sensor 'ESPHome Version'
[10:01:56][C][version.text_sensor:021]: Icon: 'mdi:new-box'
[10:01:56][C][internal_temperature:055]: Internal Temperature Sensor 'Internal Temperature'
[10:01:56][C][internal_temperature:055]: Unit of Measurement: '°C'
[10:01:56][C][lc709203f.sensor:123]: LC709203F:
[10:01:56][C][lc709203f.sensor:132]: Device Class: 'voltage'
[10:01:56][C][lc709203f.sensor:132]: State Class: ''
[10:01:56][C][lc709203f.sensor:134]: Device Class: 'battery'
[10:01:56][C][pulse_meter:074]: Pulse Meter 'Wasser Durchflussmenge'
[10:01:56][C][pulse_meter:074]: State Class: 'measurement'
[10:01:56][C][pulse_meter:074]: Unit of Measurement: 'liter/min'
[10:01:56][C][restart:068]: Restart Switch 'Restart'
[10:01:56][C][web_server:152]: Address: gwz-vorne.local:80
[10:01:56][C][ota:097]: Using Password.
[10:01:56][C][wifi_signal.sensor:009]: WiFi Signal 'WiFi Signal'
[10:01:56][C][wifi_signal.sensor:009]: State Class: 'measurement'
[10:01:57][D][sensor:094]: 'Uptime': Sending state 23.64800 s with 0 decimals of accuracy
[10:01:59][D][sensor:094]: 'Uptime': Sending state 25.65100 s with 0 decimals of accuracy
[10:01:59][D][sensor:094]: 'Wasser Verbrauch': Sending state 0.00000 liter with 0 decimals of accuracy
[10:02:01][D][sensor:094]: 'Uptime': Sending state 27.64800 s with 0 decimals of accuracy
[10:02:03][D][sensor:094]: 'Uptime': Sending state 29.65400 s with 0 decimals of accuracy
[10:02:05][D][sensor:094]: 'Uptime': Sending state 31.64800 s with 0 decimals of accuracy
[10:02:07][D][sensor:094]: 'Uptime': Sending state 33.65400 s with 0 decimals of accuracy
[10:02:10][D][sensor:094]: 'Uptime': Sending state 35.64900 s with 0 decimals of accuracy
[10:02:10][D][sensor:094]: 'Wasser Verbrauch': Sending state 0.00000 liter with 0 decimals of accuracy
[10:02:11][D][sensor:094]: 'Uptime': Sending state 37.65100 s with 0 decimals of accuracy
[10:02:12][I][deep_sleep:116]: Beginning Deep Sleep
[10:02:12][I][deep_sleep:118]: Sleeping for 3600000000us
WARNING gwz-vorne.local: Connection error occurred: Ping response not received after 90.0 seconds
INFO Processing unexpected disconnect from ESPHome API for gwz-vorne.local
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for gwz-vorne.local: Error resolving IP address: [Errno -3] Temporary failure in name resolution
INFO Trying to connect to gwz-vorne.local in the background
INFO Successfully connected to gwz-vorne.local
[11:02:18][D][sensor:094]: 'Wasser Verbrauch': Sending state 0.00000 liter with 0 decimals of accuracy
[11:02:18][D][sensor:094]: 'Uptime': Sending state 25.56300 s with 0 decimals of accuracy
[11:02:20][D][sensor:094]: 'Uptime': Sending state 27.57000 s with 0 decimals of accuracy
[11:02:22][D][sensor:094]: 'Uptime': Sending state 29.56300 s with 0 decimals of accuracy
[11:02:24][D][sensor:094]: 'Uptime': Sending state 31.56700 s with 0 decimals of accuracy
[11:02:26][D][sensor:094]: 'Uptime': Sending state 33.56300 s with 0 decimals of accuracy
[11:02:28][D][sensor:094]: 'Wasser Verbrauch': Sending state 0.00000 liter with 0 decimals of accuracy
[11:02:28][D][sensor:094]: 'Uptime': Sending state 35.56300 s with 0 decimals of accuracy
[11:02:30][D][sensor:094]: 'Uptime': Sending state 37.56700 s with 0 decimals of accuracy
[11:02:32][D][sensor:094]: 'Uptime': Sending state 39.56300 s with 0 decimals of accuracy
[11:02:34][I][deep_sleep:116]: Beginning Deep Sleep
WARNING gwz-vorne.local: Connection error occurred: Ping response not received after 90.0 seconds
I personally have no experience at all with deep sleep, but I do have a watermeter setup with an ESP32, using a LJ18A3-8-Z-BX 5V proximity sensor and the ESPHome pulse counter.
And to be able to handle sudden power outages I added some code to store the pulse counter value locally to flash at shutdown and every 30 seconds, and to reload the value at boot.
This is some example code:
My situation is that I cannot setup electricity next to the watermeter so am targeting a non-esp, zigbee solution. The sensors however are consuming anyhow, did anyone of you look at low-power sensors?
Thx
i had currently no time do look into it.
but without wifi is seems that you need to store data on a sd card. Or better get wifi there with a repeater or mesh ap