Shelly EM50 power meter at utility meter split between house and garage: sum vs subtraction in Home Assistant?

In my basement, immediately after the utility meter, there’s a junction box where the line splits into two branches one feeding the apartment and one feeding the garage.

I’m considering installing a Shelly power meter there (I already have a 50EM available). I’m comfortable with the physical installation; my main doubts are about the logical setup and data handling in Home Assistant.

The Shelly has two current clamps. My first idea was:

  • Clamp 1 on the apartment line
  • Clamp 2 on the garage line
  • In Home Assistant, create a template sensor total_consumption as the sum of the two clamps.

An alternative setup would be:

  • One clamp on the mains line coming from the utility meter
  • One clamp on either the apartment or the garage line
  • In Home Assistant, derive the missing value (garage_consumption or house_consumption) by subtracting the branch measurement from the mains measurement.

I could also install the Shelly in the breaker panel inside the house, but I would lose visibility on the garage branch consumption.

From a purely mathematical perspective the two approaches should be equivalent. However, I’m wondering if there are any practical downsides, quirks, or accuracy issues when deriving sensors via sums or subtractions rather than measuring everything directly.


EDIT

For anyone reading this later I opted for the second configuration due to space constraints in the junction box. Clamping the apartment line directly was impractical and prevented the cover from closing properly.

As a workaround, I created a template sensor to derive the apartment values by calculation:

apartment = total - garage

I now need to assess whether this indirect measurement introduces any significant error amplification compared to a direct clamp measurement, if anyone has suggestions on how to evaluate it feedback welcome!

After some days of data collection I am noticing a deviation in the measurements collected resulting in negative (exported) untracked energy in the Energy Dashboard. The amount is significative.

While looking at the individual sensor values I noticed that the Apartment Energy/Power goes into the negative sometimes. (Blue line in the graph)

When zooming in the apartment negative values I can see that the Shelly, somehow measures a Total Power which is less than the Garage Power, which is impossible from an electric point of view given that CT0 measures from the utility meter and CT1 measures a sub-branch.

From my understanding of the situation when a power increase happens in the garage (red line) it is measured correctly by CT1 (the second clamp), while the Total Power CT0 doesn’t reflect the consumption increase, thus resulting in Total Power < Garage Power

It’s like CT0 is slower to react to the power change or it is out of calibration or something else?