Shelly 3EM 3-phases Energy sensor

You don’t need the old value. The consumption calculations are based on the difference between 2 reads of this entity (e.g. the amount consumed in a particular day is the difference between the value in the beginning and end of that day.)

So it’s not possible for the energy integration to show me the overall energy usage and the costs over the last year or so?

Could someone advise whether the Shelly 3EM would work in my house?
I have a special (old) type of electricity configuration coming into my house which looks like this:
image
As you can see I have no Neutral wire in my house.
My devices are not powered by one phase wire and a neutral wire. Instead they are connected to two phase wires that together deliver 230V.
My induction stove in the kitchen needs more power and uses all 3 phases combined to get 400V.

For reference here is a more regular set-up here in Europe where most devices are connected between one phase wire and the neutral wire to get 230V:
image

I have seen the wiring diagram for the Shelly 3EM, but am wondering whether the calculations it will do are correct as it might not expect devices to be connected to 2 phase wires.

Hey everyone.

I installed my shelly 3em and have a problem with one negative phase.
I double checked the clamps and the wires and phase three shows me a negative power consumption…

I live in Germany and I installed the shelly like this:



In Home Assistant I can see all sensors however the current consumption 3, so I’m guessing phase C is negative.

I tried just turning around the clamp on phase C however this led to incorrect readings as shelly 3em tells me I have used 1500 kWh in the last two days which definitely can’t be true.

What can I do?

Are you sure you have the colours right? blue is exclusively neutral. Phases 1-3 are brown / black / grey (or white)…

3 Phase Net Metering with Solar PV Production

Has anyone got three phase net metering with solar PV working with Shelly 3EM?

I located a very comprehensive blog regarding setting up Shelly 3EM on 3 Phase with Solar PV:

Problem for me is in Australia we have net-metering, which means that any energy exports on one phase are cancelled out by imports on the other phases:

Have a look at my Shelly sensors:

My single phase inverter is connected to Phase C, which is showing negative power -201W (which is the solar PV production - Phase C consumption)

My net-meter power is thus Ap+Bp+Cp = 470+1210+(-201) = 1479 W.

But as you can see my Phase C Energy Returned shows some energy being returned.

But my net-meter energy is certainly not Ae+Be+Ce-Aer-Ber-Cer = 74+39+26-16 = 123 kW.

In my case most (but not all) of the Phase C energy return will of been canceled out.

Has anyone else solved?

@anubisg1 does it works as intended? I’m in the middle of integrating Shelly 3EM (shellies discovery so MQTT) + SofarSolar inverter, would be nice to have one total entity rather than 3 phases separated.

yes it works perfectly, but since the auto discovery changed from kwh to wh, i had to had the conversion.
the latest version looks like this

  - name: "House Energy kWh"
    unique_id: sensor.house_energy_kwh
    unit_of_measurement: "kWh"
    device_class: energy
    state_class: total_increasing
    state: >
      {% set val1 = ((states('sensor.shelly_3em_meter_total_0')|float(0))/1000)|round(2) %}
      {% set val2 = ((states('sensor.shelly_3em_meter_total_1')|float(0))/1000)|round(2) %}
      {% set val3 = ((states('sensor.shelly_3em_meter_total_2')|float(0))/1000)|round(2) %}
      {{ val1 | float(0) + val2 | float(0) + val3 | float(0) 
        if 
          is_number(val1) and 
          is_number(val2) and 
          is_number(val3)
        else 
          None
      }}
    availability: >- 
      {{ 
        is_number(states('sensor.shelly_3em_meter_total_0')) and 
        is_number(states('sensor.shelly_3em_meter_total_1')) and
        is_number(states('sensor.shelly_3em_meter_total_2'))
      }}

I just set kWh in shellies discovery settings and reset everything so shouldn’t be a problem. You wanted to preserve historical data? Thanks for help

nothing to do with historical data, i updated the script and the sensors changed from kwh to wh, so did that change. that’s all

2 Likes

I have the Shelly 3EM enroute at the moment and have been looking at how to implement it with my 3-phase and 2 x solar single phase inverters (on different phases), with NET metering.

I found the details of the CoIot, which I think the new Shelly native integration uses here:
https://shelly-api-docs.shelly.cloud/gen1/#shelly-3em-coiot

Wondering if it would be better to use the total energy counter, which I think is an inclining counter given:

“Note, that energy and returned_energy do not survive power cycle or reboot – this is how the value is implemented on other Shellies. Shelly 3EM features a persisted version which is not affected by power cycling or lack of connectivity. To get the persisted counters use total and total_returned .”

total, number, Total consumed energy, Wh
total_returned, number, Total returned energy, Wh

So for Net metering: (*concept yaml need to turn into sensor templates once assumptions are verified)

Import:
{if (total - total_returned) > 0}
  {{(total - total_returned)}}
{else } 
  {{0}}

Export:
{if (total - total_returned) < 0 }
  {{(total - total_returned) * -1}} 
{else} 
  {{0}}

Consumption:
{if  (total - total_returned) > 0}   #importing
   {{total + solargen - total_returned}} 
 {else}
   {{solargen - total_retured + total}}   # exporting

This assumes that total does not already have the solar(total_returned) removed, solargen is total solar generation from inverters not form Shelly 3em

if total and total_returned are inclining and don’t reset daily, might have to use a utility sensor template to create one for daily. monthly etc.

Can anyone confirm the following:?
If the total and total_returnred sensors are included as part of the default Shelly core integration?
If there are total and total_returnred sensors, are they incline counters that don’t reset?
How often are the sensors updated using the Shelly core integration?

Thanks.

i can export data for 2 mounth?
i want to calc how many money i need to get bill for example
9.10.2021 - 8.12.2021
how i can do it?

I agree that using the total & total_returned would simplify, they are currently not available via the core Shelly integration, but shouldn’t be too difficult to include with future revisions of the integration. First step is to raise an issue against the current integration and then work out how to access those sensors, as they are persistent across power cycles they are pretty important to include.

I have posted my working configuration for a net metering settlement period here:

That’s an big oversight that they are not in the core integration
I wonder why they didn’t include those, maybe because they are unique to the 3EM?

How often are the sensors updated using the Shelly core integration?

Thinking MQTT might be a better option, as I have read you can get the data every second, that would increase accuracy.

I am also going to see if we can get shelly to add these NET counters to the firmware so they are accurate: total_import, total_export
Have started a thread at shelly, if you could add support that would be great.

1 Like

There are two shelly integrations, so far I have only used the core integration which ships with HA.

There is also a custom component, installable via HACS, which looks like it exposes total & total_returned. But doesn’t cover the three phase net metering calculations.

They are both available via coIot, I’m guessing they should be trivital to add to the core plugin.
Just wondering if the Shelly core plugin is maintained by Home Assistant team or Shelly?

Any info on the update rate of the 3em sensors using the core plugin, I read that minimum is 15s using coIot and MQTT is 1s?

Update rate seems to be variable, I think it is event driven by the Shelly device when something changes.

I have seen updates every 15 seconds, but sun set was 2 hrs ago so there hasn’t been any energy returned from my PV.

Yea for Energy returned I would expect to stop once the sun goes down.

However the Energy sensors I would expect to update inline with Power sensors but they don’t seem to. That Energy update interval of 4+ minutes is never going to be accurate for Net metering calculations.

Is it always that slow?

I can see a number of incorrect connections in your pictures. For example, the ground fault circuit interrupter is incorrectly connected. Just as “schneemensch” says, the third clamp is also incorrectly mounted. Can you arrange a picture where you see the lower connections on the bottom line?

Hi there,

where can I integrate the skript from the first post?
I cannot find the template editor in the new design :smiley: