Integration Solar inverter huawei 2000L

I’ve been working on exposing some parameters as configurable entities in Home Assistant. My primary use case would be to make it possible to set the “Maximum Discharge Power” for my LUNA2000 battery from Home Assistant. This would allow me to adjust the power output of the battery dynamically based on other inputs.

Example use case: in Belgium, you are taxed on peak usage, starting when you draw more than 2.5kW from the grid for a certain time. I would like to create an automation that sets the “Maximum Discharging Power” for my battery to “Current Grid Power Usage (in W) - 2500W”.

However, while the register is mentioned as being read/writeable in the Modbus Interface Definitions document, I’m receiving a “Permission denied” error (0x80) when trying to write to it.

Support is letting me know that the function is not available at the moment :frowning: :

For everyone who would also be interested in using this function: Please send a mail to Huawei support to ask for this functionality!

An example mail:

Dear,

I want to use the Modbus-interface on my inverter to dynamically set the maximum discharging power of my LUNA2000 battery.
The Modbus Interface Definitions state that register 47077 is RW. However, when I try to write a value to this register, I get the error code 0x80, which means “No permission”?

My inverter SN: HVxxx
Battery SN: BTyyy

1 Like

Thank you for the explanation

Great to hear that you are actively working on the integration. Do you think that there is a way to extract data from 2 inverters? My inverters are slave 1 and 16, but the existing integrations can only read data from 1 inverter. I’m currently using a mix of the integration from this thread and the kiosk integration, but being able to read data from both inverters would really be great.

I’m not familiar with how two inverters are interconnected with each other.

What I do know is that it is possible to configure the modbus unit to which requests are sent by setting the 4th parameter in the configuration screen to the proper number:

image

With 2 inverters, one inverter is the master and the other the slave. The dongle is plugged into the master inverter (and in my case also a battery is plugged into the master inverter). So it is possible to reach both inverters via Modbus TCP of the dongle on a single IP address. In my case when connecting to 192.168.20.190:502 with a slave id of 1, I get the data from the second inverter (the slave). When I connect to 192.168.20.190:502 with a slave id of 16, then I get the data from the master inverter. The data from the master inverter also includes the data from the smart meter and the battery. I would really love to dig into the code, but I’m not familiar with Python at all…
One question in that regard: Is the slave id necessery to initialize the connection to the modbus interface of the dongle? Or does the integration connect with the IP and the port and then just listens on that port for any information that is published (which in the case of 2 inverters would mean that data from both inverters is published and could therefore be used with a single connection)?

It’s the default value, just in case the provided value is not parseable

Yupe, just noticed this… and seems in the newest firmware (SPC140) the ModBus port for internal AP has changed from TCP/502 to TCP/6607…

>>> import huawei_solar
>>> inverter = huawei_solar.HuaweiSolar('192.168.200.1', port=6607, slave=0)
>>> inverter.get("system_time").value
datetime.datetime(2022, 1, 13, 20, 53, 29, tzinfo=<UTC>)
1 Like

I have tried your integration and Emilv2’s and I’m not yet being able to configure the Energy dashboard correctly.
I have some sensors available but some others (defined in the same yaml) not, it is a very frustrating process.
I’ll give yours another try before giving up.

Hi again trying to get this working .

But getting many error message on connecting to inverter ?

This error originated from a custom integration.

Logger: custom_components.huawei_solar.sensor
Source: custom_components/huawei_solar/sensor.py:185
Integration: huawei_solar (documentation)
First occurred: 12 January 2022, 14:14:17 (1 occurrences)
Last logged: 12 January 2022, 14:14:17

could not connect to Huawei inverter: failed to connect to device, is the host correct?

But when im using nmcli con show i can see that its connected but still getting thoose errors ??

Logger: pymodbus.client.asynchronous.async_io
Source: /usr/local/lib/python3.9/site-packages/pymodbus/client/asynchronous/async_io/__init__.py:307
First occurred: 15:41:17 (9 occurrences)
Last logged: 15:41:47

Failed to connect: [Errno 111] Connect call failed ('192.168.200.1', 502)
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py:416
First occurred: 15:41:22 (1 occurrences)
Last logged: 15:41:22

failed to connect to device, is the host correct?
NoneType: None

I have SPC 124 on the dongle and SPC140 on the inverter could that be any problem ??

Anyone else that having this kind of trouble ?

It was posted yesterday.

is there any way to change the port back to old ?
have you managed to get this working ??

is there a fix on its way do you know that ?

You can go back to older firmware or you can edit file huawei_solar.py (src/huawei_solar/huawei_solar.py · master · Emil Vanherp / HuaweiSolar · GitLab) it should be somewhere in your system and changing port to 6607. This file is used by this integration.

I have homeassistant OS so i cant find it by the file editor .

Is there any other way ?
im not that good on this

I often receive a warning like:
Update of sensor.sun2000_6ktl_l1_xxx is taking over 10 seconds
Is there any eventual configuration I could work on to speed up the updates? this is because I would like to have a more frequent update but if it is often overcoming 10 secs it’s impossible.
I’m wondering whether this slowness may depend from CPU, network, or other causes. Ideas?
Thanks.

If you want faster updates you should think about connecting directly to internal AP.

So, is it not solved by adding the integration 2 times: once with slave 1 and once with slave 16?

What is the problem that you are currently facing by doing it this way?

I made a Pull Request to Emilv2 repo for the “port=” parameter, but you can also manually update sensor.py file.

1 Like

best friends,

I finally managed to read the data from my HUAWEI inverter (in an unusual way ?).

HUAWEI 17KTL-M0 / V100R001C00SPC140
SDdongleA-05 / V100R001C00SPC123

I connected an ELFIN EW11A to the MODBUS.

pin 1 485A1-1 to connector A of the EW11A
Pin 2 485B1-1 to connector B of the EW11A

I was only able to make the connection after removing the dongle.

Now I actually still want to forward my data to the fusion solar cloud.
But I suspect that if I plug the dongle back,no more data goes to HA.
I don’t understand why I can’t do it via the dongle.

At V100R001C00SPC123 the MODBUS is on by default I understand.
If I install SPC124 or > I have to enable it via an android app according to the description.
I have an iPhone where the option to switch on modbus is not present… :unamused:.

According to the helpdesk of HUAWEI:
The modbus could be switched on via the fusion solar cloud at the end of the month…

Does anyone have any ideas for me to still get data to HA and Fusion Solar Cloud through the dongle?
I have no knowledge of this and managed it to read and try it out.
Your help is much appreciated

I do not understand it at all.
My configuration:

HUAWEI 17KTL-M0 / V100R001C00SPC140
SD dongleA-05 / V100R001C00SPC123
And I can’t get it done.
Is it the combination of the inverter firmware and the dongle firmware?
I have now temporarily solved it differently, but I am not satisfied with that solution.