Integration Solar inverter huawei 2000L

Hmm, strange. Can you ping the device from HA? (use the ping integration)

Yes, I can ping (binary_sensor online). I started HA, still the same error in HA log. Then in second windows I tested it with

>>> inverter = huawei_solar.HuaweiSolar('192.168.8.1')
>>> inverter.get("model_name")
Result(value='SUN2000-8KTL-M0', unit=None)

HA is clean with minimal configuration, only Ping and Huawei_solar integration

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123
# Text to speech
tts:
  - platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: 
  - platform: huawei_solar   
    host: 192.168.8.1
binary_sensor:
  - platform: ping
    host: 192.168.8.1
    count: 2
    scan_interval: 60

What happens if you run inverter.get("nb_optimizers") ?

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import huawei_solar
>>> inverter = huawei_solar.HuaweiSolar('192.168.8.1')
>>> inverter.get("nb_optimizers")
could not read register value, is an other device already connected?
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\huawei_solar\huawei_solar.py", line 37, in get
    response = read_register(self.client, reg.register, reg.length)
  File "C:\Python38\lib\site-packages\huawei_solar\huawei_solar.py", line 151, in read_register
    raise ReadException(message)
huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?
>>> inverter.get("model_name")
Result(value='SUN2000-8KTL-M0', unit=None)
>>>

It seems like we’re getting somewhere, I think your device does not support optimizers and instead of returning 0 it just fails.
Any of these that fail?

inverter.get("active_power").value
inverter.get("daily_yield_energy").value
inverter.get("accumulated_yield_energy").value
inverter.get("reactive_power").value
inverter.get("power_factor").value
inverter.get("efficiency").value
inverter.get("grid_voltage").value
inverter.get("grid_current").value
inverter.get("grid_frequency").value
inverter.get("startup_time").value.time()
inverter.get("shutdown_time").value.time()
inverter.get("internal_temperature").value
inverter.get("device_status").value
inverter.get("nb_online_optimizers").value
inverter.get("day_active_power_peak").value

import huawei_solar
inverter = huawei_solar.HuaweiSolar(‘192.168.8.1’)
inverter.get(“active_power”).value
1793
inverter.get(“daily_yield_energy”).value
0.04
inverter.get(“accumulated_yield_energy”).value
31.27
inverter.get(“reactive_power”).value
1
inverter.get(“power_factor”).value
1.0
inverter.get(“efficiency”).value
96.92
inverter.get(“grid_voltage”).value
424.9
inverter.get(“grid_current”).value
2.487
inverter.get(“grid_frequency”).value
49.99
inverter.get(“startup_time”).value.time()
datetime.time(14, 16, 8)
inverter.get(“shutdown_time”).value.time()
datetime.time(18, 11, 39)
inverter.get(“internal_temperature”).value
16.7
inverter.get(“device_status”).value
‘On-grid’
inverter.get(“nb_online_optimizers”).value
could not read register value, is an other device already connected?
Traceback (most recent call last):
File “”, line 1, in
File “C:\Python38\lib\site-packages\huawei_solar\huawei_solar.py”, line 37, in get
response = read_register(self.client, reg.register, reg.length)
File “C:\Python38\lib\site-packages\huawei_solar\huawei_solar.py”, line 151, in read_register
raise ReadException(message)
huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?
inverter.get(“day_active_power_peak”).value
0

I will edit the code so that it assumes 0/NA on a fail. Where do you live that the grid voltage is 425V? :thinking:

Once github is back working again i’ll be trying to use this script as well!!

I would be on that voltage as well as i have a 3phase inverter… Do you think you script will work on that… as i know there is 3 outputs for grid voltage, grid current etc…

It’s not grid voltage, but voltage between L1 and L2. It’s working now, after I commented lines with optimizers in sensor.py. Inverter have L1, L2 and L3 so I will need some modification. Now I know how to do it. Thanks for your help.

Ahhh you have the 3-phase model like me! and my reply above…
So yes we will both need this modifications!

And because of the sun2000 have to be connected directly, I will need another AP in client mode and do some routing to home network or connect second lan cable to NAS. The 502 port looks closed on Smart dongle.

You could ask on the Huawei forum what’s up with that, I don’t think it’s supposed to be like that. They seem to be responsive to questions about firmware issues.

I will edit the integration so that it works on 3 phase and on 1 phase.

I asked them. https://forum.huawei.com/enterprise/en/modbus-tcp-connection-from-home-network-sun2000-8ktl-m0/thread/615790-100027
My English is not perfect but If I correctly understood it is the way it should be.

1 Like

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