How can I merge the values of 2 meters into 1 and use them in the energy dashboard?

That is another way to solve it.The problem with your template was that it is and old style template sensor definition. New style you should define the sensor under the top level template: and not sensor: