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 }}