Connect to Huwaei SUN2000 inverter using fiber modem

why not connect the RPi4 to the SUN2000 ? to far away ?

1 Like

If you manage to connect the RPi to the SUN2000 by wifi, and to your network by wire, you would not need anything else.

Otherwise, just connect the Linksys 6500V2 as client to your network using the 5GHz radio, and to the SUN2000 using the 2.4GHz radio. Then follow the instructions on the post, so you can reach the SUN2000 on the wireless IP address from the Linksys 6500V2.

yes too far. RPi is on the first floor and the inverter is in the garage. Inverter signal are too weak.

I still have to buy the router. And my current router/fiber modem has only 2.4Ghz radio. So I am kind of looking for a dual 2.4Ghz router supported by openwrt.

In that case, don't get the 6500V2, but pretty much anything with two radios will work, even wireless repeaters or APs.

Just steer clear of broadcom chipsets, devices with less ram than 128mb, and flash sizes of 8mb or less.

1 Like

Or a router with one 2.4GHz, plus a USB adapter.

I have to choose from these routers from this store. (discount offer and reliable seller).which ones are good which I should shortlist? https://www.daraz.pk/routers/?al-masoom-trader&from=wangpu

That's quite a trip down memory lane, most of those are pretty ancient devices…

Start by checking them against https://openwrt.org/toh/start.

I am looking at these router. which one of these is recommended?

RT-AC68U is not an option, at all (unsupported Broadcom wireless).

The EA8500 should be fine, the kernel partition is a bit small, but sufficient at the moment.

There are two rather difference hardware revisions for the EA7500, both are supported by now - but the EA8500 would be the more advanced one (kernel partition sizes are probably the same).

1 Like

already small kernel partition? I just need it to connect to my Huwaei solar inverter using 2.4GHz radio. and stream Plex running on Synology NAS214play from 5GHz radio ( is this possible?

want to do this from GUI.
Should I create a new firewall zone called sun?

Edit:
So far can I can ping from OpenWrt router

PING 192.168.200.1 (192.168.200.1): 56 data bytes
64 bytes from 192.168.200.1: seq=0 ttl=255 time=7.068 ms
64 bytes from 192.168.200.1: seq=1 ttl=255 time=1.468 ms
64 bytes from 192.168.200.1: seq=2 ttl=255 time=6.172 ms
64 bytes from 192.168.200.1: seq=3 ttl=255 time=1.429 ms
64 bytes from 192.168.200.1: seq=4 ttl=255 time=6.260 ms

--- 192.168.200.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 1.429/4.479/7.068 ms

but can't ping from Homeassistant.
image

adding these rules from ssh(I had to break the No command-line rules) partially fixed the issue. Even though I made a mistake in the first rule, my router IP wasn't correct.

iptables -I PREROUTING -t nat -p tcp -d 192.168.1.24 --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

Now, wlcrs integration is working fine, there are no dropouts as of in the last one hour
image
but I can't ping the inverter from HA, which I think is due to wrong first iptable?

So to summarize, I did this. Note Huawei inverter is on another subnet that is 192.168.200.0.

  1. Flash Openwrt on the router
  2. Setup your router as a dumb AP. https://openwrt.org/docs/guide-user/network/wifi/dumbap
  3. Connect it to your ISP router via ethernet. This will change the IP to something in the router’s subnet range. e.g if your ISP’s router Ip is 192.168.1.1 then your OpenWrt's router IP will be 192.168.1.24 (anything in between 192.168.1.2 to 192.168.1.100)
  4. Connect to your Huwaei Sun2000 inverter’s wifi as a client via 2.4Ghz radio.

Step 2
This step is unique for each user, depending on your ISP modem/ router.
Set up a static route in ISP router/modem/
e.g
On F@st 5366

  1. Open 192.168.1.1 (again depending on your Isp router Ip address)
  2. follow these instructions to open the static route page. Route - SAGEMCOM Swan F5366s User Manual [Page 19] | ManualsLib
  3. enter the following setting
  4. IP address 192.168.200.0 (in your case 192.168.199.0)
  5. Gateway IP address 192.168.1.2 (whatever your OpenWRT router Ip address is)
  6. Interface IP_BR_LAN (in my case it was br0)
  7. Subnet mask 255.255.255.0 (if there is a field for subnet mask)
  8. Save and reboot both your ISP modem/router and OpenWrt router.
    This will complete step 2.

Step 3

  1. Download and install the latest Winscp from WinSCP:: Official Site:: Download
  2. Run WinScp
  3. select Scp as protocol.
  • login with your OpenWrt’s ssh credentials e.g
    image
  • accept the terms etc etc
  1. You will be presented with these windows with OpenWRT folders.double click on three dots icons

    you will be presented with
  2. Navigate to the first file by double-clicking etc and then config. Here you will find all the three files “network” “wireless” and “firewall”
  3. double click on the “network” and copy-paste the following code at the end of the files. remember to set defaultroute '0" as mentioned in the GitHub wiki.
config interface 'wlan'
        option proto 'dhcp'
        option defaultroute '0'


7. repeat the process with “wireless” files by adding the following code to the end of the wireless file. changing according to your inverter’s AP’s Name and BSSID

config wifi-iface 'wifinet0'
        option key 'Changeme'
        option ssid 'SUN2000-HV0123456789'
        option device 'radio0'
        option mode 'sta'
        option bssid '94:25:33:12:34:56'
        option encryption 'psk2'
        option network 'wlan'
  1. Add the following code to the “firewall” file.
config zone
        option input 'ACCEPT'
        option name 'sun'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option masq '1'
        option network 'wlan'

config forwarding
        option dest 'sun'
        option src 'lan'

config forwarding
        option dest 'lan'
        option src 'sun'
  1. save everything and restart your OpenWrt router.

Step 4
Firewall rules for the port forwarding

  1. Network -- Firewall -- Port forwarding
  2. Setup first rules as follows
  • Name: Preroute
  • Protocol: TCP
  • Source zone: Lan
  • External port: 6607
  • Destination zone : sun(wlan)
  • Internal IP: Select from dropdown: 192.168.200.1
  1. Uncheck NAT loopback from advanced setting tab

  2. Add second rule as following

  • Name : Post route
  • Protocol TCP
  • Outbound zone Sun(wlan)
  • Destination address select from dropdown 192.168.200.1
  • Destination port: 6607
  • Action: SNAT (there is some debate on this issue but you can use this)
  • Rewrite IP address: select from dropdown 192.168.200.2 (OpenWrt router IP in Huwai inverter subnet)

Step five

  1. Verify connectivity, Before continuing with the setup of the integration, you should test whether you can ping the inverter on 192.168.200.1. You can use one of the SSH/Terminal add-ons of HA, or use a terminal in the VSCode add-on.
  2. successful connection will look like this

Install Wlcrs integration.

  1. Connect Home Assistant to the WiFi Access Point of your Huawei inverter.
  2. Install this integration with HACS, or copy the contents of this repository into the custom_components/huawei_solar directory
  3. Restart HA
  4. Start the configuration flow:
  • Start Config Flow
  • Or: Go to Configuration -> Integrations and click the + Add Integration. Select Huawei Solar from the list
  1. Choose whether you want to connect via serial or network connection. In this case we will choose network
    image

  2. Enter the IP address of your inverter (192.168.200.1). The slave id is typically 0. You should only check the Advanced: elevate permissions checkbox if you intend to dynamically change your battery settings.
    image

  3. When using the elevate permissions feature, you might be asked to enter the credentials to the installer account in the next step. These are the credentials used to connect to the inverter in the "Device Commissioning" section of the FusionSolar App. The default password is 00000a..

1 Like

@eduperez @trendy @slh @frollic @pavelgl Sorry for bothering you all. :slightly_smiling_face:
Is this the correct configuration correct? It is working fine but does it fulfil proper networking criteria? Or do you suggest any changes?

At least one user reported this as working even with v22.03.0-rc4.

You are masquerading on the sun zone, so no need for the SNAT rule.

1 Like

Updated according to new feature and connection type being added, i.e serial connection.

Opening this after one year, on 23.05rc2/snapshot I am facing this strange issue. Can't access the internet with the above config.

logs

Sat Jul  8 17:27:07 2023 daemon.notice netifd: wlan (2329): udhcpc: broadcasting select for 192.168.200.2, server 192.168.200.1
Sat Jul  8 17:30:01 2023 daemon.err uhttpd[1454]: [info] luci: accepted login on /admin/system/reboot for root from 192.168.18.126

reset, start from scratch ...

ahh... backups mean nothing it seems :exploding_head:

reconfigure again. let me try that.