ESPHome “pulse_meter” counting less?

Hello!

I have a electricity measuring device that outputs 1000pulses per kWh. I have set up a esp8266 that would count pulses. It is connected to D12. I have it running for a few months but the manual measurement is different from pulse count.

Month: ESPcounter measurement / Data from electricity meter diplay
July: 140.93 kWh / 173.44 kWh
August: 125.69 kWh / 157.94kWh
September: 127.27 kWh / 153.28 kWh

So it seems the ESP somehow counts less pulses but why? How could I correct it?

esphome:
  name: pulsemeter

esp8266:
  board: nodemcu

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "XXXX"

ota:
  password: "YYYY"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ZZZZ"
    password: "UUUU"

sensor:
  - platform: pulse_meter
    pin: 12
    unit_of_measurement: 'kW'
    name: 'Electricity Usage'
#    internal_filter: 100ms
    accuracy_decimals: 3
    filters:
      - multiply: 0.06
    total:
      name: "Electricity Total"
      unit_of_measurement: "kWh"
      accuracy_decimals: 3
      filters:
        - multiply: 0.001

Assuming that your measuring device outputs 1000 pulses per kWh your code should be correct.
However, looking at your results it looks like there is a reduction of approx. 20 %, and this difference is reasonable constant over these three months:

afbeelding

So how sure are you about the 1000 pulses / kWh?
What kind of power sensor is this? Is it a S0 pulse meter?
One solution could be to modify your filters such that the measured value comes closer to the real value, by multiplying the filter values by 1.23 like this:

sensor:
  - platform: pulse_meter
    pin: 12
    unit_of_measurement: 'kW'
    name: 'Electricity Usage'
#    internal_filter: 100ms
    accuracy_decimals: 3
    filters:
      - multiply: 0.0738
    total:
      name: "Electricity Total"
      unit_of_measurement: "kWh"
      accuracy_decimals: 3
      filters:
        - multiply: 0.00123

Another option to try is enabling the internal_filter setting and set it to 50 or 100 ms, which is recommended for S0 pulse meters.

A third option could be to change the Pulse Meter Sensor into a Pulse Counter Sensor, but I don’t expect this will make a difference in this case. The difference between these two sensors is nicely explained here: ESPHome_Pulse_counter vs pulse_meter.

1 Like

It is Alpha count A3b device.

The image you posted clearly shows this meter to be a S0 meter, indeed giving 1000 pulses/kWh:

afbeelding

So next step could be to test one of the suggestions I gave, and personally I would start with setting the internal_filter to 50ms as this is recommended for S0 meters (the default value is 13 us which are microseconds).

1 Like

Thanks!
I added 50ms to internal filter.

But I did notice that my nodemcu was acting weird. I couldn’t install new fw with wifi. Using USB worked.
Then I let it run and it died again after about 10 minutes. So I think that nodemcu is near death.

I then used a wemos d1 mini and soldered it to the place. Used pin4 and other schematic stayed the same.
I’ll test it for few days and see how is the result.

Update.
Alpha count device after about 13 hours: 2,69kWh
Home assistant count after 13 hours: 2,72kWh
1% difference, pretty good.

I also had problems with wifi coverage in the room. I have fireproof door between the counter and access point. I closed the door and tried to update wemos mini through wifi. It failed. I tried couple times more and it failed. Then I opened the door and it updated successfully. With closed door the wifi was about 86dbm. With the door open was 66dbm.

I also had a access point in the same room as the counter so I enabled wifi on that access point.

Update.
After about 2 days.
Calculated from device: 12,13kWh
From Home assisatant: 12,16kWh.
So that seems it is fixed. Thank you thusassistint

1 Like