Integration Solar inverter huawei 2000L

In this respect, the resolution aimed by huawei is 0.001 kW, or indeed 1W.
I was puzzeled how @MicheleMercuri was able to have a 5012,7W indication…

If you are reading the register is Watt then it should be a Integer, if you are reading it in kW then it should be a float with precision 3, no ?

1 Like

@ligeza @Emilv2 guys your help is required again. I moved from SD card to SSD and since then I can’t connect to the inverter in HA. I have the same configuration in the SD card and if I use the SD card everything starts working fine again.
I can successfully ping the inverter but it not populating.

image
image


Initial lines of code In configuration.yaml

sensor solar:
  - platform: huawei_solar   
    host: '192.168.200.1'
    optimizers: false
    battery: false
  - platform: template
    sensors:
      pv_input_power:
        friendly_name: "DC Production"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'W'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'input_power') }}"

The only difference I remember is a version of emilys integration. On sd card it was 2485325 and on SSD it is a97aed

Probably you are using the wrong port : 502 vs 6607 or you have more than 1 device connected to the Inverter AP. You can also try to swich OFF and ON the Inverter : DC switch to OFF and AC Circuit breaker OFF for couple of minutes then both back to ON. Wait for Inverter to reboot completely.

Hi,
I am about to order solar panels and Huawei 8KTL M1 inverter with battery. I have read through this forum roughly but count really find an answer to my question.

Is it possible from Home Assistant to change setting for battery charging? I mean if I have hourly rate I want to charge the battery directly from the external electrical net if the price is good enough. Especially wintertime here in Sweden when the solar panels won´t give enough. So maybe charge if the rate is what Tibber (where I buy the power) classify CHEAP or VERY CHEAP and change the setting to consume from battery when they classify the power as EXPENSIVE or VERY EXPENSIVE. The Tibber integration is no problem. I only wonder if I can send commands to change how Huawei act to charge the battery?

I’ve reverse engineered the login sequence to get write access to the required modbus registers to support this. It’s not unthinkable that Huawei changes the login sequence and breaks my implementation, but for the foreseeable future it should work.

I also plan to test using a direct wired connection to the RS485_1 pins which does not need the reverse engineered login process.

Another thing you need to be aware of: there are non-neglible standby losses of around 60W when you let your battery just do nothing while it is charged. (tested by setting "Maximum discharging power to 0W and watching the SOC of the battery drop). My guess is that this is due to all the electronics that stay online and ready to discharge in the battery and inverter. Also for low loads (<300W) - which is a typical household baseline usage - the efficiency is pretty poor (<90%), cfr the efficiency diagrams of the inverter that you are planning to buy.

Best to take this into account to calculate if charging on the cheaper times/discharging on the expensive times is worth the trouble.

1 Like

Still having problem with this integration - connected through Dongle IP (dongle connected to my wifi). After restart it works for some time (1-10min) and then all sensors shows ‘unavailable’ here’s error:

This error originated from a custom integration.

Logger: custom_components.huawei_solar
Source: helpers/update_coordinator.py:219
Integration: Huawei Solar
First occurred: 10:38:32 (4 occurrences)
Last logged: 10:48:34

Error fetching HV20B0094425_data_update_coordinator data: Could not update HV20B0094425 values: Got error while reading from register 32064 with length 52: Exception Response(131, 3, SlaveFailure)
Error fetching HV20B0094425_data_upda
Preformatted textte_coordinator data: Could not update HV20B0094425 values: Got error while reading from register 32016 with length 4: Exception Response(131, 3, SlaveFailure)
Error fetching HV20B0094425_data_update_coordinator data: Could not update HV20B0094425 values: Could not read register value, has another device interrupted the connection?

My wifi signal is good, so it’s not this…
UPDATE: I switched off RS485 communication device, and it’s fine for 30 minutes now, looks like you can’t read via serial and modbus TCP at the same time (firmware dongle 127, inverter 141)

I have the same experience as you.

How did you disable RS485 communication?

I switched off unit that connects through RS485, not inverter (don’t think you can)

Hi There, can somebody help me on understanding why I’m not able to add the real time entity (as the Input Power" to the energy panel?

Power (kW) is not energy (kWh)

So this card will never works as expected right?
image

Not with Input Power (Watt or kW)

You can calculate kWh from kW if you want.
(I posted something about this before)

PS : If you have a battery then the Daily Solar Yield indicated by the huawei portal isn’t correct by the end of the day (at least in my opinion). They show a calculation using the battery and this calculation shows a decrease in Solar Yield even after sunset… (??? ) It’s acceptable just until sunset when Input Power becomes 0 kW. The decrease afterwards is due to the calculation using the battery and the losses involved with retrieving and storing the energy
After having about 1MWh energy goring through my battery, I can see that the losses are about 7-8%.
Those percentages will appear between the Daily Solar Yield at sunset (0W power) and Midnight (actualy sunrise, but you can’t verify this on the portal → check the Discharge vs daily energy yield at sunrise). They ‘hide’ those losses in the Solar Yield because one can’t argue against the sun…

3 Likes

Hello everybody

Today they completed the installation of all inverters, batteries, etc …

I can ping the inverter to the address 192.168.200.1 through a wire connection.

I wanted to ask you what are the main steps to start the connection … in the discussion there are many examples but very fragmented, so I was wondering if someone could explain me the first steps to get something similar …
Grazie a tutti…

immagine

1 Like

it started after I moved from SD card to SSD, which is strange because I was only using the backup from sd card. I think I should try the dongle method.
here is the latest error from logs

Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:135
Integration: Sensor (documentation, issues)
First occurred: 11:46:36 AM (1 occurrences)
Last logged: 11:46:36 AM

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 303, 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 108, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]

During handling of the above exception, another exception occurred:

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 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/huawei_solar/sensor.py", line 120, in setup_platform
    HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])
  File "/config/custom_components/huawei_solar/sensor.py", line 135, in __init__
    self._name = self._inverter.get("model_name").value
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 275, in get
    response = self.read_register(reg.register, reg.length)
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 308, in read_register
    raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]
`

progress progress port issue

Logger: homeassistant.config
Source: config.py:454
First occurred: 8:26:48 PM (1 occurrences)
Last logged: 8:26:48 PM

Invalid config for [sensor.huawei_solar]: [port] is an invalid option for [sensor.huawei_solar]. Check: sensor.huawei_solar->port. (See /config/configuration.yaml, line 25). Please check the docs at https://github.com/Emilv2/huawei_solar

changing port to 502 same error

Logger: homeassistant.config
Source: config.py:454
First occurred: 8:39:43 PM (1 occurrences)
Last logged: 8:39:43 PM

Invalid config for [sensor.huawei_solar]: [port] is an invalid option for [sensor.huawei_solar]. Check: sensor.huawei_solar->port. (See /config/configuration.yaml, line 25). Please check the docs at https://github.com/Emilv2/huawei_solar

WTH
now sensor is a invalid option

Logger: homeassistant.config
Source: config.py:454
First occurred: 9:13:07 PM (1 occurrences)
Last logged: 9:13:07 PM

Invalid config for [sensor.huawei_solar]: [sensors] is an invalid option for [sensor.huawei_solar]. Check: sensor.huawei_solar->sensors. (See /config/configuration.yaml, line 25). Please check the docs at https://github.com/Emilv2/huawei_solar

tried using TCP method with following code


# Modbus
modbus:
  name: SolarSun2000
  type: tcp
  host: 192.168.18.239 (this being the IP of dongle)
  port: 502
  delay: 10
  close_comm_on_error: true
  retry_on_empty: true
  retries: 10
  sensors:
    - name: Input Power
      device_class: power
      unit_of_measurement: kW
      count: 2
      address: 32064
      data_type: int32
      scale: 0.001
      precision: 3

got this error

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:291
Integration: Modbus (documentation, issues)
First occurred: 10:07:30 PM (1 occurrences)
Last logged: 10:07:30 PM

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

and setting in inverter.


Try Port 6607

You can choose to add the Integration (great work !) via HACS or build it yourself with only the things you need…

Just to see if you can get something out of the Inverter, add this to your configuration.yaml :

# Modbus
modbus:
  name: SolarSun2000
  type: tcp
  host: 192.168.200.1
  port: 6607
  delay: 10
  close_comm_on_error: true
  retry_on_empty: true
  retries: 10
  sensors:
    - name: Input Power
      device_class: power
      unit_of_measurement: kW
      count: 2
      address: 32064
      data_type: int32
      scale: 0.001
      precision: 3

You should get a sensor Input Power giving you a reading…

If this works, you can add more registers to the modbus or remove it and add the Integration…

On port 6607 it fails to connect

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:291
Integration: Modbus (documentation, issues)
First occurred: 10:46:39 PM (1 occurrences)
Last logged: 10:46:39 PM

Pymodbus: SolarSun2000: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.18.239:6607)]

another error with 6607

Logger: pymodbus.client.sync
Source: /usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py:218
First occurred: 10:46:12 PM (14 occurrences)
Last logged: 10:49:39 PM

Connection to (192.168.18.239, 6607) failed: [Errno 111] Connection refused

same error continues

Logger: pymodbus.client.sync
Source: /usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py:218
First occurred: 10:46:12 PM (35 occurrences)
Last logged: 10:54:55 PM

Connection to (192.168.18.239, 6607) failed: [Errno 111] Connection refused
Connection to (192.168.18.239, 6607) failed: timed out

I would suggest following the guide on GitHub - wlcrs/huawei_solar: Home Assistant integration for Huawei Solar inverters via ModbusTCP . Please let me know if you think that some steps are unclear.