That is weird since it’s exactly what my integration does. What happens if you directly use the HuaweiSolar package in python? Install HuaweiSolar through pypi and run this:
>>> import huawei_solar
>>> inverter = HuaweiSolar('192.168.8.1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'HuaweiSolar' is not defined
>>> inverter = huawei_solar('192.168.8.1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
2020-04-23 11:59:01 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform huawei_solar is taking over 10 seconds.
2020-04-23 11:59:06 ERROR (SyncWorker_1) [huawei_solar.huawei_solar] could not read register value, is an other device already connected?
2020-04-23 11:59:06 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\homeassistant\helpers\entity_platform.py", line 178, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "C:\Python38\lib\asyncio\tasks.py", line 483, in wait_for
return fut.result()
File "C:\Python38\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\ligez\AppData\Roaming\.homeassistant\custom_components\huawei_solar\sensor.py", line 61, in setup_platform
entities.append(HuaweiSolarSensor(inverter))
File "C:\Users\ligez\AppData\Roaming\.homeassistant\custom_components\huawei_solar\sensor.py", line 80, in __init__
self._nb_optimizers = self._inverter.get("nb_optimizers").value
File "C:\Users\ligez\AppData\Roaming\.homeassistant\deps\Python38\site-packages\huawei_solar\huawei_solar.py", line 37, in get
response = read_register(self.client, reg.register, reg.length)
File "C:\Users\ligez\AppData\Roaming\.homeassistant\deps\Python38\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?
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?
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.
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 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?