CT placement for correct Energy Integration

I am running 2022.5.5 on a Pi and SSD, I have an EmonTX with EmonTx3CM and four CT value sets (Power (W) and Energy (kWh)). What is the correct connection arrangement of my CTs to provide the right view of my system. The options I have don’t seem to work,
CT on Solar feed cable (Solar_Energy) as “Solar production”
CT on main fuse cable (Grid_energy) as “Grid consumption” complains of negative values when Solar > House when sun is shining.
Same CT on main fuse cable (Grid_energy) as “Return to grid” complains of negative values when Solar < House as Grid energy is negative at night and shows grid use.
or
CT on Solar feed cable (Solar_Energy) as “Solar production”
CT on consumer unit feed to RCDs (House_Energy) as “Grid consumption”
CT on main fuse cable (Grid_energy) as “Return to grid” complains of negative values when Solar < House as Grid energy is negative at night and positive when solar > house use?
or
Use Energy templates to create missing values?
Any ideas?
Thanks

I’ve tried to look over the instructions for the device you have, its confusing… it sounds like you’ve installed correctly… I have a similar device, called Sense energy monitor… here is a pic of my CT placements… the 2 white CTs in the upper right, are both legs of my PV solar system… the 2 white CTs at the bottom center are both legs of my utility feed…

my device does produce a positive number for solar production… but I do recall that when I installed it, my readings were negative and the options were to swap the CT legs OR the device support staff had the control to reverse the legs within settings of the device… but the number of Watts should be positive from the CTs…

hope that helps you…

Thanks for the response, I think I have a working version now…
I have:
CT on House demand wires and EmonTx provides W and Wh mqtt values
CT on Solar generation wires and EmonTx provides W and Wh mqtt values
I want…
Daily Solar generation in kWh
Daily House use in kWh
Daily Saved in kWh (Solar energy used by house use)
Daily Export in kWh (surplus energy exported back to the grid)

So I create Sensor template Saved Power (W)
where Saved Power = Solar when House > Solar
and Saved Power = House when Solar > House

And I create Sensor template Export Power (W)
where Export Power (W) = Solar - House when Solar > House else 0

I then use “Integration” to convert Power to Energy
Then use “Utility Meter” to convert Energy to Daily Energy count

The HA Energy Dashboard is then populated with:
Grid consumption = House Energy
Return to grid = Export Energy
Solar production = Solar Energy

Code as follows, (grid = house in the code below):

  • platform: mqtt # Solar Energy
    name: Solar Energy
    state_topic: “emon/E4”
    state_class: total_increasing
    device_class: energy
    unit_of_measurement: “kWh”
    value_template: “{{ value|float(default=0)/1000|round(3) }}”

  • platform: mqtt # Solar Power
    name: Solar Power
    state_topic: “emon/P4”
    state_class: measurement
    device_class: power
    unit_of_measurement: “W”
    value_template: “{{ value|float(0)|abs|round(-1,‘floor’) }}”

  • platform: mqtt # Grid Energy
    name: Grid Energy
    state_topic: “emon/E1”
    state_class: total_increasing
    device_class: energy
    unit_of_measurement: “kWh”
    value_template: “{{ value|float(default=0)/1000|round(3) }}”

  • platform: mqtt # Grid Power
    name: Grid Power
    state_topic: “emon/P1”
    state_class: measurement
    device_class: power
    unit_of_measurement: “W”
    value_template: “{{ value|float(default=0) }}”

  • platform: template # Power / Energy sums
    sensors:
    export_power: # Export Power
    friendly_name: “Export Power”
    device_class: power
    unit_of_measurement: ‘W’
    value_template: >
    {% if states(“sensor.solar_power”)|float(0) > states(“sensor.grid_power”)|float(0) %}
    {{(states(“sensor.solar_power”)|float(0) - states(“sensor.grid_power”)|float(0))|round(3)}}
    {% else %}
    {{(states (‘0.0’)|float(0))|round(3) }}
    {% endif %}

    saved_power: # Saved Power
    friendly_name: “Saved Power”
    device_class: power
    unit_of_measurement: “W”
    value_template: >
    {% if states(“sensor.solar_power”)|float(0) > states(“sensor.grid_power”)|float(0) %}
    {{ (states(“sensor.grid_power”)|float(0)) }}
    {% else %}
    {{ (states(“sensor.solar_power”)|float(0)) }}
    {% endif %}

  • platform: integration # Export Power to Energy integration
    name: Export Int Energy
    source: sensor.export_power
    unit_prefix: k
    unit_time: h
    round: 4

  • platform: integration # Saved Power to Energy integration
    name: Saved Int Energy
    source: sensor.saved_power
    unit_prefix: k
    unit_time: h
    round: 4

utility_meter:
daily_solar_energy:
name: Daily Solar Energy
source: sensor.solar_energy
cycle: daily
daily_grid_energy:
name: Daily Grid Energy
source: sensor.grid_energy
cycle: daily
daily_export_int_energy:
name: Daily Export Int Energy
source: sensor.export_int_energy
cycle: daily
daily_saved_int_energy:
name: Daily Saved Int Energy
source: sensor.saved_int_energy
cycle: daily

Hope this helps other people trying to solve this…