Hi there,
I’m trying to integrate my home water and gas usage into HA. I bought a cheap water flow meter with built in hall sensor from ali, but it wasn’t accurate at low flow rates. The home’s water utility meter is very accurate. For $10 an easp32 and a QMC5883L Magnetometer can sufficiently read magnetic changes inside the meters!
I’m just struggling to convert the sine wave reported over i2c into pulse count data. I have tried using lambda as a trigger when sensor value reaches a high point in the curve, but i’m lost in then feeding that to a pulse counter.
sensor:
- platform: qmc5883l
address: 0x0D
field_strength_y:
name: "QMC5883L Field Strength Y"
id: "field_strength_y"
range: 200uT
oversampling: 64x
update_interval: 1s
binary_sensor:
- platform: template
id: "ytrigger"
lambda: |-
if (id(field_strength_y).state > 70) {
return true;
} else {
return false;
}
I thought about trying to output the signal, using a GPIO to another pin on the board setup as a pulse counter, but it seems like there must be an easier way i’m missing.
Any help or direction is appreciated.