Throttle power logging

Monitoring active power from a Shelly Plus 1PM Gen 2 and want a clean, integer-only representation (no decimals).

Connected via MQTT, shelly-scripts/scripts/mqtt-discovery-self.shelly.js at main · michal-bartak/shelly-scripts · GitHub

What I need is recorder logging control, not value manipulation:

Requirements

The displayed and logged value must always be the actual current reading, rounded to an integer.
Normal small fluctuations (±2 W or less) must never generate a recorder log entry.
Only when the power changes abruptly by more than 2 W (up or down) should Home Assistant write one log entry, for example:
Power L1 big change: 142 → 1000 W
Important

Do not want clamping, smoothing, averaging, or replacement of values.
Even large spikes or “wrong” readings must be shown and logged as is.

You would need to flash ESPHome to your Shelly.

You don’t mention which Shelly device you have but there are many Shelly device files for ESPHome, e.g. : Shelly EM | ESPHome Devices

Then you can apply custom filters in the device. Specifically round and delta filters. See: https://esphome.io/components/sensor/#sensor-filters

1 Like

Shelly Plus 1PM - Gen 2