Integration Solar inverter huawei 2000L

Do anyone experiencing problems after updating to Home Assistant 0.110.1?

Now I get this Log:

Translation Error: The intl string context variable "Level" was not provided to the string "Detalhes do log ({Level})"
Logger: homeassistant.config
Source: custom_components/huawei_solar/sensor.py:4 
First occurred: 19:37:46 (1 occurrences) 
Last logged: 19:37:46

Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 777, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 273, in get_platform
    f"{self.pkg_path}.{platform_name}"
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/huawei_solar/sensor.py", line 4, in <module>
    from huawei_solar import HuaweiSolar, ReadException
ModuleNotFoundError: No module named 'huawei_solar'

I’m not sure what is causing this, I think you can fix it for now by commenting out (adding # in front of it) all the _LOGGER lines.

Whoop whoop! You solved it. Many thanks for your help! I’ve got my sensor set up now as you can see in my pic

. Will start building a dashboard in Lovelace now. Hoping I can mimic yours. Should keep me busy for a while!

Another question: how do you store data long term? As rules in the Netherlands will change in ‘23 (no longer able to net the power bought with the power returned to the network) I probably need to look into hooking up a battery. For this I want to have enough historical data to make a return analysis based on period averages as well as intraday profile of power usage and generation from my panels. So what would be the application best used for building a local database?

I’m useing influx in HA.

influxdb:
  host: 192.168.5.75
  database: hass
  max_retries: 3
  include:
    domains:
      - sensor
      - binary_sensor

I have all data from every day. With grafana you can draw nice graphs.

Great stuff. Will dive into that. I did jump ahead a bit to enthusiastic I’m afraid, as it looks like i can only use the power output data from the invertor in Lovelace. How do i get to all the additional data (like daily yield etc) that is shown when i click on the sensor in the “entities” tab and follow up with the settings button? Do i set up additional sensors for this?

Sorry for the noob questions, maybe you can redirect me to another topic if you want me read up on the basics.

I’m using something like this:

- platform: template
  sensors:
    pv_input_power:
      friendly_name: "Produkcja DC"
      entity_id: sensor.sun2000_8ktl_m0
      unit_of_measurement: 'W'
      icon_template: mdi:solar-power
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'input_power') }}"

For influx you don’t need it, you can read data directly from attribute.


If you need any help just let me know.

1 Like

I’ve got that working. I think i’m getting the hang of it. Thanks for getting me on the right track. Next post from me will hopefully be a full fledge dashboard…

Hi there, just getting started with HA so sorry for the probably newbie question.

I’ve in putted the files in the specified folder and set up the stib platform in configuration.yaml.
When I go to check config the yaml file before I reboot I get the error

Configuration invalid

Platform error sensor.huawei_solar - cannot import name ‘HuaweiSolar’ from ‘huawei_solar’ (/config/huawei_solar/init.py)

Thanks

I’ve in putted the files in the specified folder and set up the stib platform in configuration.yaml .

I suppose that’s a typo and you mean you set up the huawei_solar platform?

I just checked with the latest version and I can’t reproduce this problem using the check_config script, but I’m not sure if that’s exactly the same as what the UI does. Is your custom_components folder in the same folder as your configuration.yaml file? And have you tried rebooting?

Same issue happened to me.
After clicking on Configuration validation for the first time something failed in the background.
I removed the sensor from the configuration, and restarted HA.
After that I added the sensor again and it took its time to check the configuration but if worked, restart again and you should have the sensor readings ready.

1 Like

Yesterday I woke up with this component not working, not even after a restart.
After inspecting the logs I found this:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 319, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 472, in async_device_update
await self.hass.async_add_executor_job(self.update)
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 224, in update
self._shutdown_time = self._inverter.get(“shutdown_time”).value.time()
File “/usr/local/lib/python3.7/site-packages/huawei_solar/huawei_solar.py”, line 58, in get
tmp2 = datetime.utcfromtimestamp(tmp - 60 * self._time_offset)
OverflowError: timestamp out of range for platform time_t

Apparently there is something wrong with the property “shutdown_time”, I changed the code to not parse it as date time, just expose the string, but it was failing anyway so I removed the whole “shutdown_time” property. It is now working correctly.

I would suggest reading the properties inside a try-catch to avoid having your important readings down just because a non important field is failing.

Yes I’ll make the code more defensive so it doesn’t fail on wrong or missing results.

Could you give me the value that it’s throwing an exception on? Maybe something is wrong with my logic.

thanks for your reply, the one that I had to remove was this one: “shutdown_time”

I mean could you give me the actual value on which it throws an OverflowError?

your solution worked a treat. Thanks for that :ok_hand:

Hi. huawei-solar support Sun2000-33ktl-a ?

Yes, it should work

@CristianTr @Wolf_Jaw I made a new version that should fix the OverflowError with shutdown_time, let me know something if you still have issues.

Hello,

I am completely struggling with this integration. Having SUN2000_3.0 connected via USB WiFi Dongle (SDongleA_2.0) to my home network with IP address of 192.168.1.20. I have added this integration to my config and copied all required files to ‘custom_components/huawei_solar/’ and rebooted my HA. Unfortunately, I can’t see any additional sensors. Please point me to the right direction to configure this correctly.

I will not work with usb dongle. You have to connect directly with build in wifi.