Integration Solar inverter huawei 2000L

Great, happy to hear that, any idea about the comand that you typed?

Is Sun2000 app working on your phone now?

nope :rofl:

but waiting for huawei guaranty…

I will try your setup, because mine is empty despiste of custom rules

EDIT: It’s not working, definitively problem of hardware… I will wait for huawei. With a luck, they will change the comunication cards and the IP also!!! or the inversor!!!

But this is normal about the DNS?

@trevee Are you located in Europe? Just email/call Huawei support directly, they will reply within 24 hours. Global Service Hotline — Huawei Enterprise and for spain
image

Don’t wait for your installer, call Huawei and ask for support why your Sun2000 app is connecting?

Yes DNS seems normal. Your ISP modem/router IP is 192.168.1.1?

Yes 192.168.1.1, I’m in Spain.

But My installer already open a ticket in huawei… I’m affraid to set up a mess if I call in parallele

The installer seems to take too long, just call Huwaei support at their phone number and discuss why you can’t connect via sun2000 app. No need to mention Homeassistant. I am pretty sure they will resolve the issue within 24 hours.
I am saying this after being involved in the installation of Huwaei inverters at more than 5 sites.

Hi, special thanks to @yousaf465 I managed to get it going which would have not been the case without you! Thanks!

@trevee I had surprisingly similar case than yours, and all the settings were pretty much the same. The only difference was, that my gateway was at 192.168.200.1, where it should be. Can you check your Network → Interfaces, what is the ip of your Huawei? Mine was 192.168.200.2. Try then to ping it from cmd or Home Assistant terminal just to see that the route is generally OK. I think you mentioned that you can ping the Huawei gateway from Openwrt Diagnostics?

Mine pinged OK from cmd and terminal to 192.168.200.2, could not just ping the Huawei gateway. In general, I think, if one can ping the clients, but not the gateway, there is something unstable in the connection/ route settings etc. For me I tried to open port 6607 with all port forwards etc. and of course with Firewall custom rules like described earlier in the thread. However, when i also added port 502 to custom rules like that:

iptables -I PREROUTING -t nat -p tcp -d 192.168.1.247 --dport 6607 -j DNAT --to-destination 192.168.200.1:6607
iptables -I POSTROUTING -t nat -d 192.168.200.1 -p tcp --dport 6607 -j MASQUERADE

iptables -I PREROUTING -t nat -p tcp -d 192.168.1.247 --dport 502 -j DNAT --to-destination 192.168.200.1:502
iptables -I POSTROUTING -t nat -d 192.168.200.1 -p tcp --dport 502 -j MASQUERADE

…it started to work.

EDIT: However, I does not seem to tolerate restarts. If I unplug - plug in the Openwrt router, it does not connect anymore. Strangely, removing all the IPTABLES from custom rules + saving and the connection works again (I can ping) ???

However, the integration is HA does not work, so the port settings are needed.

It seems to be that it is the just change in firewall settings and saving that opens the connection?
Could it be possible, that firewall is not started automatically after restarts?

Yup, Firewall is not running after reboot/ restart and needs to be restarted manually, which is also done when saving changes in firewall ruyles.

The question now is, what is stopping the firewall (settings not supported by hw etc.?) and what can be done? Automatic restart scripts etc?

EDITing again…:
There seems to be a bug in kernel, that prevents IPTABLES from loading during startup. There are many versions of Openwrt, and the one probably all TP-Link WR802N v4 users load from openwrt downloads is of course the recommended one, which does not probably have the fixes for this. In addition, it is also possible that te setinng cause some conflicts preventing proper restart of the firewall

See discussion in: Firewall fails on reboot - #21 by jow - Installing and Using OpenWrt - OpenWrt Forum

Are there asny Openrt gurus present with more experience on this?

Thanks for the appreciation. You can always press the like button to add some love to the posts, also it makes those posts easier to find for new members.
I can ping from the OpenWrt router to the Huawei inverter which is at 192.168.200.1. Network – Diagnostics

Which router you are using and which version of OpenWrt?

For the firewall issue, you can ask in OpenWrt forums, a very friendly community.

Did you read this thread

Using TP-Link WR802N v4, pls. see my previous post, I made some edits there before I noticed your post

https://firmware-selector.openwrt.org/?version=21.02.3&target=ramips%2Fmt76x8&id=tplink_tl-wr802n-v4

are you using the latest Version:
21.02.3 (r16554-1d4dea6d4f) for your device?

Yes, that is the one given by selector and Iäm using it

This might fix the problem. Or upgrading to 22.03.0-rc1 might fix it according to the same post quoted.

Yes, that is from the thread I linked above.

1: Is it OK to upgrade to 22.03-rc1? As we noticed here in this same discussiion, each device seem to have their own versions?

2: I also noticed this:

#!/bin/sh

[ "$ACTION" = ifup ] || exit 0
fw3 -q network "$INTERFACE" >/dev/null || exit 0

for ipt in iptables ip6tables; do
  for tbl in filter nat mangle raw; do
    $ipt -t $tbl -L &>/dev/null
  done
done

but as I have 0 experience on unix -like systems, I do not where and how to put these scripts or whatever they are… Rather than upgrading, this probably would be more to my liking… :slight_smile:

You can always select the correct version for your router from the firmware selector tool. remember to use the sysupgrade file to upgrade OpenWrt from 21.02.3 to 22.03.0-rc1 or 22.03.0rc4

as for the code, I think it will be added to this file

# cat /etc/hotplug.d/iface/19-poke-iptables
1 Like

After adding the script file, no change. Firewall did not start after restart

OK, installing the latest upgrade (rc4) solved it. Now firewall is started at startup, BUT Network → Firewall does not have the Custom rules -tab anymore!!!

So, where and how i put these, becaude the HA integration does not work without:

iptables -I PREROUTING -t nat -p tcp -d 192.168.1.247 --dport 6607 -j DNAT --to-destination 192.168.200.1:6607
iptables -I POSTROUTING -t nat -d 192.168.200.1 -p tcp --dport 6607 -j MASQUERADE

iptables -I PREROUTING -t nat -p tcp -d 192.168.1.247 --dport 502 -j DNAT --to-destination 192.168.200.1:502
iptables -I POSTROUTING -t nat -d 192.168.200.1 -p tcp --dport 502 -j MASQUERADE

According to this Custom rules on firewall TAB - Network and Wireless Configuration - OpenWrt Forum

Custom rules are gone and should be edited as /etc/nftables.d/ (using nftables syntax, not iptables).

Now the question is, how does those rules translate to nftables?

…or: Can I use the same upgrade method ro reinstall former openwrt version and restore settings from backup?

I am also not using the custom rules anymore instead I am port forwarding this way

Follow the thread from that post. Screenshots attached, but follow the original thread for details.
First rule



Second rule.

1 Like

OK, that did the trick. I read this post when you mentioned it earlier, but got a bit confused at the time… The original post is bot that clear… :slight_smile:

Thanks!

everything working now? @wlcrs 's integration working? You can ping inverter both from the Openwrt router and your PC/Mac?