Integration Solar inverter huawei 2000L

deleted - Found a solution myself.

Hello, I have a few questions that I hope to get cleared out, thanks in advance.

I have:
Inverter version: V100R001C00SPC140
Dongle version: V100R001C00SPC127

The Dongle is connected to one of my local networks and I am able to talk ICMP to it from the network that my RPI running HA sits on. Is this supposed to enable the the modbus-tcp connection? Or is the required that HA has direct access to the dongleā€™s local network through e.g. a bridge? same question rephrased: Is it possible to communicate over Modbus-tcp using only my local network(that the dongle is connected to)?

When I use ā€œdevice commissioningā€ from the FusionSolar/SUN2000 app on my iphone I dont see any option to enable ModbusTCP, the only setting I can do is to change the wifi password of the dongle APs wifi. Is this because my software versions are too new? Or is it the fact that my phone is running iOS? Or both?

If I try to configure the Huawei Solar HACS integration it says connection failed, so either the modbus-tcp just isnā€™t enabled or I have to to some work on the network side of things, e.g. a bridge. (I currently have no wifi capabilities on the RPI running HA)

/Erik

Nice guide, Iā€™ve setup dd-wrt on an old netgear router I had.
But something isnā€™t working right for me.
On the status page I can see the inverter keeps disconnecting, it connects for 2 seconds with good signal strength then disappears from the list and repeat.
The router did get an ip via DHCP in 192.168.200 range ok.
The only thing that really looks different to your screen shots is the inverter connects in legacy mode not HT20.
Maybe it doesnā€™t play nice with the Netgear wndr3700 in client mode.

Yeah I think it should work (look below).

This is unfortunately a known problem of iPhone applicationā€¦ In android there is such option visible, moreover you can set ACL for specific IPs or set it unrestricted. Of course you need newest application (on android).

Maybe you can enable logging in this dd-wrt or login via telnet and see if there is something relevant in the logs/dmesg. I didnā€™t have such problem so I canā€™t tell you if this is a router limitation (very unlikely, especially because you are saying that it even successfully obtaining IP address from the inverter) or some different problemā€¦ The HT20 mode may not be very relevant I think. The router just matches the mode with the client and it may differ in timeā€¦
Make sure that you donā€™t have some other device which is connecting to this inverter in the same time. Do you maybe have your smartphone in your pocket and is it trying to connect? :wink:

This is not true. I have the option on my iPhone. No problem.

I just had my installer company here and they were able to change to dongle parameter without issues using an iphone running the FusionSolar app.

1 Like

Thank you Manio!

Regarding the iOS question, as has been stated further down, it apparently works.

What I do noticed is that the option for manually selecting a firmware version (eg downgrading), isnā€™t available on the iOS Appā€¦

Thatā€™s correct. However, installing firmware versions can be done via the Fusionsolar web interface if you have an installer account.

Hi Frans1,
Is the kiosk mode still working? It doesnā€™t work for me. I get some errors:
(Integration Solar inverter huawei 2000L - #114 by Frans1)

Logger: homeassistant.components.sensor
Source: core.py:1045
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 12:13:54 (2 occurrences)
Last logged: 12:13:54

* Error adding entities for domain sensor with platform rest
* Error while setting up rest platform for sensor

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 782, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 663, in _async_write_ha_state self.hass.states.async_set( File "/usr/src/homeassistant/homeassistant/core.py", line 1357, in async_set state = State( File "/usr/src/homeassistant/homeassistant/core.py", line 1045, in __init__ raise InvalidStateError( homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.pv_production_realtime. State max length is 255 characters.

and

Logger: homeassistant.helpers.event
Source: helpers/template.py:409
First occurred: 12:14:08 (7 occurrences)
Last logged: 12:14:08

Error while processing template: Template("{{ states.sensor.pv_production_realtime.attributes["data"]["allCapacity"]|float |round(0) }}")
Error while processing template: Template("{{ states.sensor.pv_production_realtime.attributes["data"]["yearCapacity"]|float |round(0) }}")
Error while processing template: Template("{{ states.sensor.pv_production_realtime.attributes["data"]["monthCapacity"]|float |round(0) }}")
Error while processing template: Template("{{ states.sensor.pv_production_realtime.attributes["data"]["dailyCapacity"]|float |round(2) }}")
Error while processing template: Template("{{ states.sensor.pv_production_realtime.attributes["data"]["curPower"]|float * 1000|round(2) }}")
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 407, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1814, in _render_with_context
    return template.render(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1291, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1603, in forgiving_int_filter
    result = jinja2.filters.do_int(value, default=default, base=base)
  File "/usr/local/lib/python3.9/site-packages/jinja2/filters.py", line 980, in do_int
    return int(value)
jinja2.exceptions.UndefinedError: list object has no element 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 523, in async_render_to_info
    render_info._result = self.async_render(variables, strict=strict, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 409, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: list object has no element 1

So maybe now it is present. My statement was based on this:

1 Like

It was present at least the last one and a half month. Thatā€™s the time I have been using the iPhone app to configure my system. But anyways. It is definitely present. Thatā€™s what is important.

Hello Marco,

I stopped using the kiosk (for over 1 year) because the uniek url was changing all the time.

I didnā€™t look into it since then. Im using the local integration that is more stable, as most of then people in the topic.

Thanks, Iā€™ll use local integration too, but I have to install a router to connect to inverter AP. The ip asigned by my first router dhcp to the inverter donā€™t answer . If I connect to inverter AP, the gateway ip is 192.168.200.1. What is the best method to connet HA to the inverter?. I donā€™t have wifi in the HA linux, only ethernet

Regarding RestApi, the new url is https://eu5.fusionsolar.huawei.com/thirdData/getStationRealKpi , but I donā€™t know what headers should I use, I think it is still a good solution for people who canā€™t connect to TDP Modbus

1 Like

Iā€™m looking into it right now

you donā€™t need a header

https://region04eu5.fusionsolar.huawei.com/rest/pvms/web/kiosk/v1/station-kiosk-file?kk=KIOSKCODE

Example

  - platform: command_line  
    command: curl -s https://region04eu5.fusionsolar.huawei.com/rest/pvms/web/kiosk/v1/station-kiosk-file?kk=YOURTOKEN | python3 -c 'import json,sys;raw=sys.stdin.read();clean=raw.replace("&quot;",r"\"");obj=json.loads(clean);data_obj=json.loads(obj["data"]);print(data_obj["realKpi"]["dailyEnergy"]);'
    name: solar_daily
    unit_of_measurement: 'KW'
    scan_interval: 60
    command_timeout: 30

I updated my GitHub (itā€™s not the efficient code but works)

I hoop it will work for you

1 Like

Thanks, I Will check. Finally I made te modbus tcp work with wifi USB adapter. I Connect the wifi to inverter AP and I can conect to inverter at 192.168.200.1
Tomorrow I Will compare this two solutions

Yes I checked the phone to be sure it wasnā€™t connected to the ssid.
Iā€™ve had a look at dmesg but nothing really useful.
You can see the repeated connections happening, but no mention of the disconnects.

<6>[  519.020000] wlan0: associate with c0:ff:a8:25:xx:xx (try 1/3)
<6>[  519.020000] wlan0: RX AssocResp from c0:ff:a8:25:xx:xx(capab=0x631 status=0 aid=3)
<6>[  519.030000] wlan0: associated
<6>[  525.780000] wlan0: authenticate with c0:ff:a8:25:xx:xx
<6>[  525.800000] wlan0: send auth to c0:ff:a8:25:xx:xx (try 1/3)
<6>[  526.240000] wlan0: authenticated
<6>[  526.270000] wlan0: associate with c0:ff:a8:25:xx:xx (try 1/3)
<6>[  526.270000] wlan0: RX AssocResp from c0:ff:a8:25:xx:xx (capab=0x631 status=0 aid=3)
<6>[  526.280000] wlan0: associated
<6>[  536.740000] wlan0: authenticate with c0:ff:a8:25:xx:xx
<6>[  536.760000] wlan0: send auth to c0:ff:a8:25:xx:xx (try 1/3)
<6>[  537.200000] wlan0: authenticated
<6>[  537.230000] wlan0: associate with c0:ff:a8:25:xx:xx (try 1/3)
<6>[  537.230000] wlan0: RX AssocResp from c0:ff:a8:25:xx:xx (capab=0x631 status=0 aid=3)
<6>[  537.240000] wlan0: associated

Iā€™m going to give another old router a go.

Hi Rafal, how do you get this card? I only get 7 sensors.
I need more data from inverter. For example instant grid exported and instant grid acumulated in watt.
huawei

You can use https://github.com/wlcrs/huawei_solar to have more sensors or use template sensor to create entity from SUN2000-3KTL attributes (i think it is Emilv2 integration you are using now). There is no sensor for instant grid exported and instant grid acumulated in watt, but you can read value of power_meter_active_power from smart meter, if itā€™s negative then you are importing energy if itā€™s positive then you are exporting energy.