The new Energy section is really cool.
We use Shelly 3EM with the built-in Shelly integration (not ShellyForHASS) to measure all 3-phases coming to the house.
There are 2 options to integrate it with the new Energy section:
- Add all 3 phases (A, B, and C) under “Configuration → Energy”. A stacked bar will be used to show the total.
- Create a template sensor to combine the 3. It’s somewhat tricky to get it to work with the statistics engine. Here is what we use:
[Update: 2021.9 introduced a change, and the “state_class” should be “total_increasing” instead of “measurement”. The “last_reset” attribute is not needed anymore. A good post explaining the differences of “state_class” options can be found here.]
template:
- sensor:
- name: "Energy Total"
unique_id: energy_total
state: >-
{{
[ states('sensor.phase_a_energy'),
states('sensor.phase_b_energy'),
states('sensor.phase_c_energy'),
] | map('float') | sum
}}
availability: >-
{{
[ states('sensor.phase_a_energy'),
states('sensor.phase_b_energy'),
states('sensor.phase_c_energy'),
] | map('is_number') | min
}}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing