Power consumption: sum of multiple sensors / entities

Dear all,

I am new to home assistance and have signed up mainly to be able to log more information of my consumption, and possible future automatisation in the future.

I have purchased the Shelly 3EM sensor to monitor power of a recently installed heath pump.

Now i would like to add a new sensor that is the sum of the 3 phases of the heath pump.
How may i do this?

As a follow up i wanted to add the energy monitor to my home assistance however I have failed to properly install the code. Can anyone spot a mistake i made in the code? (for now i have used the source of only one phase as i have been unable to make the sum of all phases)

#utility_meter
utility_meter:
 daily_energy: 
 source: sensor.shellyem3_84cca8ad54ea_channel_a_power
 cycle: daily
 tarrifs:
 - peak
 - offpeak
     
 monthly_energy:
  source: sensor.shellyem3_84cca8ad54ea_channel_a_power
  cycle: monthly
  tarrifs: 
  - peak
  - offpeak
    
 yearly_energy:
  source: sensor.shellyem3_84cca8ad54ea_channel_a_power
  cycle: yearly
  tarrifs:
  - peak
  - offpeak

Thank you for your assistance.

1 Like

Just add a new sensor like below.
I made two of them, for current and for total consumption.


- platform: template
    sensors:
       strom_total:
        friendly_name: 'Hausstrom'
        value_template: "{{ (states('sensor.shelly_shem_3_d8bfc01a7dcd_1_current_consumption')|float + states('sensor.shelly_shem_3_d8bfc01a7dcd_2_current_consumption')|float + states('sensor.shelly_shem_3_d8bfc01a7dcd_3_current_consumption')|float)}}"
        unit_of_measurement: W
        
       strom_total_kwh:
        friendly_name: 'Hausstrom_kwh'
        value_template: "{{ (states('sensor.shelly_shem_3_d8bfc01a7dcd_1_total_consumption')|float + states('sensor.shelly_shem_3_d8bfc01a7dcd_2_total_consumption')|float + states('sensor.shelly_shem_3_d8bfc01a7dcd_3_total_consumption')|float)}}"
        unit_of_measurement: kWh    
  

3 Likes

I tried to implement the above. Since I have different metered plugs, I have to sum different Xiaomi Aqara plugs. Some of them report a “x.y” Wattage and some does it in “x,y”.

Can someone of you can give me a hint on how to harmonize these, i.e. convert the . value to a , one?