I live in a very old house and the wiring is not the newest.
I found out that the power supply system is a TN-C system. Does the shelly 3em work with this kind of system?
I live in a very old house and the wiring is not the newest.
I found out that the power supply system is a TN-C system. Does the shelly 3em work with this kind of system?
Since the most complete version is somewhere in this thread, here is my solution after going through the whole discussion:
template:
- sensor:
- name: "Energy Total"
unique_id: energy_total
state: >-
{{
[ states('sensor.shellyem3_channel_a_energy'),
states('sensor.shellyem3_channel_b_energy'),
states('sensor.shellyem3_channel_c_energy'),
] | map('float') | sum
}}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >-
{{
[ states('sensor.shellyem3_channel_a_energy'),
states('sensor.shellyem3_channel_b_energy'),
states('sensor.shellyem3_channel_c_energy'),
] | map('is_number') | min
}}
- name: "Power Total"
unique_id: power_total
state: >-
{{
[ states('sensor.shellyem3_channel_a_power'),
states('sensor.shellyem3_channel_b_power'),
states('sensor.shellyem3_channel_c_power'),
] | map('float') | sum
}}
unit_of_measurement: W
device_class: power
state_class: measurement
availability: >-
{{
[ states('sensor.shellyem3_channel_a_power'),
states('sensor.shellyem3_channel_b_power'),
states('sensor.shellyem3_channel_c_power'),
] | map('is_number') | min
}}
- name: "Current Total"
unique_id: current_total
state: >-
{{
[ states('sensor.shellyem3_channel_a_current'),
states('sensor.shellyem3_channel_b_current'),
states('sensor.shellyem3_channel_c_current'),
] | map('float') | sum
}}
unit_of_measurement: A
device_class: current
state_class: measurement
availability: >-
{{
[ states('sensor.shellyem3_channel_a_current'),
states('sensor.shellyem3_channel_b_current'),
states('sensor.shellyem3_channel_c_current'),
] | map('is_number') | min
}}
When copying and pasting exactly this, I get “Unavailable” for all sensors. Anybody an idea why?
I don’t see anything related to that anywhere (Logbook, History etc). The Shelly 3EM itself is working fine in HA, also the energy board.
Hope you solved it by now. If not: Did you make sure to adjust sensor.shellyem3_channel_
to your setup? Search the entities for 3em
to find the correct naming.
Thanks, yes. It took me a while but I solved it.
What was it? My Shelly 3em sensors were named slightly different than the above
So one really has to pay attention and not just assume that all will be named identical
I live in US (Colorado), hence two phase electricity, and I have a 3.2 kW PV grid-tied system. The solar inverter feeds through a sub-panel into the main service panel. I have an inverter/charger on that sub-panel, along with crucial circuits, so if the grid goes down I can still run those circuits from solar and batteries. I placed channels A and B of my new EM3 around the main panel service feeds, and channel C around one of the solar feeds.
For power calculations, I sum A and B for grid power and double the value of C for solar power (power output of the solar inverter is the same on each phase). All power is a combination of grid and solar power. For power factor, I average A and B for the house’s power factor. solar power factor is in there for completeness but isn’t really useful.
For energy calculations, I map channel C twice for all energy, and A and B for grid energy. Energy returned is a map of A and B; the solar inverter never runs backward. Incidentally, when I first put in the system in 2009, the local power company didn’t yet have a digital meter that could count backwards, so for awhile I had the old-fashioned kind with a wheel that could spin either way. I sort of miss that.
Below is the template file I wrote, based on the templates I’ve read in this thread. I would appreciate keen eyes checking it; it reads as valid and loads but I haven’t set up the energy monitor. I would also appreciate suggestions in using the values in energy monitor. I pay a straight value for each kWh and the utility pays me the same for returned energy. As always, thanks for any help.
- sensor:
- name: "All Power Total"
unique_id: all_power_total
state: >-
{{ (states('sensor.shellyem3_channel_a_power')|float +
states('sensor.shellyem3_channel_b_power')|float +
(states('sensor.shellyem3_channel_c_power')|float * 2)) }}
unit_of_measurement: W
device_class: power
state_class: measurement
availability: >
{{ not 'unavailable' in
[ states('sensor.shellyem3_channel_a_power'),
states('sensor.shellyem3_channel_b_power'),
states('sensor.shellyem3_channel_c_power') ] }}
- name: "Grid Power Total"
unique_id: grid_power_total
state: >-
{{ (states('sensor.shellyem3_channel_a_power')|float +
states('sensor.shellyem3_channel_b_power')|float) }}
unit_of_measurement: W
device_class: power
state_class: measurement
availability: >
{{ not 'unavailable' in
[ states('sensor.shellyem3_channel_a_power'),
states('sensor.shellyem3_channel_b_power') ] }}
- name: "Solar Power Total"
unique_id: solar_power_total
state: >-
{{ (states('sensor.shellyem3_channel_c_power')|float * 2) }}
unit_of_measurement: W
device_class: power
state_class: measurement
availability: >
{{ not 'unavailable' in
[ states('sensor.shellyem3_channel_c_power') ] }}
- name: "Grid Power Factor Total"
unique_id: grid_power_factor_total
state: >-
{{ ((states('sensor.shellyem3_channel_a_power_factor')|float +
states('sensor.shellyem3_channel_b_power_factor')|float)) / 2 | int }}
unit_of_measurement: "%"
device_class: power_factor
state_class: measurement
availability: >
{{ not 'unavailable' in
[ states('sensor.shellyem3_channel_a_power_factor'),
states('sensor.shellyem3_channel_b_power_factor') ] }}
- name: "Solar Power Factor Total"
unique_id: solar_power_factor_total
state: >-
{{ (states('sensor.shellyem3_channel_c_power_factor')|float ) | int }}
unit_of_measurement: "%"
device_class: power_factor
state_class: measurement
availability: >
{{ not 'unavailable' in
[ states('sensor.shellyem3_channel_c_power_factor') ] }}
- name: "All Energy Total"
unique_id: all_energy_total
state: >-
{{ [ states('sensor.shellyem3_channel_a_energy'),
states('sensor.shellyem3_channel_b_energy'),
states('sensor.shellyem3_channel_c_energy'),
states('sensor.shellyem3_channel_c_energy'),
] | map('float') | sum }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >-
{{ [ states('sensor.shellyem3_channel_a_energy'),
states('sensor.shellyem3_channel_b_energy'),
states('sensor.shellyem3_channel_c_energy'),
] | map('is_number') | min }}
- name: "Grid Energy Total"
unique_id: grid_energy_total
state: >-
{{ [ states('sensor.shellyem3_channel_a_energy'),
states('sensor.shellyem3_channel_b_energy'),
] | map('float') | sum }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >-
{{ [ states('sensor.shellyem3_channel_a_energy'),
states('sensor.shellyem3_channel_b_energy'),
] | map('is_number') | min }}
- name: "Grid Energy Returned Total"
unique_id: grid_energy_returned_total
state: >-
{{ [ states('sensor.shellyem3_channel_a_energy_returned'),
states('sensor.shellyem3_channel_b_energy_returned'),
] | map('float') | sum }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >-
{{ [ states('sensor.shellyem3_channel_a_energy_returned'),
states('sensor.shellyem3_channel_b_energy_returned'),
] | map('is_number') | min }}
- name: "Solar Energy Total"
unique_id: solar_energy_total
state: >-
{{ [ states('sensor.shellyem3_channel_c_energy'),
states('sensor.shellyem3_channel_c_energy'),
] | map('float') | sum }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >-
{{ [ states('sensor.shellyem3_channel_c_energy'),
] | map('is_number') | min }}
When using this I get a message that state_class is not allowed. How did you solve this?
Witam
Udalo ci sie aktywowac ten 4 zacisk Shelly Em3
Niestety nie… nawet nie znalazłem żadnej infimrmacji o tym jak to naprawdę działa ani jak to wykorzystac w innych systemach Dead end…
Hi @modernhistorian ,
I have a similar situation in Australia. I have a 3-Phase meter box + Shelly EM3 + 5KW inverter. The energy provider does net metering per/sec so I don’t need the details of all the phases just net results.
My .YAML game is poor I need some help, as i am getting an error for the following code (it’s a Frenstein’s monster from your original code)
sensor:
Merging 3-phase power memter to a single sensor [Shelly 3EM 3-phases Energy sensor - #130 by modernhistorian]
name: “All Power Total”
unique_id: bsct_sen_3em_power
state: >-
{{ (states(‘sensor.bsct_sen_3em_channel_a_power’)|float +
states('sensor.bsct_sen_3em_channel_b_power')|float + (states('sensor.bsct_sen_3em_channel_c_power')|float )) }}
unit_of_measurement: W
device_class: power
state_class: measurement
availability: >
{{ not 'unavailable' in [ states('sensor.bsct_sen_3em_channel_a_power'), states('sensor.bsct_sen_3em_channel_b_power'), states('sensor.bsct_sen_3em_channel_c_power') ] }}
name: “All Energy Total”
unique_id: bsct_sen_3em_energy
state: >-
{{ [ states(‘sensor.bsct_sen_3em_channel_a_energy’),
states('sensor.bsct_sen_3em_channel_b_energy'), states('sensor.bsct_sen_3em_channel_c_energy'), states('sensor.bsct_sen_3em_channel_c_energy'), ] | map('float') | sum }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: “1970-01-01T00:00:00+00:00”
availability: >-
{{ [ states('sensor.bsct_sen_3em_channel_a_energy'), states('sensor.bsct_sen_3em_channel_b_energy'), states('sensor.bsct_sen_3em_channel_c_energy'), ] | map('is_number') | min }}
I am getting the following error
The first thing I see is that you didn’t declare a platform, in this case template. That’s not needed in mine because they’re in a file called templates.yaml which is marked included in configuration.yaml. So write this:
sensor:
- platform: template
name: "All Power Total"
and so on. Remove the dashes in front of names, line them up, and re-check. I don’t think this will eliminate all errors (I can’t see line 2), but post remaining errors and the referenced lines in configutation. By the way, I think that the state_class: total_increasing no longer uses the last_reset attribute, so you can remove those lines. I have. One more thing: where are the shelly clamps mounted?
Czesc mirekmal
W najnowszej wersji shelly 3EM jest mozliwosc dodania czwartego transformatora na N neutralny kabel.
Trzeba tylko transformator zalozyc na jedna z faz i przeprowadzic kalibracje faz w panelu tam też w ustawieniach ustawiamy czułość domyslnie 1A. Po wszystkim przepinamy transformator z powrotem na linie N i mamy w panelu info o neutralnym. Nie widzę tego sensora w Home Assistant ale niewiem czy powinien sie sam dodac czy coś trzeba jeszcze zrobić.
In the new shelly 3EM version it is possible to add a fourth transformer to the N neutral cable.
You just need to put it on one of the phases and calibrate the phases in the panel, there also set the default sensitivity to 1A in the settings. After all, we reconnect the transformer back to the N line and we have info about the neutral in the panel
To naprawde dobra wiadomość! Właśnie i u mnie pojawiła się nowa werska firmware i też już widzę możliwość przeprowadzenia kalibracji. Pewnie jutro, w wolnej chwili się tym zajmę. Dam znać jak postępy!
Ok, cool i am giving that a go. no error so far
I have the clamps on my main 3-phases, not 100% where that is internally… had an electrician install it for me a while back. Why is that?
This is what i see, if that helps
after I get this working I’ll be trying to group the light (PowerCalc) entities, just to make things a bit more meaningful
So a quick question:
If I got the 3EM and set it up it would tell me the total amperage across the three phases?
Would that then mean I could use this to influence the Lux single phase inverter if I could hack the register for the Ct clamp and create an automation?
Or is there any point or product that would allow the Lux Ct cable to plug into to take this reading back to the inverter as if it was the Ct clamp doing it?
Just a quick question, is it possible to disconnect/connect power with Shelly 3EM? I would like to control when to charge my car based on the electricity price. I have not found suitable smart plug for that as regular plugs do not fit to my 3 phase socket.
Shelly 3EM has integrated relay output which can be used for contactor control.
However I wouldn’t recommend a contactor for switching EV charging, as the load can be quite large.
A better approach would be to control the charging rate either directly in the car (Tesla Custom Integration - Charging Amps adjust via LoveLace or control an OCPP Server Plugin for linking electric car chargers!
Yes BUT, probably best to control it in the car. Most of not ALL cars have this feature - what vehicle do you have? Manu chargers have the feature too.
OpenEVSE is good for the hacker type.
Staring the charger is OK with the contactor but disconnecting will arc and spark the contractor.
Hey @modernhistorian ,
So this code is working
This is the read-out on devtools, which is what i was hoping for as an outcome
My next question is how do i convert this from a template to an entity?
Ideally, I will be adding this to the energy dashboard to replace the initial 3 phases for hourly snapshots. But, I also seek live data for my dashboard
I am sure this is fairly basic now there is a template. I just don’t understand, can you please help?