I recently implemented a NodeMCU running ESPHome into my HASS to monitor mains electricity usage. It uses a TSL257 in a 3D printed housing to capture the light pulses from my utility company power meter.
It works well for almost all the time - but every now and again (about once a day) it does something completely weird as shown below:
My mains trip is 80A so there is no way it could have had that much power in that space of time (I’m joking, it is clearly not legitimate!)
I also have a clamp-on inductive sensor measuring current - it did not show this peak so it is either a spurious burst of flashes from the meter or some kind of electrical interference.
The meter seems to be reading about right - it is not registering any unusual peaks - so what on earth could be causing this?
The drop at 00h00 reflects the daily reset on the counter so is not an error.
I made something similar with a optical pulse counter for my power meter. I used a optical resistor and a small analog to digital signal amplifier/converter.
I had similar problems as you have. Now and then I got these high spikes.
First my sensor case was not dark enough. Take a flashlight and shine on it and see what happens. The second thing I hade to change was that pulse counter filter to millisecond level. My optical resistor was is very noisy.
Last I had to trim my amplifier that converted my optical a signal digital.
Made it much more insensitive.
I don’t know if you have same problems. But I hope you find what is the cause.
I use an inductive 4mm sensor with a ESP32 running esphome.
It works, but gives problems, i think especially when the coil stops right under the sensor.
how can i debounce this?
I suppose this is done with the “internal_filter” within ESPhome?
See: https://esphome.io/components/sensor/pulse_counter.html
Though that page says: *“Defaults to 13us. On the ESP32, this value can not be higher than 13us”
Is this because of ESPhome or because of the hardware (ESP32)