# How to detect reverse Flow in a simple Smart Meter

My smart meter Holley DTZ541 is installed and sealed as a basic one direction consumption meter by my utility company.

A reverse flow towards the grid occurs occasionally witch active solar panels, feeding the grid for free. That is OK, but I want to know about the magnitude of the reverse flow in order to switch additional loads.

The meter sends SML /MQTT data every 10 seconds by means of a IR-Head.:

SENSOR = {"Time":"2023-03-15T12:41:38","SML":{"total_kwh":870.3787,"curr_w":84}}

No other readings are available. Unfortunately, the power value is absolute, disregarding the actual flow direction.

In order to detect the flow direction, I make use of the power reading: If the power increases between two measurement intervals, the flow is inbound. A reverse flow does not alter the energy reading (remember the meter is not mend to measure reverse flow).

This allows for a simple detector. The detection becomes ambiguous with very low power readings (0 to 36 W), an increase of the power cannot be measured due to the limited power resolution of 1/10 Wh. This may result in an unwanted oscillation:

I could program a smoothing filter, but at the expense of time resolution.
Is there any alternate approach I should be aware of?

My solution in more detail:
The precision of the energy meter sensor is 4 digits, equivalent to 0.1 Wh. The sensor updates every 10 sec. Thus, a continuous power reading of at least 36 W is required to detect an increase in the energy reading.

energy increase > 0.1Wh and Power > 36 W → inbound flow
energy increase = 0Wh and Power >= 36 W → outbound flow

energy increase = 0Wh and Power < 36 W → ambiguous state

The ambiguous state is initially mapped to 0W power output.
If the energy is not increasing over multiple readings, the threshold power of 36 is reduced accordingly, allowing a more precise detection.

SML power transmits only absolute values:

SML energy:

Result: correct flow (in both directions)