SolaX inverter Wifi Reverse Proxy setup

Finally I got the data from the SolaX inverter with a wifi dongle in HA without using the SolaxCloud. My objective is to avoid sending data to China and read all the data direct from the inverter by means of the official SolaX HA integration (https://www.home-assistant.io/integrations/solax/.).

If you happen to have the latest firmware (in my case 2.033.20) you need to set up a reverse proxy like NGINX on a Raspberry Pi. It sounds so basic but its not simple. In this write-up, I have copied, borrowed and pasted the steps and tricks invented by @Marvo2011 and many others.

Here we go. Your SolaX inverter is most likely already connected to your local network. First you need to cancel this connection by deleting the chosen SSID network, Save and reboot. The SolaX menu should now look like this:

The SolaX inverter allows only one connection. We will use this to connect to the Pi.

Raspberry Pi
Now we need to prepare the Raspberry Pi (RPI) and install NGINX. First we need the RPI software and repositories to ensure to be up to date.

sudo apt-get update
sudo apt-get upgrade

Install NGINX

sudo apt-get install nginx

Start NGINX

sudo /etc/init.d/nginx start

Find the RPI IP address:

hostname -I

By default, NGINX creates a test HTML file in the web folder. This default web page is served when you browse to http://localhost/ on the RPI itself, or http://192.168.2.48 (whatever the RPI IP address is) from another computer on the network. You should be able to browse to the default web page either on the RPI or from another computer on the network and you should see the following:


So you’ve made it this far and you now have an NGINX server running. Let’s set up the reverse proxy part and direct it to the Solax by the following steps:

Create:

sudo nano /etc/nginx/sites-available/solax.conf

and add

server  {
         listen 80;
         listen [::]:80;
         location / {
         proxy_pass http://5.8.8.8;
         }
}

We need to remove the default NGINX page (thnx @Davosje ) at two places:

cd /etc/nginx/sites-enabled
sudo rm default
cd  /etc/nginx/sites-available
sudo rm default

Now do a link with the following command:

ln -s /etc/nginx/sites-available/solax.conf /etc/nginx/sites-enabled/solax.conf

and check if all is ok:

sudo nginx -t

If all is OK you get this response:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload NGINX to tell it that the configuration has been updated:

sudo systemctl reload nginx

The RPI must now find and connect the SolaX inverter:

sudo iwlist wlan0 scan

This will list all the wifi networks visible to the RPI. Hopefully the inverter will show up like:

wlan0     Scan completed :
          Cell 01 - Address: D2:BA:E4:00:00:00
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=44/70  Signal level=-66 dBm  
                    Encryption key:off
                    ESSID:"Wifi_SWXXXX"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                              24 Mb/s; 36 Mb/s; 54 Mb/s
                    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s
                    Mode:Master
                    Extra:tsf=0000000000000000
                    Extra: Last beacon: 19789040ms ago
                  

Now it is time to tell the RPI to connect to the SolaX:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add this to the file

network={
    ssid="Wifi_SWXXXX"
    key_mgmt=NONE
}

Do a reboot

sudo reboot

and check if the RPI is connected:

ifconfig

You should see something like

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.48  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::f97:8eee:af7b:8a40  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:73:0a:38  txqueuelen 1000  (Ethernet)
        RX packets 179880  bytes 21637177 (20.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3461  bytes 684911 (668.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 50  bytes 6417 (6.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 50  bytes 6417 (6.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 5.8.8.9  netmask 255.255.255.0  broadcast 5.8.8.255
        inet6 fe80::d15b:af12:c12d:cbf7  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:26:5f:6d  txqueuelen 1000  (Ethernet)
        RX packets 3255  bytes 461123 (450.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4283  bytes 580912 (567.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The wlan0 is connected to the SolaX (5.8.8.9) and eth0 to the local network (192.168.2.48).
Go to the RPI, in this case 192.168.2.48 and you will see the SolaX inverter menu.

Time to notify HA.

sensor:
  - platform: solax
    ip_address: 192.168.2.48

After a restart enjoy the new SolaX sensors directly from your inverter
Screen Shot 2021-10-16 at 13.06.03

Have fun!

2 Likes

The sensor does not show up in the HA Energy dashboard. For this you need to create an extra sensor:

template:
  - sensor:
    - name: east_total
      state: "{{ states('sensor.solax_swxxxx_total_energy') }}" 
      unit_of_measurement: 'kWh'
      state_class: measurement
      device_class: energy
      icon: mdi:solar-power
      attributes:         
          last_reset: '1970-01-01T00:00:00+00:00'
          

I guess this only works if your Solax inverter has a WIFI interface.
My Solax X1 inverter has a wired connection to my network.

Yes that is correct. For the wired connection there are other solutions.

can you hint me in the right direction?

1 Like

I would like to know how aswell

This is a bit off-topic: search in the community on Solax and you will find this: SolaX Inverter by Modbus (No Pocket WiFi) ( now a custom_component )

1 Like

Unfortunate modbus is not open on mine.

Please check this issue on the other thread/topic as indicated above. This topic is only for the Solax inverter with a Wifi dongle.

Maybe it’s a stupid question but can I use the same raspberry pi which is running Home Assistant? Right now the pi is connected to the network over LAN interface and I bought a solax inverter with wifi dongle.

No that’s not possible I believe.

1 Like

Thanks for your answer. Then I’ll use a raspberry pi zero with LAN adapter :slight_smile:

Sounds good!

Hi Doublet, I followed the instructions and got the connection between the inverter and pi. However it doesn’t direct me to the Solax inverter menu. I’m on firmware 2.034.03.

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.199  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::c57:e693:f87d:a2e0  prefixlen 64  scopeid 0x20<link>
        ether e8:fc:af:c7:a7:81  txqueuelen 1000  (Ethernet)
        RX packets 1798  bytes 137200 (133.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 263  bytes 41338 (40.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 5.8.8.9  netmask 255.255.255.0  broadcast 5.8.8.255
        inet6 fe80::1dbc:a13e:d1bd:8668  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:4e:e2:dd  txqueuelen 1000  (Ethernet)
        RX packets 21  bytes 3553 (3.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 25  bytes 3955 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Do you have any suggestions?

Trust that your SolaX inverter does not have any wifi connections, check. When connecting to the Pi you should see the SolaX login:
Screen Shot 2021-11-08 at 11.36.49

Have you tried to do a number of reboots and recheck nginx, ifconfig and all the steps in between?

1 Like

Yes I did many times for the raspberry. Only a couple of times for the inverter.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Still only getting the Welcome to nginx page.

The wifi dongle is blinking rapidly. Does that give any information?

The rapid blinking of the wifi dongle is good: means the inverter is looking for a wifi network and is not connected.

Noted that your SolaX broadcast IP is 5.8.8.255. Is this correct? In my case the broadcast is 5.8.8.8
Can you confirm/check by connecting to the inverter directly?

When I connect to the inverter with my phone it gives me IP 5.8.8.10 and the raspberry gets 5.8.8.9.

funny, my ifconfig also gives:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.48  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::f97:8eee:af7b:8a40  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:73:0a:38  txqueuelen 1000  (Ethernet)
        RX packets 2020878  bytes 411787114 (392.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 173985  bytes 25828366 (24.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 5.8.8.9  netmask 255.255.255.0  broadcast 5.8.8.255
        inet6 fe80::d15b:af12:c12d:cbf7  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:26:5f:6d  txqueuelen 1000  (Ethernet)
        RX packets 50151  bytes 6745373 (6.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 60961  bytes 7494199 (7.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

So something else must have changed?

Did a firmware upgrade (it was a downgrade eventually) to 2.033.20. And our settings are the same. Still no success, 1 big mystery haha solved!

EDIT:
I deleted the default page in /etc/nginx/sites-available and /etc/nginx/sites-enabled. Now it works!! Thanks for your help and instructions :slight_smile:

1 last question. What entitie should I use, and where? Feed back to the net I have: Solax SW******** Total Feed-in Energy and solarpanels the solar template in your second post. Is this correct?