Integration Solar inverter huawei 2000L

@ligeza thanks for letting me know, sorry wasn’t able to read every single post. I really thought I was on to something :innocent:

Hopefully it can be integrated in the plugin.

Hi guys and welcome in this forum!
This thread is a valuable repository of knowledge about connecting to the SUN2000 inverter, so now I am able to monitor my SUN2000 inverter with hard.
I just want to share that If someone is struggling in configuring a router for accessing SUN2000 internal WiFi (especially using DD-WRT) I think that my blogpost can help with this:
https://skyboo.net/2021/07/how-to-connect-to-sun2000-from-dd-wrt/

regards!

1 Like

I have added a slave option to the component, you can now set the option slave : 1 to make this work.

3 Likes

When you click Device Management and select a Dongle there is a Reset button/switch. Is this for dongle reboot ? If so - then maybe it will be sufficient to click this after firmware upgrade?

@manio Yes! Reset is what I used and then it took a while to come back, but it did.

@Emilv2 thanks a lot! You’re awesome :+1:

I just updated my dongle to fw V100R001C00SPC122 using Upgrade Management from FusionSolar web interface. Thanks @andro1 for this info! :slight_smile:
I just Added entry for dongle upgrade, it went with progress from 0
100% and then I’ve got ‘Delayed’ status, but after several minutes it just automatically restarted the dongle without my intervention and it changed to ‘Success’

After this I’ve got:

PORT    STATE SERVICE
502/tcp open  mbap

So I’ve changed slave address to 1 and recompiled hard, and here are the resulting query times before and after:

2021-07-31, 06:10:52.968 [INFO] sun2000: read 65 parameters [⏱ 3529 ms]
2021-07-31, 06:10:56.537 [INFO] sun2000: read 65 parameters [⏱ 3478 ms]
2021-07-31, 06:11:00.126 [INFO] sun2000: read 65 parameters [⏱ 3523 ms]
2021-07-31, 06:11:03.923 [INFO] sun2000: read 65 parameters [⏱ 3614 ms]
2021-07-31, 06:11:07.543 [INFO] sun2000: read 65 parameters [⏱ 3561 ms]
2021-07-31, 06:11:11.213 [INFO] sun2000: read 65 parameters [⏱ 3551 ms]
2021-07-31, 06:11:14.659 [INFO] sun2000: read 65 parameters [⏱ 3353 ms]
2021-07-31, 06:11:18.341 [INFO] sun2000: read 65 parameters [⏱ 3569 ms]
2021-07-31, 06:11:22.034 [INFO] sun2000: read 65 parameters [⏱ 3594 ms]
2021-07-31, 06:11:25.507 [INFO] sun2000: read 65 parameters [⏱ 3390 ms]
2021-07-31, 06:11:29.022 [INFO] sun2000: read 65 parameters [⏱ 3403 ms]
2021-07-31, 06:11:32.665 [INFO] sun2000: read 65 parameters [⏱ 3525 ms]
2021-07-31, 06:11:36.320 [INFO] sun2000: read 65 parameters [⏱ 3567 ms]
2021-07-31, 06:11:39.908 [INFO] sun2000: read 65 parameters [⏱ 3466 ms]
2021-07-31, 06:11:43.558 [INFO] sun2000: read 65 parameters [⏱ 3549 ms]
2021-07-31, 06:11:47.148 [INFO] sun2000: read 65 parameters [⏱ 3526 ms]
2021-07-31, 06:11:50.646 [INFO] sun2000: read 65 parameters [⏱ 3412 ms]
2021-07-31, 06:11:54.135 [INFO] sun2000: read 65 parameters [⏱ 3446 ms]
2021-07-31, 06:11:57.927 [INFO] sun2000: read 65 parameters [⏱ 3685 ms]
2021-07-31, 06:12:01.505 [INFO] sun2000: read 65 parameters [⏱ 3485 ms]
2021-07-31, 06:12:05.152 [INFO] sun2000: read 65 parameters [⏱ 3487 ms]
2021-07-31, 06:12:08.666 [INFO] sun2000: read 65 parameters [⏱ 3421 ms]
2021-07-31, 06:12:12.329 [INFO] sun2000: read 65 parameters [⏱ 3574 ms]
2021-07-31, 06:12:15.905 [INFO] sun2000: read 65 parameters [⏱ 3492 ms]
2021-07-31, 06:12:19.510 [INFO] sun2000: read 65 parameters [⏱ 3508 ms]
2021-07-31, 06:12:23.216 [INFO] sun2000: read 65 parameters [⏱ 3613 ms]
2021-07-31, 06:12:26.774 [INFO] sun2000: read 65 parameters [⏱ 3459 ms]
2021-07-31, 06:12:30.371 [INFO] sun2000: read 65 parameters [⏱ 3556 ms]
2021-07-31, 06:12:34.056 [INFO] sun2000: read 65 parameters [⏱ 3588 ms]
2021-07-31, 06:12:37.678 [INFO] sun2000: read 65 parameters [⏱ 3539 ms]
2021-07-31, 06:12:37.820 [INFO] đŸš© hard terminated, daemon running time: 12h 36m 37s 682ms 850us 685ns
2021-07-31, 06:14:22.817 [INFO] sun2000: read 7 parameters [⏱ 1376 ms]
2021-07-31, 06:14:34.461 [INFO] sun2000: read 65 parameters [⏱ 11643 ms]
2021-07-31, 06:14:46.595 [INFO] sun2000: read 65 parameters [⏱ 12043 ms]
2021-07-31, 06:14:58.600 [INFO] sun2000: read 65 parameters [⏱ 11909 ms]
2021-07-31, 06:15:10.968 [INFO] sun2000: read 65 parameters [⏱ 12285 ms]
2021-07-31, 06:15:23.784 [INFO] sun2000: read 65 parameters [⏱ 12721 ms]
2021-07-31, 06:15:35.139 [INFO] sun2000: read 65 parameters [⏱ 11264 ms]
2021-07-31, 06:15:47.366 [INFO] sun2000: read 65 parameters [⏱ 12135 ms]
2021-07-31, 06:15:59.577 [INFO] sun2000: read 65 parameters [⏱ 12157 ms]
2021-07-31, 06:16:11.582 [INFO] sun2000: read 65 parameters [⏱ 11926 ms]
2021-07-31, 06:16:24.280 [INFO] sun2000: read 65 parameters [⏱ 12603 ms]
2021-07-31, 06:16:36.450 [INFO] sun2000: read 65 parameters [⏱ 12070 ms]
2021-07-31, 06:16:48.426 [INFO] sun2000: read 65 parameters [⏱ 11868 ms]
2021-07-31, 06:17:00.012 [INFO] sun2000: read 65 parameters [⏱ 11496 ms]
2021-07-31, 06:17:12.342 [INFO] sun2000: read 65 parameters [⏱ 12232 ms]
2021-07-31, 06:17:24.728 [INFO] sun2000: read 65 parameters [⏱ 12322 ms]
2021-07-31, 06:17:36.696 [INFO] sun2000: read 65 parameters [⏱ 11878 ms]
2021-07-31, 06:17:48.263 [INFO] sun2000: read 65 parameters [⏱ 11466 ms]

As you can clearly see: reading 65 parameters via internal WiFi tooks about 3.5 sec, while doing the same with WLAN-FE dongle took about 12 secs, so roughly 4 times slower!! :frowning:

Do you guys have similar behavior?
Is it because the Dongle is constantly sending data to FusionSolar?

I reinstalled the hacs plugin, but I can’t test just yet.
I still doesn’t work for me for some reason, keep getting the same error “another device connected?”
It works perfectly over the hass native modbus though. (I disabled modbus while testing this plugin)

  - platform: huawei_solar   
    host: '192.168.1.55'
    optimizers: false
    battery: false
    slave: 1
Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, 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 263, in get
    response = self.read_register(reg.register, reg.length)
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 310, in read_register
    raise ReadException(message)
huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?

@Emilv2
For me is also not working, but if I set slave=1 as default

    def __init__(self, host, port="502", timeout=5, loop=None, slave=1):

then it is working.

I can add

sensor:
  - platform: huawei_solar   
    host: '192.168.5.83'
    slave : 0

and it’s still working, so maybe there is problem with passing value.

1 Like

That was indeed the issue, it should be fixed in the latest version.

1 Like

@Emilv2 Thanks for the fix, indeed it’s working.
Altough there is a bug, I think. If I inspect the object returned by the plugin, I see that “active_power” attribute is completely missing:

model_id: 428
serial_number: Hxxxxx
nb_pv_strings: 2
rated_power: 8000
grid_standard: VDE-AR-N-4105
grid_country: Germany
daily_yield: 0.72
total_yield: 85.17
grid_voltage: 424.3
grid_current: 1.012
line_voltage_A_B: 424.3
line_voltage_B_C: 429.7
line_voltage_C_A: 428.1
phase_A_voltage: 249
phase_B_voltage: 243.8
phase_C_voltage: 247.6
phase_A_current: 1.012
phase_B_current: 1.026
phase_C_current: 1.016
day_active_power_peak: 0
reactive_power: 0
power_factor: 1
efficiency: 94.97
grid_frequency: 49.98
power_meter_active_power: 0
input_power: 776
grid_A_voltage: 0
grid_B_voltage: 0
grid_C_voltage: 0
active_grid_A_current: 0
active_grid_B_current: 0
active_grid_C_current: 0
active_grid_power_factor: 0
active_grid_frequency: 0
grid_exported_energy: 21474836.47
grid_accumulated_energy: 21474836.47
active_grid_A_B_voltage: 0
active_grid_B_C_voltage: 0
active_grid_C_A_voltage: 0
active_grid_A_power: 0
active_grid_B_power: 0
active_grid_C_power: 0
startup_time: '04:31:38'
shutdown_time: '19:07:14'
internal_temperature: 46.6
device_status: On-grid
nb_optimizers: 0
system_time: '2021-08-01T06:54:29+00:00'
pv_string_01_voltage: 195.2
pv_string_01_current: 2.83
pv_string_02_voltage: 345.1
pv_string_02_current: 0.55
unit_of_measurement: W
friendly_name: SUN2000-8KTL-M1
icon: mdi:solar-power

Here it seems to have the correct register assigned to it:

And I can read it successfully from the inverter via direct modbus connection, like this:

modbus:
  - name: Huawei Solar
    type: tcp
    host: 192.168.1.55
    port: 502
    delay: 2
    sensors:
      - name: HuaweiActivePower
        slave: 1
        address: 32080
        unit_of_measurement: W
        data_type: int
        count: 2
        scale: 1
        precision: 1
        scan_interval: 20

Active power is the value of entity


1 Like

Haha :upside_down_face:, thanks guys! My bad.

2021-08-01 08:01:20 ERROR (MainThread) [homeassistant.setup] Setup failed for homeass: Integration not found.

What is integration homeass?

2021-08-01 08:01:20 ERROR (MainThread) [homeassistant.components.http] Failed to create HTTP server at port 8123: [Errno 98] error while attempting to bind on address (’::’, 8123, 0, 0): address already in use

Seems like home assistant is already running, I don’t think your problem has anything to do with the huawei_solar integration.

Jak mogę wyciągnąć napięcie na fazach? :slight_smile: dziękuję za pomoc :slight_smile:

Jeƛli uĆŒywasz integracji od @Emilv2 to w atrybutach masz napięcie na falowniku

Phase A voltage: 246.5
Phase B voltage: 247.3
Phase C voltage: 245.9

Jeƛli posiadasz rĂłwnieĆŒ miernik to moĆŒesz odczytać rĂłwnieĆŒ napięcie na mierniku:

Grid A voltage: 235.8
Grid B voltage: 241.1
Grid C voltage: 241.8

Jeƛli uĆŒywasz integracji modbus to wtedy odczytujesz odpowiednie rejestry:

    "phase_A_voltage": RegisterDefinitions("u16", "V", 10, 32069, 1),
    "phase_B_voltage": RegisterDefinitions("u16", "V", 10, 32070, 1),
    "phase_C_voltage": RegisterDefinitions("u16", "V", 10, 32071, 1),

    "grid_A_voltage": RegisterDefinitions("i32", "V", 10, 37101, 2),
    "grid_B_voltage": RegisterDefinitions("i32", "V", 10, 37103, 2),
    "grid_C_voltage": RegisterDefinitions("i32", "V", 10, 37105, 2),

Oczywiƛcie pod integracje modbus musisz sobie odpowiednio te dane sformatować.

Anyone have the 3000L version working?
What is need (if something) in the logger so this integration works?

@Emilv2 Thanks for the fix :clap: :clap:
my SUN2000 is now workig with Dongle LAN cable (slave: 1 option)

For me is important to have 1sec data update to active power and meter power
Direct modbus can do that

Your integration seems to have a 30sec inverter data request


Is there any kind of parameter to change de update frequency

Thanks a lot for all

Hi @gfpinto I have same problem (Integration Solar inverter huawei 2000L - #533 by manio) and I am not aware of any solution :frowning:

Hi, i have the sun2000-10ktl-m1 and try also to set this up, but i always get the error:
have someone a hint how can i adapt it to make it work?
My Setup: connected with the raspi wifi adapter to the sun2000 direct wlan, homeassistant running in a docker container

Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:130
Integration: Sensor (documentation, issues)
First occurred: 22:32:38 (1 occurrences)
Last logged: 22:32:38

Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 293, in read_register
    response = self.client.read_holding_registers(
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 109, in execute
    return self.transaction.execute(request)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 174, in execute
    response, last_exception = self._transact(
  File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 293, in _transact
    result = self._recv(response_length, full)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 325, in _recv
    read_min = self.client.framer.recvPacket(min_size)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
    return self.client.recv(size)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 89, in recv
    return self._recv(size)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 298, in _recv
    return self._handle_abrupt_socket_close(
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 343, in _handle_abrupt_socket_close
    raise ConnectionException(msg)
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.200.1:502): Connection unexpectedly closed 0.000080 seconds into read of 8 bytes without response from unit before it closed connection

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, 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 298, in read_register
    raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.200.1:502): Connection unexpectedly closed 0.000080 seconds into read of 8 bytes without response from unit before it closed connection

I usually use the App connected to the Fusion Solar website rather than directly to the inverter.
That’s fine while the integration is running.
Usually if I try to connect directly while the integration is running I’ll get a device already connected error from the App.
What is interesting is that during a period when the integration couldn’t connect I tried to connect the App and it also got a cannot connect, please try later error, rather than the device already connected message.
Something going wrong on the inverter side perhaps.