Integration Solar inverter huawei 2000L

I don’t think it is, on my device it works just fine by connecting via the ip address it gets from my router. Lets see if they say anything else. What do you mean by smart dongle?

Inverter has build in wifi working as Access point and you can only change password. If you want connect it to internet you need extra adapter (smart dongle). With this you can connect it to home network. So you have 2 wifi adapters in inverter (one is build in and second is external). Manual page 5 https://solar.huawei.com/en-GB/download?p=%2F-%2Fmedia%2FSolar%2Fattachment%2Fpdf%2Fau%2Fservice%2Fcommercial%2FSUN2000-8-20KTL-M0-User_Manual.pdf

Ah, my SUN2000L 3KTL doesn’t have that so the difference may lie there

I had some problems in that folder…
Now is working!

Thanks you, well done :slight_smile:

I have a SUN2000L 3KTL, same as Rafal, and I’m searching for a possibility to query live data from the inverter. I got an OpenAPI account for FusionSolar but this is not really handy as the number of requests per day are limited. Also it does not provide you that much information.

I also checked the IP of the WIFI dongle of the inverter in my router but the port 502 is not open. I can connect to the integrated Wifi with my mobile but no idea if that could be used somehow…

I have HA on ubuntu (LXC in QNAP). I have router whitch I don’t use. I flashed it with dd-wrt then setup it as gateway (wifi is connected to integrated sun2000 wifi) and conected it with lan cable to home network. It looks like:
Sun2000(192.168.8.1) —wifi–> router(192.168.8.8) —lan—> router(192.168.5.1).
On ubuntu I added to network card second IP address so HA can connect to internet and sun2000 at the same time.

I can see the value both on huawei app which connects directly to Inverter (local lan and real time) and on Huawei app/website which connect to eu5.fusionsolar.huawei.com (and is 5 minutes later…)

I have already looked at eu.fusion cloud connection with a user with api grant (and some CURL POST); but they are not real time as your module (wow!!!) and i haven’t found that info…(i will check your link too)

Anyway… thank you
Bye

The code should work now for 3 phase and missing optimizer data

Great work, I think there will be more people interested in your integration. I already made some changes using you code. Today because to high Voltage in grid (all day over 255V) I don’t have live data that’s why there is a lot of “0” but today morning everything worked perfect. Do you have any data in “day active power peak”?

Yes, day active active power peak works for me. I think you have an older model so maybe it doesn’t support that feature. If you have overvoltage, can you check if the alarm code in huawei_solar works correct? I haven’t had the chance to check that feature. inverter.get(“alarm_1”) should return [Alarm("Grid Overvoltage", 2034, "Major")] in that case.

>>> inverter.get("active_power")
Result(value=7294, unit='W')
>>> inverter.get("grid_code")
Result(value=GridCode(standard='VDE-AR-N-4105', country='Germany'), unit='grid_enum')
>>> inverter.get("power_meter_active_power")
Result(value=3764, unit='W')
>>> inverter.get("alarm_1")
Result(value=[], unit=None)
>>> inverter.get("power_meter_active_power")
Result(value=-278, unit='W')
>>> inverter.get("power_meter_active_power")
Result(value=-320, unit='W')
>>> inverter.get("day_active_power_peak")
Result(value=0, unit='W')
>>>

I tested inverter.get(“alarm_1”)
It is possible to read power consumption with “inverter.get(“power_meter_active_power”)” if smart meter is connected to inverter.

@ligeza pointed out to me that there also are some undocumented registers, does the latest version have the values you want?

Yes it has!!! :star_struck:

power_meter_active_power: -304

it’s night and i’m buying energy, but it works!

Tomorrow i will check better with the Sun, but i’m confident

ps:thank you, i was going to but a PZEM-016 etc…etc…

thank you Emilv2 and ligeza too!!
:muscle:

Hi there guys. Impressive skills you show here I must say. I have some experience with Python and running OctoPrint in my Pi (for 3D printers), but I’m inspired by your work. I’d like to mimic your stuff to connect to my SUN2000 8KTL M0 (software version V100R001C00SPC120). Rafal explained connecting to the wifi dongle using a router as a gateway. So you are not using a RS485 cable from inverter to USB into Pi? So do I need an extra router for that?

Yes that’s right. I’m not using any cable. I’m connected wireless to SUN2000 8KTL M0. The extra router is used because my inverter is in garage and for this integration you must be directly connected to internal sun2000 wifi (192.168.8.1). If it is possible to connect to Pi wifi adapter and you are in range of inverters wifi, then you do not need extra router.
My integration

3 Likes

Hello all, can anybody please help me?

I copied all the files to /config/custom_components/huawei_solar/

Then add the following to /config/configuration.yaml:

sensor:
  - platform: huawei_solar
    host: '192.168.0.20'

Then got this error in LOG:

2020-05-09 08:40:26 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 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/huawei_solar/sensor.py", line 78, in setup_platform
    entities.append(HuaweiSolarSensor(inverter))
  File "/config/custom_components/huawei_solar/sensor.py", line 101, in __init__
    tmp = self._inverter.get("grid_code").value
  File "/usr/local/lib/python3.7/site-packages/huawei_solar/huawei_solar.py", line 49, in get
    result = GRID_CODES[tmp]
KeyError: 92

What is your inverter model? If it has two wifi networks then you should connect to internal wifi (default 192.168.8.1)

Was struggling to find the IP address of my inverter. IP scanners didn’t pick up in anything but then realized I should first be connected with the internal WiFi of the inverter. I used the iPhone app “FusionHome” for that, as there is an option to scan the QR code on the inverter sticker. Should you forget the password of the inverter you can retrieve it via this function btw. (Standard it is “Changeme”). As my iPhone is not able to connect however the app gives you the function to copy the password. Paste that in a note and you have it.

I used those details to connect with the WiFi outside of the app and got in. Clicking details of the WiFi connected on my iPhone I got the IP. Which indeed is 192.168.8.1.

To test I connected my pc to the inverter SSID which is SUN2000-HVxxxxxxxxxx (should show up if you are near the inverter)

Using code:

>>> import huawei_solar
>>> inverter = huawei_solar.HuaweiSolar(‘192.168.8.3’)
>>> inverter.get(“model_name”)

I got a positive response! Thanks for the help guys. Will be configuring a new Pi tomorrow and try and get things going there. Excited!

I didn’t get to adding your country to the grid codes, I’ll fix it later today.

1 Like

@alexspires With the latest version on github it should work now