New energy upstream device inverted?

Hi,
Since the last update we can now add an upstream device.
This is super cool as it happens here to me:
I have a wall socket that count the power and energy, and later on, I have one other socket that is also counting these, and I need both of them to restart the latest one.
Until now it would count both energy meters for the total consumptions with obviously is wrong. But last update fixed this.
That said, I don’t understand the legends here.

When I add an upstream device, I would expect that the upstream count the energy, but not the one that have set this upsteam as the upstream device.

If the wall here is FB Bureau Gauche in my case, the Routeur should not be counted.
But the legend in the hourly graphic seems to say the opposite, so I’m lost.


As I can’t upload the others images, my Router is set with upstream for the FB Bureau Gauche, and the FB Bureau gauche has no upstream device

Ok I see. It can also make sense but both option would be better then.
Because here they all have perfect counting except the main one is the only one to take into consideration for the total amount as the other ones are inside it.
It’s confusing for me here. :slight_smile:

I had the same understanting. I tought the downstream device would not be counted and HA would only consider upstream device. It’s also confusing for me.

I have the same issue and this is really confusing. I would expect that the upstream device would report all its consumption EXCEPT the consumption of all the downstream devices. Instead i get this strange negative value.

In my configuration, “Cucina” is the upstream device and “Frigorifero” is downstream. Why do i get negative values?

Yes that is the expected behavior. Can you share a CSV dump?

You will get a negative value in the parent if the children report total consumption greater than that of their parent device.

How to do a dump? Sry, never done that :frowning:

If i might assume a possible reason…maybe this happens because the power meters have different reporting time interval? “Frigorifero” is on a power meter that updates every second. Cucina has a refresh time of 4-5 seconds. This might be the issue?

Here is the dump

entity_id,type,unit,2025-04-11T22:00:00.000Z,2025-04-11T23:00:00.000Z,2025-04-12T00:00:00.000Z,2025-04-12T01:00:00.000Z,2025-04-12T02:00:00.000Z,2025-04-12T03:00:00.000Z,2025-04-12T04:00:00.000Z,2025-04-12T05:00:00.000Z,2025-04-12T06:00:00.000Z,2025-04-12T07:00:00.000Z,2025-04-12T08:00:00.000Z,2025-04-12T09:00:00.000Z,2025-04-12T10:00:00.000Z,2025-04-12T11:00:00.000Z,2025-04-12T12:00:00.000Z,2025-04-12T13:00:00.000Z,2025-04-12T14:00:00.000Z,2025-04-12T15:00:00.000Z
sensor.potenza,grid_consumption,kWh,0.20490996357602853,0.19127646395054398,0.2120972353986872,0.1905453750405286,0.1948242709954684,0.18520088564810067,0.19820745142760643,0.5629500891227508,0.22044313650212644,0.19166267887112554,0.18737814376981987,0.18838542693674754,0.26254100912274225,0.29116623672780406,0.6846019527060889,0.5180380561246238,0.39997984349884064,0.3176271242846269
sensor.potenza_cost,grid_consumption_cost,EUR,0.021853418589046214,0.020382477848670533,0.02257667454193779,0.02028258835946417,0.02073805512304716,0.01971369458115646,0.021098177514005556,0.06868808044853836,0.026897261741225975,0.023385628246046508,0.022862852786118992,0.022985755950372777,0.032033813128578004,0.03552650630786047,0.08353137322697535,0.06320816065584722,0.04880334544552056,0.03875511859234848
sensor.presa_asciugatrice_sommatoria_consegnata,device_consumption,kWh,0,0,0,0,0,0,0,0.00999999999999801,0,0,0,0,0,0,0,0,0,0
sensor.presa_lavatrice_sommatoria_consegnata,device_consumption,kWh,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
sensor.presa_microonde_friggitrice_e_vaporiera_sommatoria_consegnata,device_consumption,kWh,0,0,0,0,0,0.010000000000001563,0,0,0,0,0.00999999999999801,0,0,0,0,0,0.010000000000001563,0
sensor.power_meter_luci_sommatoria_consegnata,device_consumption,kWh,0.020000000000000018,0.010000000000000009,0.019999999999999962,0.020000000000000018,0.010000000000000009,0.020000000000000018,0.019999999999999962,0.020000000000000018,0.010000000000000009,0.020000000000000018,0.020000000000000018,0.010000000000000009,0.019999999999999907,0.030000000000000027,0.020000000000000018,0.030000000000000027,0.020000000000000018,0.019999999999999907
sensor.presa_pozzetto_sommatoria_consegnata,device_consumption,kWh,0.01999999999999602,0.00999999999999801,0.020000000000003126,0.00999999999999801,0.020000000000003126,0.00999999999999801,0.020000000000003126,0.00999999999999801,0.00999999999999801,0.020000000000003126,0.01999999999999602,0.010000000000005116,0.030000000000001137,0.01999999999999602,0.020000000000003126,0.01999999999999602,0.020000000000003126,0.01999999999999602
sensor.frigorifero_sommatoria_consegnata,device_consumption,kWh,0.020000000000003126,0.01999999999999602,0.03999999999999915,0.020000000000003126,0.01999999999999602,0.030000000000001137,0.030000000000001137,0.030000000000001137,0.01999999999999602,0.020000000000003126,0.030000000000001137,0.030000000000001137,0.030000000000001137,0.01999999999999602,0.020000000000003126,0.030000000000001137,0.02999999999999403,0.030000000000001137
sensor.presa_televisione_sommatoria_consegnata,device_consumption,kWh,0.03999999999999204,0.04000000000000625,0.04000000000000625,0.04999999999999716,0.03999999999999204,0.04000000000000625,0.03999999999999204,0.05000000000001137,0.03999999999999204,0.04000000000000625,0.03999999999999204,0.05000000000001137,0.03999999999999204,0.04000000000000625,0.03999999999999204,0.04999999999999716,0.04000000000000625,0.04000000000000625
sensor.aqara_smart_plug_pc_sommatoria_consegnata,device_consumption,kWh,0.02400000000000091,0.023000000000024556,0.02199999999999136,0.02199999999999136,0.023000000000024556,0.022999999999967713,0.021000000000015007,0.02400000000000091,0.04699999999996862,0.023000000000024556,0.023000000000024556,0.020999999999958163,0.05700000000001637,0.12400000000002365,0.18199999999995953,0.3140000000000214,0.23399999999998045,0.12700000000000955
sensor.presa_divano_sommatoria_consegnata,device_consumption,kWh,0,0.010000000000001563,0,0.009999999999999787,0,0.009999999999999787,0,0.009999999999999787,0,0.009999999999999787,0,0.009999999999999787,0,0.009999999999999787,0,0.009999999999999787,0,0.010000000000001563
sensor.presa_bagno_sommatoria_consegnata,device_consumption,kWh,0,0.00999999999999801,0,0.010000000000001563,0,0.00999999999999801,0,0.360000000000003,0,0.00999999999999801,0,0.010000000000001563,0,0.00999999999999801,0,0.010000000000001563,0,0.00999999999999801
sensor.power_meter_cucina_sommatoria_consegnata,device_consumption,kWh,0.01999999999999999,0.03,0.03999999999999998,0.030000000000000027,0.02999999999999997,0.020000000000000018,0.03999999999999998,0.030000000000000027,0.02999999999999997,0.030000000000000027,0.020000000000000018,0.040000000000000036,0.029999999999999916,0.030000000000000027,0.030000000000000027,0.020000000000000018,0.039999999999999925,0.030000000000000027
sensor.energia_luci_esterne,device_consumption,kWh,0.00032691980736111736,0.0006494184640277734,0.0004526754148611034,0.00023310348305556616,0.0020309616745833314,0,0.0012525038931944371,0.0000561196815277859,0,0.0012778495577777799,0,0,0.003976506719444439,0,0.0011713126888888842,0.00034438777333334336,0,0

I don’t think reporting interval would matter that much, unless one was like larger than an hour, but all I can say is that for 5-6AM the parent sensor.power_meter_cucina_sommatoria_consegnata reports 0.02 kWh, and the child sensor.frigorifero_sommatoria_consegnata reports 0.03 kWh, which is impossible if the frigorifero is really included within cucina.

You’d have to dive deeper into the data to understand how that came to be possible. But given that input data, showing -0.01 for the cucina seems to be the correct result.

I understand! What probably happens is that when the only deviced powered on is Frigorifero, the Cucina power meter may report a slightly different value from the Frigorifero power meter because of different measurement device tollerance.

Frigorifero has probably reported a higher value that Cucina, hence the problem.

Can you think of any workaround to account for this small differences, maybe with a custom helper sensor?

In this case maybe the subtract group of powercalc can be of some help?
I always have the doubt that upstream and subtract do the same thing, but not sure of this.
Do you know if subtract works like upstream or not? Or they can live together?