ESPHome pulse meter false pulses: the filter setting, the light leaks, and a 3D printed case that keeps an electricity meter LED reader dark
Filter advice for ESPHome’s pulse_meter rarely asks how long your meter’s LED flashes, and printable reader cases rarely mention the filter. Here are the pulse gaps by meter constant and load, the filter window for each mode, and a sensor case checked in the Loftsmith engine but not yet printed.
Short answer
False pulses come from light reaching the photodiode (room light, or the LM393 module’s own D0 and power LEDs), comparator chatter and a wrong filter. In EDGE mode keep internal_filter under the shortest gap between pulses, 3,600,000 ÷ (imp/kWh × max kW) ms: 360 ms at 1,000 imp/kWh and 10 kW, so about 180 ms. In PULSE mode it must also be shorter than the meter’s LED flash: 20 ms on a Landis+Gyr E470, 35 ms by default on CLOU meters. Multiplier: 60,000 ÷ imp/kWh.
Rather have the part than the arithmetic? Describe it in a sentence. Loftsmith designs it with these numbers built in, checks it fits your printer, and gives you the STL or 3MF.
An LED pulse reader is about the cheapest way to get your electricity use into Home Assistant: an LM393 light sensor module taped over the meter’s flashing LED, an ESP32 running ESPHome, and the pulse_meter sensor turning the time between flashes into watts. Then the graph shows a spike of hundreds of kilowatts, or the daily total runs ahead of the meter, and the forum threads begin.
The software pages say “shield it from light” and stop there. The printable cases each fit one meter and never mention the filter. This guide covers both halves: where false pulses come from, the shortest gap between pulses for your meter and load, how to set internal_filter in each mode, and a case designed and checked in the Loftsmith engine on 3 December 2026 to keep the sensor dark. The case has not been printed or fitted to a meter yet, and the guide says so wherever it matters.
Where false pulses come from: light, chatter and the filter
The LM393 module is a photodiode and a comparator. A trimpot sets the light level at which the comparator switches its D0 output, and ESPHome times the gap between one switch and the next. A false pulse is any switch the meter didn’t cause. Because power is worked out from that gap, one extra edge shortly after a real one reads as an enormous load: at 1000 imp/kWh, a pulse 20 ms after the last one means 180,000 W (our arithmetic). One user in a Home Assistant thread on LM393 power spikes reported spikes of up to 180,000 W.
Light the sensor shouldn’t see
- Room light getting round the sensor, or through thin or pale walls.
- The module’s own LEDs. LM393 boards like this carry a power LED and a D0 LED that lights when the output switches. Loftsmith’s Workshop reviewer pointed out that the D0 LED blinks with every pulse and can trigger the photodiode from inside a closed case. Others have seen the same thing: in Home Assistant Glow discussion #70 a user taped over the ESP board’s LED and the module’s other LED “to prevent feedback light”.
- The ESP board’s LEDs. The mwestermann/esphome-pulse-meter build dropped its pulse LED because the sensor saw it blink, and says to shield the sensor from room light and from the ESP32’s power LED.
- The meter’s other LED. Some meters have more than one. Read the label beside each and put the sensor over the one marked with the imp/kWh constant you use.
Comparator chatter
The mwestermann README says the LM393 module has no hysteresis, so with the trimpot set near its switching point it oscillated at about 200 pulses per second. Its fix: with the meter LED dark, turn the trimpot until the D0 LED is off and blinks once per meter flash, then turn it a little further away from the switching point. Do this before you cover the module’s LEDs (see the housing section), because the D0 LED is how you see it switch.
The input pin
In the LM393 thread above, enabling the ESP32’s internal pull-up on the input stopped the spikes. The mwestermann build uses a pull-down instead, so the module’s D0 wiring varies; test yours. In another thread, a 0.1 µF capacitor from the GPIO to GND cured erratic pulses for one user.
ESPHome itself
ESPHome has fixed real pulse_meter bugs. PR #12360, “Fix early edge detection” shipped in ESPHome 2026.2.0 and closed #10605, wrong detection in PULSE mode. An older regression was fixed in 2023.2.0 (PR #4199). Run 2026.2.0 or later if you use PULSE mode. Not every report is a bug, though: issue #10158, “pulse-meter reports many pulses when none really occur”, was closed three days after it opened when its reporter could no longer reproduce it. And Home Assistant Glow issue #1059 reported spikes of 195–260 kW on ESPHome 2026.5.3, after the fix; it was closed without a cause found. An update won’t fix light.
The table: shortest gap between pulses and the multiplier, by meter constant and load
Every pulse is 1/imp of a kilowatt-hour. At a steady load the gap between pulses is fixed, and it is shortest at the most you ever draw. That shortest gap is the number every filter setting has to respect.
shortest gap (ms) = 3,600,000 ÷ (imp × kW) · multiplier (W per pulse/min) = 60,000 ÷ imp
imp is the meter constant in imp/kWh, printed on the meter face beside the LED; kW is the most your home draws, which your main fuse limits. Both formulas are the model’s own ESPHome check.
| Meter constant (multiplier) | 3 kW | 6 kW | 10 kW | 16 kW | 25 kW |
|---|---|---|---|---|---|
| 500 imp/kWh (120) | 2400 ms | 1200 ms | 720 ms | 450 ms | 288 ms |
| 1,000 imp/kWh (60) | 1200 ms | 600 ms | 360 ms | 225 ms | 144 ms |
| 2,000 imp/kWh (30) | 600 ms | 300 ms | 180 ms | 112.5 ms | 72 ms |
| 3,200 imp/kWh (18.75) | 375 ms | 187.5 ms | 112.5 ms | 70.3 ms | 45 ms |
| 10,000 imp/kWh (6) | 120 ms | 60 ms | 36 ms | 22.5 ms* | 14.4 ms* |
multiply: 6 for 10,000 imp/kWh. * Shorter than CLOU’s 35 ms default LED flash, the longer of the two in the next section.The pulse_meter sensor reports pulses per minute, so multiply by 60,000 ÷ imp to get watts: 60 at 1000 imp/kWh, the default in the Home Assistant Glow docs. For the energy total, each pulse is 1/imp kWh, 0.001 kWh at 1000 imp/kWh.
Pick the load generously. A filter set from it drops pulses that come faster than it allows, so readings run low above that load; with the filter at half the gap, that starts at twice the load you picked. In the model, the maximum-load slider runs 2–25 kW and the meter-constant slider 500–10,000 imp/kWh, and the engine works out your gap and multiplier from them.
Choosing internal_filter: EDGE vs PULSE mode, and why our own check needed a footnote
internal_filter defaults to 13 µs, which rejects almost nothing on a light sensor. What it rejects depends on internal_filter_mode:
- EDGE (the default): a rising edge that comes sooner than the filter time after the last accepted one is dropped. So the filter must stay below the shortest gap from the table.
- PULSE: the docs say a pulse counts only if the input stays high for at least the filter time. The source code adds a second rule: the counter re-arms only after the input has been low for the filter time too. That is our reading of the code; the docs describe only the high half. So in PULSE mode the filter must be shorter than the meter’s LED flash and shorter than the dark time between flashes. Because both halves must pass, it doesn’t matter which way round your module’s D0 output works.
How long does a meter LED flash?
Much shorter than the gap, and it differs from meter to meter. These are the figures from the makers’ documents we opened:
| Meter | LED constant | LED flash | Note |
|---|---|---|---|
| Landis+Gyr E470 | 1000 imp/kWh | 20 ms | Below the starting current the LED stays lit. |
| CLOU (for example CL710K22) | for example 1000 imp/kWh | 35 ms by default | CLOU says LED settings are customised per project. |
| CNC DDS226-1 | 800 to 6400 imp/kWh | not given | Its 80 ± 5 ms is the passive pulse output, not the LED. |
So the Landis+Gyr E470 flashes for 20 ms, a CLOU meter for 35 ms by default, some documents give no figure at all, and the standard allows much shorter flashes. That changes the advice you’ll find. The docs’ 20 ms example, used in PULSE mode, leaves no margin on an E470’s 20 ms flash, and on any meter whose flash is shorter than the filter, PULSE mode rejects every real pulse. In the LM393 thread, readings ran low once the filter went above about 40 ms, which the poster put down to their meter’s flash of about that length.
Our footnote
The model’s ESPHome check says that at 10 kW and 1,000 imp/kWh, with pulses 360 ms apart, “an internal_filter up to 180 ms is safe”. That holds in EDGE mode, where half the gap leaves room for a load above your estimate. In PULSE mode, 180 ms is longer than every flash in the table and would reject every real pulse. The check is right for the mode ESPHome uses by default and wrong for the other, and this guide is where we say so.
| Meter (LED flash) | EDGE: below | PULSE: below |
|---|---|---|
| Landis+Gyr E470 (20 ms) | 180 ms (half the gap) | 20 ms |
| CLOU (for example CL710K22) (35 ms by default) | 180 ms (half the gap) | 35 ms |
What happens when the gap gets shorter than the flash? At 10,000 imp/kWh and 16 kW, pulses are 22.5 ms apart, and CLOU’s 35 ms default flash no longer fits. None of the meter documents we opened says what the LED does then. If a meter splits each period evenly between on and off, the PULSE bound becomes half the gap, the engine’s figure; we haven’t seen that confirmed for any meter.
Our recommendation
- Flash length unknown: use EDGE mode, with the filter at about half the shortest gap from the table. You can work out the gap; you usually can’t find the flash.
- Flash length known: PULSE mode also rejects stray flashes shorter than the filter wherever they fall, but keep the filter well under the meter’s flash and under half the gap. The mwestermann build uses 10 ms PULSE and suggests 5 ms if it counts fewer pulses than the meter.
- Glow users: the Glow docs now set the filter from the web interface, not YAML, and the ghost-pulse FAQ suggests 1,000–10,000 µs (1–10 ms).
This is our reading of ESPHome’s code, not ESPHome’s advice. Neither mode stops stray light for you. In EDGE mode a stray flash in a quiet hour, far from any real pulse, always counts. In PULSE mode it counts if it lasts longer than the filter, and the filter has to stay under the meter’s own flash. The light has to be dealt with in the housing.
| What you see | Likely cause | Try |
|---|---|---|
| Spikes of hundreds of kW | An extra edge just after a real pulse: chatter, the module’s D0 LED, a floating input | Trimpot away from the switching point, cover the module’s LEDs, pull-up or capacitor on the input, EDGE filter at half the gap |
| Daily total runs high, most at low load | Stray light counted between real pulses | A dark housing; a filter can’t fix this in EDGE mode |
| Readings low, worse at high load | Filter longer than the flash (PULSE) or than the gap (EDGE) | Shorten the filter; check your meter’s flash |
| Readings low or missing at any load | Sensor off the LED, or trimpot set too dull | Re-aim the aperture; re-set the trimpot |
| Power wobbles by tens of watts at high load, total correct | 1 ms timing resolution | Nothing to fix |
The test that settles it is the meter itself. Note the register, leave the reader running for a few hours, and compare. The mwestermann build recorded 2.847 kWh against the meter’s 2.847 over 5 hours, and 6.228 against 6.227 over 13.7 hours, one pulse apart.
Designing a light-tight sensor housing: the bore, the aperture and the seal
A filter can only reject pulses near a real one. Keeping stray light out is the housing’s job, and it has to keep out the light made inside the case as well as the room light.
- The bore. The photodiode sits in a 6.2 mm bore with a 1.6 mm wall, and a 1.0 mm plate behind the seal ring.
- The aperture. A 4 mm hole over a 3 mm LED, leaving 0.5 mm of aiming slack on each side. It is the only opening in the case.
- The seal. A TPU ring, 8–15 mm across, presses round the LED on the meter face.
What the check first missed
The first build had a check called “No light path except the aperture”. It passed while reporting, in its own text, that the module board sat 0.4 mm above the top of the bore. That 0.4 mm is a ring-shaped slot straight into the photodiode’s chamber, facing the inside of the case where the module’s LEDs are. The Workshop reviewer sent it back, scoring correctness 3 of 5, with 4 must-fix items; the first was to close that gap and make the check prove it closed.
In the fixed design the bore’s top meets the board (0.00 mm gap) and two lid fingers press the board down onto it (0.00 mm). The check is now called “Bore sealed at the module board”, and it passed in every one of the 18 rebuilds at the slider ends, including photodiode heights of 7.5–12 mm and tape thicknesses of 0.5–1.6 mm. The lesson carries over to any design: a check that reports a gap and passes anyway isn’t checking the thing you care about.
Print the case in black, so the cup is opaque. Use PETG: the model’s design brief allows black PLA too, but the engine checked the lid hooks in PETG only, and the same flex in PLA would put about 20.4 MPa across the layers, over the 20 MPa layer strength in the engine’s PLA profile (our arithmetic, stress = stiffness × strain). Pale and thin walls pass light, and the wall thickness guide explains why walls should be whole nozzle lines. The check is geometry only: it proves there is no open path to the photodiode, not how much light gets through the plastic or whether the TPU ring seals on your meter’s face.
Fitting the module, ESP32 and OLED: play, window and snaps
LM393 modules and ESP32 boards aren’t a standard size, so the case takes your measurements. At the defaults the engine checked:
| Part | Default | Play or margin | Slider range |
|---|---|---|---|
| LM393 module | 14 × 32 mm, resting on the bore top | 0.3 mm each side | 28–40 mm long, 12–17 mm wide; photodiode height 7.5–12 mm |
| ESP32-C3 board | 22.5 × 18 mm | 0.3 mm | 18–30 mm × 15–22 mm |
| 0.96 in OLED | 21.7 × 10.9 mm screen behind a 24 × 14 mm window | 1.2 mm and 1.5 mm | – |
Measure your module and board with calipers before you set the sliders. 0.3 mm each side is 0.6 mm in total, a little more than the 0.5 mm loose fit in the 3D printing tolerances chart, because seller sizes vary and a board that binds won’t sit flat on the bore top.
The snap lid
The lid holds with 3 hooks on a 0.4 mm catch. At 0.55 mm of flex they see 0.68% strain, against the engine’s repeat-use limit of 2%, a fifth of the 10% elongation in its PETG profile, and 13.6 MPa across the layers against the profile’s 20 MPa layer strength. Compare it with the limits in the snap-fit guide, which are stricter for arms that bend across their layers. Pulling the lid off takes 5.9 N, with a 45° return face, against its own 6.9 g, so you can open it again to adjust the trimpot.
Inside, the sensor module’s pins end at 34.5 mm along the case and the OLED header starts at 59.9 mm, 25.4 mm apart (our subtraction), so the sensor wiring stays clear of the OLED header. The engine also checked the USB-C plug’s path into its port.
Electronics enclosureA box with standoffs and a vented lid for a Raspberry Pi or an Arduino Uno, if your reader runs on one of those and you’d rather keep the board away from the meter, with wires to the sensor.96 × 67 × 33 mm · 49 g · 1 h 15 minMounting on the meter: tape, LED distance and what not to do
Meters put the pulse LED in different places. The LED-to-screen slider (38–80 mm) moves the sensor cup along the case; measure from the meter’s display to the LED and set it. The engine’s check puts the photodiode on the aperture’s centre at any setting. The tape slider (0.5–1.6 mm) takes the thickness of the tape you use.
- Stick it on with removable tape. Don’t drill or glue anything to the meter, and keep its labels and seals uncovered.
- Never open the meter, break or cover its seals, or touch its wiring. The meter belongs to your supplier or network operator. In the UK, the Electricity Act 1989 makes it an offence to stop a meter registering properly. In the Netherlands, Enexis says its meters are its property and sealed, and only an installer with seal rights may break a seal.
- We found no published rule about sticking a reader on the meter face, either way. Check your supplier’s or network operator’s terms.
- For indoor meter cupboards only. The case wasn’t designed or checked for damp, sun or frost.
What it costs to print, and what we didn’t check
| Part | Size as printed | Filament | Time | Overhang |
|---|---|---|---|---|
| Base | 40.0 × 79.9 × 17.0 mm | 13 g | 22 min | 1.6%, no supports |
| Lid | 40.0 × 79.9 × 14.5 mm | 7 g | 14 min | 0.1%, no supports |
| Seal ring (TPU) | 14.8 × 14.8 × 2.0 mm | 0 g | 5 min | 0.0%, no supports |
The whole case is about 21 g and 42 min at 2 walls and 15% infill, and 23 g and 46 min at 4 walls and 25%. Assembled it measures 40.0 × 79.9 × 20.0 mm, and each part fits the smallest bed in the engine’s printer list, the Bambu Lab A1 mini’s 180 × 180 mm.
Checked in the Loftsmith engine
- 14 checks at the default sliders, all passed: the fits above, the seal at the board, the cup on the LED, snap strain, lid retention, the wiring gap, the ESPHome settings, and the paths of the module, ESP32, OLED and USB-C plug into the case.
- 18 rebuilds at both ends of all 9 sliders, each passing every check and fitting the bed.
Not checked
- Light. No light leakage was measured with a real sensor. The check proves there is no open path, not that the plastic is opaque.
- Pulses. No pulse counts were compared with a meter. The filter advice is from ESPHome’s documentation and code, datasheets and user reports.
- Fixing. Tape adhesion, the TPU ring’s squeeze on a meter face, and heat in a closed cupboard were not modelled.
- Printing. Nothing on this page was printed. Where it says “checked”, it means the engine, not a test.
The case is a free Workshop model: open the ESPHome pulse reader case, enter your module, board and meter measurements, your meter constant and maximum load, and the engine rebuilds and rechecks it, with your multiplier and shortest gap. If your printer’s holes run small, print the tolerance test first.
Tolerance testerA ladder of holes and pegs that shows whether 0.3 mm of play is enough on your printer before you print the case.71 × 35 × 10 mm · 5 g · 21 minQuestions people ask
Why does my ESPHome pulse meter show huge power spikes?
Because pulse_meter works out power from the time between pulses, one extra edge just after a real pulse reads as a huge load: at 1000 imp/kWh, a pulse 20 ms after the last one means 180,000 W. The extra edges usually come from light reaching the sensor (including the LM393 module’s own D0 LED, which blinks with every pulse), from the comparator chattering near its trimpot threshold, or from a floating input pin. Cover the module’s LEDs, keep the sensor dark, set the trimpot away from the switching point, and set internal_filter.
What internal_filter should I use for an ESPHome pulse meter?
Work out the shortest gap between pulses, 3,600,000 ÷ (imp/kWh × max kW) ms: 360 ms at 1,000 imp/kWh and 10 kW. In EDGE mode, the default, keep the filter under that gap; about half of it (180 ms) leaves room for a higher load. In PULSE mode the filter must also be shorter than the meter’s LED flash, which differs by meter: the Landis+Gyr E470 manual gives 20 ms and CLOU a 35 ms default, and some datasheets give none, so a filter that suits one meter can reject every pulse on another. If you don’t know your meter’s flash, we recommend EDGE (our reading of ESPHome’s code, not ESPHome’s advice).
What multiplier do I use for 1000 imp/kWh?
60. pulse_meter reports pulses per minute, and 60,000 ÷ imp/kWh turns that into watts: 120 at 500 imp/kWh, 60 at 1000 and 6 at 10,000 (the ESPHome docs’ own example). For the energy total, each pulse is 1/imp kWh.
Should I use EDGE or PULSE for internal_filter_mode?
EDGE drops a rising edge that comes sooner than the filter time after the last accepted one, so its limit is the gap between pulses, which you can calculate (22.5 ms at 10,000 imp/kWh and 16 kW). PULSE counts a pulse only if the input stays high for the filter time and, in ESPHome’s source code, re-arms only after it has been low as long, so the filter must be shorter than the meter’s LED flash and the dark time between flashes. Flashes differ by meter (20 ms on a Landis+Gyr E470, 35 ms by default on CLOU meters) and some datasheets don’t give one. Our recommendation, from reading the code rather than from ESPHome’s documentation, is EDGE unless you know your meter’s flash. If you use PULSE, run ESPHome 2026.2.0 or later.
Can the LM393 module’s own LED cause false pulses?
Yes. The module’s D0 LED blinks with each pulse and, inside a closed case, can light the photodiode. Loftsmith’s Workshop reviewer flagged it on our reader case, and a Home Assistant Glow user taped over the ESP and module LEDs for the same reason. Cover the power and D0 LEDs with black paint or tape before the module goes in, and cover any ESP board LED that blinks with the pulses.
Sources and method
Written and computed by the Loftsmith team on 4 December 2026. The case figures come from the Loftsmith engine’s build of the Workshop model “ESPHome electricity meter LED pulse reader case with OLED” on 3 December 2026, on the Bambu Lab A1 profile in PETG at its default sliders (LED to screen 50 mm, tape 1 mm, module 32 × 14 mm, photodiode height 9 mm, board 22.5 × 18 mm, 1,000 imp/kWh, 10 kW): 14 checks, all passed, and 18 rebuilds at the slider ends, all passed. The model went through two Workshop review rounds; the first was sent back with 4 must-fix items, including the 0.4 mm gap at the bore, and the second passed. The image is the engine’s render, not a photo. The page reads these numbers from the report’s own text in code; at the defaults, 2 walls and 15% infill, the case is about 21 g and 42 minutes.
The gap table and the filter-window table are this page’s arithmetic on the model’s own formulas (gap = 3,600,000 ÷ (imp × kW) ms, multiplier = 60,000 ÷ imp), checked in code against the engine’s result at 1,000 imp/kWh and 10 kW and against the ESPHome docs’ worked example. What EDGE and PULSE mode reject is from the ESPHome docs and our reading of the pulse_meter source code on the dev branch. LED flash lengths are only from the makers’ pages we opened (the Landis+Gyr E470 manual, CLOU’s LED note and CNC’s product page); datasheet PDFs we could read only through search-result text (Finder, Landis+Gyr E450, ABB, Kamstrup, Iskra, Itron, and two metering-chip datasheets) are not quoted or linked. The EDGE-or-PULSE recommendation is ours, from reading the code. Forum and GitHub reports are quoted as what one user saw, not as tests. Sources were read on 4 December 2026.
Not tested: nothing in this guide has been printed or fitted to a meter. No light leakage was measured, no pulse count was compared with a meter register, and tape adhesion, the seal ring’s squeeze and heat in a meter cupboard were not modelled. When there is a print on a real meter, the results will go here.
Found a mistake? Email [email protected] and we’ll fix it.
- Loftsmith Workshop: ESPHome electricity meter LED pulse reader case with OLED (the model and its engine build)
- ESPHome: Pulse Meter Sensor (internal_filter, internal_filter_mode, worked example)
- ESPHome source: pulse_meter_sensor.cpp, dev branch (read 4 Dec 2026)
- esphome/esphome PR #12360: [pulse_meter] Fix early edge detection (merged 12 Feb 2026)
- ESPHome 2026.2.0 changelog
- esphome/esphome issue #10605: PULSE mode gives wrong pulse detection
- esphome/esphome issue #10158: pulse-meter reports many pulses when none really occur (closed 13 Aug 2025)
- esphome/esphome PR #4199: Fix broken PULSE_METER (merged 22 Dec 2022)
- ESPHome 2023.2.0 changelog
- mwestermann/esphome-pulse-meter: README (LM393 chatter, PULSE filter and hold-off, test against a meter)
- CLOU: LED information of energy meters (35 ms default pulse width)
- CLOU: The optical test output and pulses (IEC 62052-11 minimum on-time)
- Landis+Gyr E470 series user manual, p. 24 (ManualsLib): LED pulse length
- CNC Electric DDS226-1 single-phase meter product page
- Home Assistant Glow docs: Getting started (default pulse rate)
- Home Assistant Glow docs: Internal filter
- Home Assistant Glow docs: Ghost pulses FAQ
- Home Assistant Glow discussion #70: taping the ESP and module LEDs (22 Oct 2021)
- Home Assistant Glow issue #1059: phantom power spikes (Oct 2026)
- Home Assistant Community: ESP32 & LM393 optical sensor power spikes, LED pulse meter (Jan 2023)
- Home Assistant Community: Error in pulse meter sensor?
- Home Assistant Community: Pulse_meter seems to be buggy (Sept 2025)
- Home Assistant Community: Improving pulse meter sensor (Mar 2022)
- Enexis: Zelf klussen in de meterkast (meters are sealed operator property)
- Electricity Act 1989, Schedule 7 (legislation.gov.uk)
