it would be possible to create a template sensor which does sum up the three phases…
the correct logic based on a sum/subtraction operation (e.g. to calculate the energy returned to the grid and feed it to Home Assistant’s energy system I must 1) sum all the solar production phases, 2) sum all the grid phases taken from the grid, 3) subtract the sum of the grid phases taken from the grid from the sum of the solar production phases. Too complex guys…
So… I would do it like this:
- template:
- sensor: threephase_production
unique_id: threephase_production
device_class: energy
state_class: measurement # I don't know, how the sensor behaves - it might be possible to use "total_increasing"
state: >-
{% set threephase_measurement_production = states('sensor.measurement_phaseA_production') + states('sensor.measurement_phaseB_production') + states('sensor.measurement_phaseC_production') %}
{{ threephase_measurement_production | float(0) | round(2) }}
I would also include an availability check - something like:
availability: >
{{ states('sensor.measurement_phaseA_production') not in ['unknown', 'unavailable', 'None'] }}
{{ states('sensor.measurement_phaseB_production') not in ['unknown', 'unavailable', 'None'] }}
{{ states('sensor.measurement_phaseC_production') not in ['unknown', 'unavailable', 'None'] }}
or
availability: "{{ 'unavailable' not in [ states('sensor.measurement_phaseA_production'), states('sensor.measurement_phaseB_production'), states('sensor.measurement_phaseC_production') ] }}"
But I am a bit unsure about how it should be written…
for calculating the grid “import” - you could go with the solution "calculate sum of production, calculate sum of import - substract …
But you could also do it “per phase”…
But anyway - what Inverter is this?
if it is a 10 year old system - that doesn’t have to say anything I guess
If you can connect to the inverter over ethernet, for example - it should be possible to collect relevant information - also, does it provide some kind of monitoring information like a Web-Portal?
I would really prefer trying to get the data directly from the inverter, rather than working around with other sensors and calculating stuff like this…
This will become hard to maintain at a certain level…