In this forum you find many water meter setups, but they are all based on ESPHome/Wifi. I have a very poor wifi signal around the water meter and I simply love Zigbee. So based on the inductive sensor and the PTVO firmware I have build a zigbee meter with a CC2530 module.
Please note that I am using zigbee2mqtt.
Connect the sensor to the water meter
Convert sensor output
The inductive sensor needs at least 5V and the CC2530 module 3.3V, moreover the output signal from the sensor is >> 3.3V. This has elegantly been solved by ZTAZ via a 4N35 optocoupler.
Connect the wires
Power & Power down
A 5V DC can be obtained from Power supply and tuned to 3.3v by a buck converter.
Custom firmware CC2530
The CC2530 module is flashed with the great PTVO configurable firmware (Zigbee Configurable Firmware v2.5 – Zigbee Hobbyist. Rock Pi 4 SBC 1 136). Flashing is done with the CC debugger and the free software from TI (FLASH-PROGRAMMER Software programming tool | TI.com 26) not V2.
Flash the CC2530 with the following configuration:
HA configuration
The water meter sensor is in fact just a switch. After pairing the PTVO device the switch will appear as:
switch.0x00124b0009d47ac9_l1
Of course this 0x00124b0009d47ac9 will be different in your case
The creation of the actual water meter counter is dead simple, just add this to the configuration file:
counter:
water_meter:
name: Water meter
icon: mdi:water
initial: 560193
step: 1
Now we have to make the water meter count by this automation:
- id: 'watermetercounter'
alias: "Water meter"
trigger:
platform: state
entity_id: switch.0x00124b0009d47ac9_l1
to: 'on'
action:
service: counter.increment
target:
entity_id: counter.water_meter
It is also nice to follow the hourly, daily, weekly data. A piece of cake with the standard tools in HA. Add this to the configuration file:
utility_meter:
hourly_water:
source: counter.water_meter
cycle: hourly
daily_water:
source: counter.water_meter
cycle: daily
weekly_water:
source: counter.water_meter
cycle: weekly
monthly_water:
source: counter.water_meter
cycle: monthly
yearly_water:
source: counter.water_meter
cycle: yearly
The output looks like this:
That’s all
To get the data in the HA energy dashboard 2022.11 add this sensor:
template:
- sensor:
- name: "Water m3"
state: "{{ states('counter.water_meter')|float(0) / 1000.0 }}"
unit_of_measurement: mÂł
state_class: total_increasing
device_class: water