Integration Solar inverter huawei 2000L

For me it’s working OK. SUN2000-8KTL-M0, firmware in smart dongle *120.

model_id: 405
serial_number: xxx
nb_pv_strings: 2
rated_power: 8000
grid_standard: VDE-AR-N-4105
grid_country: Germany
daily_yield: 0
total_yield: 12944.11
grid_voltage: 0
grid_current: 0
line_voltage_A_B: 0
line_voltage_B_C: 0
line_voltage_C_A: 0
phase_A_voltage: 0
phase_B_voltage: 0
phase_C_voltage: 0
phase_A_current: 0
phase_B_current: 0
phase_C_current: 0
day_active_power_peak: 0
reactive_power: 0
power_factor: 0
efficiency: 0
grid_frequency: 0
power_meter_active_power: -333
input_power: 0
grid_A_voltage: 233.8
grid_B_voltage: 233.6
grid_C_voltage: 233.8
active_grid_A_current: -1.67
active_grid_B_current: -0.85
active_grid_C_current: -0.55
active_grid_power_factor: -0.469
active_grid_frequency: 50
grid_exported_energy: 8933.58
grid_accumulated_energy: 5072.79
active_grid_A_B_voltage: 405.2
active_grid_B_C_voltage: 405.1
active_grid_C_A_voltage: 405.2
active_grid_A_power: -260
active_grid_B_power: -67
active_grid_C_power: -9
startup_time: '05:22:35'
shutdown_time: '18:31:52'
internal_temperature: 0
device_status: 'Standby: no irradiation'
nb_optimizers: 0
system_time: '2021-09-08T23:40:08+00:00'
pv_string_01_voltage: 0
pv_string_01_current: 0
pv_string_02_voltage: 0
pv_string_02_current: 0
unit_of_measurement: W
friendly_name: SUN2000-8KTL-M0
icon: mdi:solar-power

I’ve some problem setting up the integration
if i try curl -v 192.168.1.248:502
SOLAR 2000 reply
Connected to 192.168.1.248 (192.168.1.248) port 502 (#0)

GET / HTTP/1.1
Host: 192.168.1.248:502
User-Agent: curl/7.78.0
Accept: /

but in log i see

Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/huawei_solar/sensor.py", line 115, in setup_platform
    HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])
  File "/config/custom_components/huawei_solar/sensor.py", line 130, in __init__
    self._name = self._inverter.get("model_name").value
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 265, in get
    response = self.read_register(reg.register, reg.length)
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 312, in read_register
    raise ReadException(message)
huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?

Inverter model SUN2000-4KTL-L1
firmware V200R001C00SPC112
MBUS V100R001C00SPC300

can someone help me?

First of all a big thank you to @Emilv2 and all others who have worked on this and helping out.

I have two SUN2000-4KTL-L1 and after a bit of struggle I have the now connected to HA on their LAN IP and it working good (at least for the last 24hrs).

One thing I can see is that all values are not on both inverters. Some values are just on one.

Has anyone else more than one inverter and has the templates already done on adding the values together :slight_smile: and are willing to share?

I have seen that some of you use a nice card with the flow on, what card is that?

  1. grid_exported_energy <–this must be the total amount of exported.

How can I get what I have exported today?
My grid_exported_energy value is now 142.8 and at the same time the web is telling me that I have exported 9.66 today

How do I get the todays numer or do I need to take current value minus yesterdays value that I need to store somewhere ?

You can use utility meter:

utility_meter:
  daily_exported:
    source: sensor.grid_exported_energy
    cycle: daily

You can do the same if you want monthly or yearly. Just change cycle.

1 Like

Hello.

I use Modbus tcp and I don’t have exported energy address

I search the huawei protocol definitions and I didn’t find it.

Anyone can share the export energy address in Modbus communication?

I have export/import power Watt (address: 37113)

I need Total Exported… And Total Imported…
Nothing in kWh

Other way… Anyone knows if I can have Modbus and costume-component at the same time?
Both communications simultaneously?

Thanks

"grid_exported_energy": RegisterDefinitions("i32", "kWh", 100, 37119, 2),
"grid_accumulated_energy": RegisterDefinitions("u32", "kWh", 100, 37121, 2),

You can have Modbus and custom component at the same time but not connected to inverter AP (only one connection is possible). So you need to use also LAN connected to smart dongle to have second integration. I tested it and no problem if one integration is connected to AP and second is using LAN cable.

Hello Rafal.
Unfortunately I can’t figure out how to use the data downloaded by the ETH dongle.
I now have integration and connect to the Inverter via the Inverter AP. For this I have a bridge made on the RPI.
Now i want to download data directly from dongl ETH.
I have this entry in config:
modbus:

  • name: Solar
    type: tcp
    host: 192.168.3.182
    port: 502
    sensors:
    • name: Solar SunPower
      slave: 1
      address: 32080
      unit_of_measurement: W
      data_type: int
      count: 2
      scale: 1
      precision: 1
      scan_interval: 10
      Everything is OK I have an entity that gives the current solar production.
      How do I get the other data? Such as the daily production of voltages and currents etc
      PS. you can write in Polish…

You have to add more sensors.

name: Solar
type: tcp
host: 192.168.3.182
port: 502
sensors:
  - name: Solar SunPower
    slave: 1
    address: 32080
    unit_of_measurement: W
    data_type: int
    count: 2
    scale: 1
    precision: 1
    scan_interval: 10
 -  name: Solar InputPower
    slave: 1
    address: 32064
    unit_of_measurement: W
    data_type: int
    count: 2
    scale: 1
    precision: 1
    scan_interval: 10

So you have to know, address, data type, etc for every sensor you want to add. This data you can read from src/huawei_solar/huawei_solar.py · master · Emil Vanherp / HuaweiSolar · GitLab

OK, all clear now. Thank you very much for the link.
Regards
Michal

Thank you for you quick reply

I’ve been busy trying to get my inverter working but sadly no results yet.

I’ve asked my installer to update the firmware of the ethernet dongle so he has updated it to the latest version (V100R001C00SPC123). Since I dont have any wifi recepton where the inverter is located i’m keen on using the ethernet cable.
Now since the update i’m able to get the curl command to display some output and ping is working but modbus connection does not seem te be working.
afbeelding

I’ve tried the platform: huawei_solar and the direct modbus approach but it all gets stuck on no connection.

Pymodbus: Solar: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

or

021-09-14 08:14:37 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform huawei_solar is taking over 10 seconds.
2021-09-14 08:15:04 ERROR (SyncWorker_2) [huawei_solar.huawei_solar] could not read register value, is an other device already connected?
2021-09-14 08:15:04 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/huawei_solar/sensor.py", line 115, in setup_platform
HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])
File "/config/custom_components/huawei_solar/sensor.py", line 130, in __init__
self._name = self._inverter.get("model_name").value
File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 265, in get
response = self.read_register(reg.register, reg.length)
File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 312, in read_register
raise ReadException(message)
huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?

I’ve tried setting the slave to 1 or 0 but neither seem to work, also i’ve restarted the whole inverter several times to make sure I didn’t keep an test connection open with curl.
Is there anything else I can try?

What is your config? Maybe there is some mistake.

modbus:
  - name: Solar
    type: tcp
    host: 192.168.1.13
    port: 502
    sensors:
      - name: Solar SunPower
        slave: 1
        address: 32080
        unit_of_measurement: W
        data_type: int
        count: 2
        scale: 1
        precision: 1
        scan_interval: 30    

This is my huawei_solar configuration

sensor:
  - platform: huawei_solar
    host: "192.168.1.13"
    optimizers: false
    battery: false
    slave: 1

and this is my modbus configuration

modbus:
  - name: Solar
    type: tcp
    host: 192.168.1.13
    port: 502
    sensors:
      - name: Solar SunPower
        slave: 1
        address: 32080
        unit_of_measurement: W
        data_type: int
        count: 2
        scale: 1
        precision: 1
        scan_interval: 30    

I think I’ve copy pasted it from an older post of you :slight_smile:
Every time I test i comment out one method or delete it to make sure they are not both active at the same time.

how i can retrieve all the attribute from the inverter?
i don’t use modbus because i’vbe undestand that i can only use one connection at time: platform or modbus right?

Can you try read data using python?

sudo pip3 install huawei-solar==1.1.0
python3
import huawei_solar
inverter = huawei_solar.HuaweiSolar('192.168.1.13',502,5,3,1)
inverter.get("model_name")

Hmm it really seems that the inverter is not listening to modbus at all, maybe they disabled the modbus again in this new version??

As far as I know SPC123 should work correctly. Maybe there is another device connected. Did you try from other PC? Maybe something is blocking traffic on this port.

Very strange, i’ve indeed checked from the home assistant host and an virtual ubuntu on my laptop and the same results it cannot connect.

This evening I had a time to get close to the inverter (it is at our new house still in construction) and I connected my laptop to the SUN2000 wifi. Then doing your command I managed to get output.

afbeelding
Thanks for the tip, i’ll see if I can rule out that some other “thing” is connecting to modbus by putting the rj45 cable direct in my laptop. Just have to find an ethernet to usb cable since these new laptops don’t have rj45 anymore :stuck_out_tongue:

OK So far I have benefited from your help. Now maybe I can help someone.
I attach a configuration entry containing all the most necessary entities with solar production data.
modbus:

  • name: Solar
    type: tcp
    host: 192.168.3.182 (change to the IP address of your inverter)
    port: 502
    sensors:
    • name: active_power
      slave: 1
      address: 32080
      unit_of_measurement: W
      data_type: int
      count: 2
      scale: 1
      precision: 1
      scan_interval: 10
    • name: input_power
      slave: 1
      address: 32064
      unit_of_measurement: W
      data_type: int
      count: 2
      scale: 1
      precision: 1
      scan_interval: 10
    • name: day_active_power_peak
      slave: 1
      address: 32078
      unit_of_measurement: W
      data_type: int
      count: 2
      scale: 1
      precision: 1
      scan_interval: 10
    • name: pv_01_voltage
      slave: 1
      address: 32016
      unit_of_measurement: V
      data_type: uint16
      count: 1
      scale: 0.1
      precision: 2
      scan_interval: 10
    • name: pv_01_current
      slave: 1
      address: 32017
      unit_of_measurement: A
      data_type: uint16
      count: 1
      scale: 0.01
      precision: 2
      scan_interval: 10
    • name: pv_02_voltage
      slave: 1
      address: 32018
      unit_of_measurement: V
      data_type: uint16
      count: 1
      scale: 0.1
      precision: 2
      scan_interval: 10
    • name: pv_02_current
      slave: 1
      address: 32019
      unit_of_measurement: A
      data_type: uint16
      count: 1
      scale: 0.01
      precision: 2
      scan_interval: 10
    • name: phase_A_voltage
      slave: 1
      address: 32069
      unit_of_measurement: V
      data_type: uint16
      count: 1
      scale: 0.1
      precision: 2
      scan_interval: 10
    • name: phase_B_voltage
      slave: 1
      address: 32070
      unit_of_measurement: V
      data_type: uint16
      count: 1
      scale: 0.1
      precision: 2
      scan_interval: 10
    • name: phase_C_voltage
      slave: 1
      address: 32071
      unit_of_measurement: V
      data_type: uint16
      count: 1
      scale: 0.1
      precision: 1
      scan_interval: 10
    • name: phase_A_current
      slave: 1
      address: 32072
      unit_of_measurement: A
      data_type: int
      count: 2
      scale: 0.001
      precision: 3
      scan_interval: 10
    • name: phase_B_current
      slave: 1
      address: 32074
      unit_of_measurement: A
      data_type: int
      count: 2
      scale: 0.001
      precision: 3
      scan_interval: 10
    • name: phase_C_current
      slave: 1
      address: 32076
      unit_of_measurement: A
      data_type: int
      count: 2
      scale: 0.001
      precision: 3
      scan_interval: 10
    • name: accumulated_yield_energy
      slave: 1
      address: 32106
      unit_of_measurement: kWh
      data_type: int
      count: 2
      scale: 0.01
      precision: 1
      scan_interval: 10
    • name: daily_yield
      slave: 1
      address: 32114
      unit_of_measurement: kWh
      data_type: int
      count: 2
      scale: 0.01
      precision: 2
      scan_interval: 10
3 Likes