Shelly 3EM + utility_meter + feeding to the grid

If you share the template sensor configuration you are using to sum the three phases I think I can fix the zeros with an availability template.

Not just add, I’m quite sure that you have to divide the result with SQRT(3) to get the actual amount that the electrical company registers (note that this is a good thing, less energy spent!).

Pretty sure the EM3 voltage is measured with respect to neutral, so the powers can just be summed. No SQRT(3) required.

Pø = Vø Iø cosθ

If it measures line to line voltage then SQRT(3) is required.

Wye:

Wye-connected-load-formula

I noted that the values I got was way higher than what the meter said when I just added the 3 phases energy output. Found an answer on Shelly´s own forum that they cannot just be summed up (Total Kwh in Phases - Shelly 3EM - Offizielles Shelly Support Forum).

Dividing them with SQRT(3) makes the output within a few percent from what I’m invoiced but please if someone can confirm it or not do so. I will for sure keep my settings since the sum doesn’t really give me any valuable info at all. However it could be that my neutral isn’t any neutral at all…

Then they must be doing this:

If it helps somebody, here’s my calculation and it will also take care of the “unavailble” problem that the thread starter had (been there to :slight_smile: ):

        consumed_energy:
          friendly_name: "Total Consumption"
          device_class: energy
          unit_of_measurement: 'kWh'
          value_template: "{{ ((states('sensor.em_channel_a_energy')|float + states('sensor.em_channel_b_energy')|float + states('sensor.em_channel_c_energy')|float)/sqrt(3))|round(2) }}"
          availability_template: "{{ not ( is_state('sensor.em_channel_a_energy', 'unavailable') or is_state('sensor.em_channel_b_energy', 'unavailable') or is_state('sensor.em_channel_c_energy', 'unavailable') ) }}"

Excellent. Thanks. I’ll try it out. And can compare to the simply sum up of all three.

Yes, please do, it would be very interesting if you are able to get the actual values from your meter and compare.

I noticed that you have installed solar panels and as you probably know you have different sensors for energy feed back to the grid. Depending on where your clamps are mounted you might be able to see the produced energy (ie you must have the clamps mounted directly to the grid phases).

I installed my clamps directly between the external power company’s meter and my house. So everything that comes in/out is counted. My PV inverter has it’s own API and spits out numbers, as well as the little battery.
With all this installed there is a little more brain needed to show correct numbers and configure the sensors correctly.

Hmmmmm. Added Spitfire’s sensor, and results are completely different!!
The simple sum up gives around 9.800kWh and the new sensor is 5.700kWh. That’s a difference of 170% (!!). Can that be possible?

I’ll get a smart meter installed in 2 weeks, so will be able to check “real” kWh used more easily.

Yes, the difference is 73% (since it’s divided with SQRT(3)) so you got the numbers right. I guess since you have mounted the clamps as you did it should be easypeasy to enter the values in the energy integration. Just make one sensor for consumed and one for produced.

So returned capacity will be 70% less as well, right?
Using the Shelly app: Does the app sum up capacity correctly? You got all the statistics there, but as Shelly is not pushing out sums it’s hard to compare.

Yup, sorry for that :wink:

I have no clue about the Shelly app, have not made any comparison myself. I use the data my electrical company delivers back to me and compare with those . With this calculation it’s around 3% difference, by adding the value’s as they where…you guessed it…70% wrong.

1 Like

It does actually have a total.

Go to this address in your web browser and scroll down and look for total_power:

<shelly_ip_address>/status

That would be amazing as it would reduce my bill by - you guess it - 70% (almost, as there’s monthly fees etc as well) :wink:

How are you using the Shelly 3EM?

MQTT?

Because the core integration has this total power value, at least it does for the Shelly EM, I don’t have an EM3.

You can get that total using a rest sensor, but it’s a lot of mucking about. Switch over to using the core integration and make your like easier.

That’s the reason/difference. You got a TOTAL - for ONE phase. I got 3 totals, for 3 phases. But not no sum of all three. :frowning:

I did not know about that data “dump”, so thanks for that but is there really a COMBINED total? To me it looks like it’s just the total for one phase? Or?

It’s 3 seperate totals. Not one sum :frowning:

That’s the output:

{"wifi_sta":{"connected":true,"ssid":"xxxxx","ip":"192.168.1.140","rssi":-60},"cloud":{"enabled":true,"connected":true},"mqtt":{"connected":false},"time":"14:31","unixtime":1630931518,"serial":xxxxx,"has_update":false,"mac":"DC4F22xxxxx","cfg_changed_cnt":0,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"overpower":false,"is_valid":true,"source":"input"}],"emeters":[{"power":-779.61,"pf":-0.97,"current":3.49,"voltage":228.74,"is_valid":true,"total":2488676.3,"total_returned":56383.7},{"power":-539.79,"pf":-0.92,"current":2.56,"voltage":229.09,"is_valid":true,"total":5615129.3,"total_returned":30759.3},{"power":-920.07,"pf":-0.99,"current":4.00,"voltage":231.92,"is_valid":true,"total":1754564.7,"total_returned":50914.4}],"total_power":-2239.47,"fs_mounted":true,"update":{"status":"idle","has_update":false,"new_version":"20210720-190729/v1.11.0-g6abd92e","old_version":"20210720-190729/v1.11.0-g6abd92e","beta_version":"20210901-204310/v1.11.4-rc3-gf11bc53"},"ram_total":49464,"ram_free":30896,"fs_size":233681,"fs_free":154867,"uptime":1216198}