Hi @gerasalus,
HA can calculate that for you.
You have L1, L2 and L3 for energy consumption and the same for “energy_return” in the entities. (L… are the phases)
You can set all in the energy dash and then you are good to go.
Or maybe I missunderstood you and you are looking for a code?
In my case for example, I summarize all three phases together using that code in a template.yaml file:
- sensor:
- name: "Energy Total"
unique_id: energy_total
state: >-
{{ states('sensor.phase_1_energy')|float(0) +
states('sensor.phase_2_energy')|float(0) +
states('sensor.phase_3_energy')|float(0) }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >
{{ not 'unavailable' in
[ states('sensor.phase_1_energy'),
states('sensor.phase_2_energy'),
states('sensor.phase_3_energy') ] }}
- name: "Power Total"
unique_id: power_total
state: >-
{{ (states('sensor.phase_1_power')|float(0) +
states('sensor.phase_2_power')|float(0) +
states('sensor.phase_3_power')|float(0)) }}
unit_of_measurement: W
device_class: power
state_class: measurement
availability: >
{{ not 'unavailable' in
[ states('sensor.phase_1_power'),
states('sensor.phase_2_power'),
states('sensor.phase_3_power') ] }}
Info: My WIFI gets deactivated during nighttime. Therefore there is no recording and a “peak” at the beginning of each day.
The only thing I am wondering is, that even I generate more energy than I am currently using, I still can see a consumption. I thougt, this might be because of a peak but I can´t see any:
Solar Panel feed (Shelly Plug S):
Summarized power consumption (Shelly 3EM):
Maybe somenbody has an idea what the issue might be here 
Cheers and enjoy your weekend guys.