Change upstream device without changing energy history

I have two Shelly smart plugs that were running separately. I recently moved one so that it now sits physically behind the other, so I wanted to set the first plug as the upstream device in Home Assistant’s Energy dashboard.

However, when I set the upstream device, it also retroactively changes the device’s history in the Energy tab.

How can I configure the upstream device so that it only affects energy data from now on, without modifying past history?

Don’t use Device_id’s, use entity_id’s. Then simply name the new device with the old device’s name.

I have same issue, moved Shelly device to other outlet, can’t change it’s upstream device, now old data show wrong data. Tried to remove device and add again but all statistics are updated to new name.
How to modify upstream device to keep old data, without buying new Shelly device?