SUN2000 + LUNA2000 Modbus TCP Connection

Hi, i’m a NERD biologist. I am trying to build a logger from zero, without the HomeAssistant support.
My goal is to write some infos into a database and read it with grafana (next steps). The main goal is to build a telegram bot who send you notifications when you’re draining too much current, when the battery is 100% loaded, when you initiate the discharging of the battery, when the battery drains to 0 (and you start draining from the grid.
So there are a lot of things to do :slight_smile:

My setup is SUN2000-6KTL-L1 + LUNA2000 (30kw) + a power meter who read current consumed from the grid, the panels or from the battery (i have a clear diagram into fusionsolar app).
I’ve researched A LOT last 2 days (maybe some infos can be useful for someone else.)
things updated to 05/07/2022 :

  • The Modbus TCP interface is LIMITED to the internal network (adHoc network, estabilished directly with the inverter)
  • You can make a raspberry network bridge to connect it to your LAN (it needs 2 network devices on the raspi) OR as i have made, build a bridge on your Microtik routerboard connected to the adHoc inverter’s network, and then bridge it over your LAN (i have the subnet 192.168.200.x accessible from 192.168.1.x )
  • The port from -i dont know which- fw version has changed to 6607.

my steps:

  • I’ve modded the huawei_solar.py @Emilv2 library to match new port settings (just search for “port=” HERE, there are 2 entries to replace
  • i’ve successful connected to the inverter, and retrieved data. Just to give more infos for needy people:
import huawei_solar_ski
import time

inverter = huawei_solar_ski.HuaweiSolar("192.168.200.1")

state_1= inverter.get("state_1")
state_2= inverter.get("state_2")
state_3= inverter.get("state_3")
alarm_1= inverter.get("alarm_1")
alarm_2= inverter.get("alarm_2")
alarm_3= inverter.get("alarm_3")
input_power= inverter.get("input_power")
day_active_power_peak= inverter.get("day_active_power_peak")
active_power= inverter.get("active_power")

The full list of requests is available in the library code from line 500 HERE.

- THE QUESTION

Since as i don’t have a good background in PV, neither in modbus tcp communication, or in interpreting the variables names from the script…
I need to know:

- Instant produced power from PV

    • How much goes to home consumption
    • How much goes to the battery
    • How much goes to the grid

- Consumption from house (active load balance)

    • How much from the batteries?
    • How much from the grid ?
    • How much from the panels?
  • Battery percentage

I’ve identified some of those vars, but not all.
Hypotetically, the battery and grid values could be positive or negative. I don’t fogure out how they are managed from huawei inverter.

…also i’ve noticed who the registers addresses stored in the library, are completely differents from those documented into the huawei “Modbus interfaces definitions”, where i can extrapolate major infos regarding vars… I’ve tried to create a custom request with those tregister addresses and it fail.
I’ve tried also to search addresses from the python library into the pdf modbus definitions, without success… that’s strange.
The doc refers also to a power meter reading…

inverter.get(“input_power”)
inverter.get(“active_power”) #day_active_power_peak #daily_yield_energy
inverter.get(“storage_unit_1_charge_discharge_power”)
inverter.get(“storage_unit_2_charge_discharge_power”)

inverter.get(“storage_state_of_capacity”)
inverter.get(“power_meter_active_power”)
nverter.get(“storage_current_day_charge_capacity”)
inverter.get(“storage_current_day_discharge_capacity”)

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.