Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 107877

SolaX inverter Wifi Reverse Proxy setup

$
0
0

Finally I got my SolaX inverter data 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;
         }
}

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!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 107877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>