I lost my connected socket so I bought another one, I would like to keep the history of energy consumption but I cannot override that of the new connected socket. Every time I set the “energy” value it overrides as soon as there is new data:
Most power plugs can’t set energy value, just reset it to zero. In that situation I would create template sensor which simply adds your previous value to energy state of the plug.