Incorrect display of solar energy and battery storage in energy dashboard

The energy dashboard also displays the battery discharge as solar energy.
As a result, the graph still shows solar energy during the hours that the solar panels are not active.
The total value shown is therefore doubled.
The system apparently cannot tell the difference between energy from the solar panels and the energy supplied by the battery.
Does anyone have an idea how to fix this?

Hi Jeffrey,

I am in the same boat as you, having a SUN2000KTL3.2 and thinking about obtaining a LUNA2000/LUNA5000 if it can be integrated into home assistant.

So i delved into the possibilities and found out, that the only way to obtain separate values is over the modbus which is (or is not, if disabled by the installation company) exposed over the RS485 bus of the SUN2000 or over the HOTSPOT wifi link. I have succeeded in a working connection over wifi and my installation company is not willing to help me out. Since i know the reset procedure, i could easily get access to it, but then my warranty expires as the product owner.

For now i have workaround with a shelly EM and 50A clamp (https://www.robbshop.nl/shelly-em-energiemeter-wifi) in the Phase of the AC outlet of the SUN2000, directly installed in my utility cabinet. That way i can see the total output of my TOTAL solar system on that phase in home assistant.

The values obtained are stored in a helper file that switches between the 2 entities depending on another sensor mounted on the south side of my house, which provides light intensity in LUX/LUMEN. When the light level goes below 20 LUX (values has to be found out empirically for you situation) the helper file switches to night mode. Hence the power returned to the grit is send to another helper sensor representing the battery (either loading or returning power to the grit) which can be chosen in your energy setup.

The only problem arises when the battery start recharging during day when the solar panels start producing, since the difference is measured as a net result from the shelly EM. I have not yet found a solution for that since the high voltage lanes from the battery and the SUN2000 are DC instead of AC.

The final solution would be to get access to the modbus of the SUN2000, which i intend to do next year anyway when my SUN2000’s warranty expires.

Kind regards,
Wil

1 Like

Hi Wil,
Thank you for your reply.
Would you mind sharing your code for this workaround.
Thanks in advance!
Jeffrey

Hi jeffrey,

  • For now i don’t have a perfect solution (over the modbus, as explained) but here is link how to enable modbus: MODBUS TCP Guide - Huawei Enterprise Support Community . You need installer access to enable modbus TCP.
  • to access the modbus directly in a convenient way there is a node-red node: node-red-contrib-modbustcp (node) - Node-RED
  • The workaround i use atm does not need coding, just add 2 helpers to calculate as explained which can be added to the energy dasboard, with the help of the shelby 50A modules.

Ones my warranty expires of the sun2000 i wil reset and start coding the modbus for a better integration, sooner if my serviceprovider of the solar systems grants access sooner. Maybe obtaining the LUNA modules from them would be the carrot to get that done?

Meanwhile you can contact me (mostly on weekends) over discord in HA as dutchfish or mail me at ‘pd4z at amsat dot org’

Regards,
Wil

Thanks for your reply.
I Also have the warranty issue, so I won’t be using the modbus anytime soon.
It is a pity that we cannot measure the power of the solar panels and the battery because it’s DC.
I actually expected that these would be entities in the SUN2000 integration.
That would have been a lot easier and more practical.

Update: I thought this was the solution, but the solar panel values appear to be incorrect. Back to the drawing board… (its Kwh instead of Kw)

I have found another solution.
The Sun2000 also displays the voltage and current of the 2 solar panel strings.
I multiplied these values together (P=U*I) and divide the result by 1000 (from W to Kw)
I also made utility meters that ensure that we have a daily measurement.
I have added the entities of this in the energy dashboard.
As far as I can see now, this works fine

Sensors: (entities\sensors\zon.yaml)


##############################################
##     VERMOGEN ZONNEPANELEN STRINGS        ##
##############################################

- platform: template
  sensors:
     zon_opbrengst_string_01:
       friendly_name: "Zon opbrengst string 1"
       unit_of_measurement: kWh
       unique_id: 'zon_opbrengst_string_01'
       value_template: >
         {{ '%0.2f' | format (states('sensor.pv_1_voltage') | float(0) *  
                                      states('sensor.pv_1_current') | float(0)/1000 ) }}

     zon_opbrengst_string_02:
       friendly_name: "Zon opbrengst string 2"
       unit_of_measurement: kWh
       unique_id: 'zon_opbrengst_string_02'
       value_template: >
         {{ '%0.2f' | format (states('sensor.pv_2_voltage') | float(0) *  
                                        states('sensor.pv_2_current') | float(0)/1000 ) }}

     zon_tot_opbrengst:
       friendly_name: "Totale opbrengst zonnepanelen"
       unit_of_measurement: kWh
       unique_id: 'zon_tot_opbrengst'
       value_template: >
         {{ (states('sensor.zon_opbrengst_string_01')|float(0) +
                                        states('sensor.zon_opbrengst_string_02')|float(0))|round(2) }}

Utility meter (entities\utility_meters\zonnepanelen.yaml)

tot_opbrengst_zonnepanelen_dag:
  source: sensor.zon_tot_opbrengst
  cycle: daily

tot_opbrengst_zonnepanelen_week:
  source: sensor.zon_tot_opbrengst
  cycle: weekly

tot_opbrengst_zonnepanelen_maand:
  source: sensor.zon_tot_opbrengst
  cycle: monthly

tot_opbrengst_zonnepanelen_jaar:
  source: sensor.zon_tot_opbrengst
  cycle: yearly

string1_opbrengst_zonnepanelen_dag:
  source: sensor.zon_opbrengst_string_01
  cycle: daily

string1_opbrengst_zonnepanelen_week:
  source: sensor.zon_opbrengst_string_01
  cycle: weekly

string1_opbrengst_zonnepanelen_maand:
  source: sensor.zon_opbrengst_string_01
  cycle: monthly

string1_opbrengst_zonnepanelen_jaar:
  source: sensor.zon_opbrengst_string_01
  cycle: yearly

string2_opbrengst_zonnepanelen_dag:
  source: sensor.zon_opbrengst_string_02
  cycle: daily

string2_opbrengst_zonnepanelen_week:
  source: sensor.zon_opbrengst_string_02
  cycle: weekly

string2_opbrengst_zonnepanelen_maand:
  source: sensor.zon_opbrengst_string_02
  cycle: monthly

string2_opbrengst_zonnepanelen_jaar:
  source: sensor.zon_opbrengst_string_02
  cycle: yearly


Customizations\zonnepanelen.yaml

sensor.zon_opbrengst_string_01:
  state_class: total_increasing
  device_class: energy
  icon: mdi:solar-power
  last_reset: '1970-01-01T00:00:00+00:00'
sensor.zon_opbrengst_string_02:
  state_class: total_increasing
  device_class: energy
  icon: mdi:solar-power
  last_reset: '1970-01-01T00:00:00+00:00'
sensor.zon_tot_opbrengst:
  state_class: total_increasing
  device_class: energy
  icon: mdi:solar-power
  last_reset: '1970-01-01T00:00:00+00:00'