SolaX inverter Wifi Reverse Proxy setup

I found the problem and a workaround:
the problem is actually that my inverter is not yet supported because it is a Solax X3-Hybrid-G4
The workaround is to skip the solax integration and manually add a rest call to the configuration. A working rest call can be found at Support for X3 Hybrid G4 · Issue #80 · squishykid/solax · GitHub last entry by WikiHA

1 Like

Works great! Thank you very much!

Has anyone had any sucess with the reverse proxy using Firmware 3.001.02, and connecting to HA?

I have the RP set up, and can connect to the Solax X1 Hybrid G4 via a web browser, and see the admin pages.
However, I can’t seem to get HA to connect.

The RP is seeing requests from HA

192.168.0.11 - - [02/Dec/2022:17:22:24 +0000] "GET /api/realTimeData.htm HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:22:28 +0000] "POST /?optType=ReadRealTimeData&pwd=XXXX& HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:22:31 +0000] "POST /?optType=ReadRealTimeData&pwd=XXXX& HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:22:34 +0000] "POST /?optType=ReadRealTimeData&pwd=XXXX& HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:22:37 +0000] "POST /?optType=ReadRealTimeData&pwd=XXXX& HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:22:40 +0000] "POST /?optType=ReadRealTimeData&pwd=XXXX& HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:22:43 +0000] "POST /?optType=ReadRealTimeData&pwd=XXXX& HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:22:46 +0000] "POST / HTTP/1.1" 502 173 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:23:50 +0000] "POST /?optType=ReadRealTimeData&pwd=XXXX& HTTP/1.1" 504 183 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:23:51 +0000] "POST / HTTP/1.1" 200 335 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:23:56 +0000] "POST / HTTP/1.1" 499 0 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:24:06 +0000] "POST / HTTP/1.1" 499 0 "-" "Python/3.10 aiohttp/3.8.1"
192.168.0.11 - - [02/Dec/2022:17:24:26 +0000] "POST / HTTP/1.1" 499 0 "-" "Python/3.10 aiohttp/3.8.1"


But the config screen returns with “unknown error”.

I gave up for now and went down the REST API road as an interim solution.
(Docmented as a fully worked example).

I’ve tried various curl commands to 5.8.8.8, but can get anything back. Happy to try stuff if anyone has suggestions. The REST API is only updated every 5 minutes, so not great.

I just tried, and now I can connect the solax integration directly to the wifi dongle, no need for nginx proxy. tried both firmware versions provided in link by Chrisoft.

So using the custom firmware from bellow link (for me it worked with 618.00122.00_Pocket_WIFI_V2.034.06_20200921_UNLOCKED.usb)
HA connects directly to the wifi dongle. I get updates about each 30s in official integration.

Modified Firmware for Solax Pocket WIFI V2 - ChriSoft

LE: I switched to REST sensors to local API in HA that update at 1s for more accurate results.

Hi. I’ve managed to connect to the Wifi dongle directly, without any extra work, config or firmware changes, although I suspect it might not work for everyone: Solax X1 Hybrid G4 (local & cloud API)

No, it does not work for me. When I execute the curl command the response I am getting is “curl: (52) Empty reply from server”.

*   Trying 192.168.178.109:80...
* Connected to 192.168.178.109 (192.168.178.109) port 80 (#0)
> POST / HTTP/1.1
> Host: 192.168.178.109
> User-Agent: curl/7.83.1
> Accept: */*
> Content-Length: 39
> Content-Type: application/x-www-form-urlencoded
>
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server

My Solax Pocket WiFi stick is a V2 version with firmware version 2.033.20. The inverter is a Solax X1 Mini (X1-2.0-S-D).

@witterholt try the firmware I mentioned 2 posts above, should unlock the api from local network instead of only pocket wifi own ssid.

@dr3am.r, I hesitate to do that because there are users that report that they cannot connect to the dongle anymore after installing this custom firmware.

For now I am using the reverse proxy method described here with a Raspberry Pi 4b that was collecting dust. This works perfectly for now.

1 Like

@witterholt seems that I dodged a bullet then :slight_smile: even though I had same firmware version as the Custom one which is 2.034.06. I did not have a v3 one. For me the proxy variant somehow never worked … working with nginx is not new for me thus, don’t think there were configuration issues (it’s mostly copy-paste anyway), after accessing the dongle ui through the rpi IP:port, I would get the basic authentication pop-up, but after providing credentials (which I know work as I connected to the dongle directly with them), I get some empty response (no page returned). So for me not using another component (rpi) in between, works perfectly.

1 Like

First off @Doublet thanks for a great write up. Recently had an X1 G4 installed on firmware 3.003.02 and followed your instructions to get proxy set up. Which worked great.

However, adding solax integration didnt work, cant do in yaml anymore and when I added integration it just hangs trying to configure inverter, wont install.

I managed to get some sensors set up looking at what @reinhard.ruemer did… Then I thought the mapping for the data must be in the Solax Power integration code, so looked at that and noticed the set-up is same (i.e. the api call is to ‘optType=ReadRealTimeData&pwd=SX…’)… Andf thought… thats odd, why would it work from curl not the integration if its the same call??..

Anyhow did a little debugging and turns out there is some issue in the discovery loop of the integration (its actually in the solax lib it uses) so I crated a custom_integration from the Solax Power one, just taking out the discovery loop and telling it to add X1 G4 only… and it WORKS!!!

So got Solax Power integration set up… my wifi dongle IS connected to wifi (internet) AND it still exposes its own access point which is what I connected to for this revers proxy set up… It gives me the data AND sends to solax cloud… Which got me thinking could I connect the now working integration to the inverters IP directly and skip the revers proxy… answer YES!!!

Am I just lucky that my wifi dongle on V3 firmware just works?? or is it it appeared to not work for others due to the Solax Power bug on firmware v3?

1 Like

nice job. would you mind sharing the custom integration you made? is it on github?

I also connected my dongle to the solaxpower website, and I am also still getting the reads locally - so both works.

Not uploaded it yet, can do… but don’t you have the X3?

I’ve literally got it only configuring the X1 G4 instead of doing inverter discovery… Not got round to fully debugging the real issue yet. Will take a look

Ok I took a look at the lib and ran it locally to check for errors… its NOT erroring… it just takes forever… it runs through every inverter one at a time and uses aiohttp with no timeout set, which defaults to 5 mins. I’ve made it 5 seconds and allowed all the inverters back. So theoretically should work for any supported inverter again now…

Wanna give it a go?

Uploaded to git

If it works I’ll look into a PR

i’ll try to have a look at it over the weekend to see if it also works with my X3

1 Like

So, i tried your custom_component on the weekend but it didn’t work with my X3. I noticed a different error message, though:
Using the original HA-Component, I get a “Unexpected Error” but with your custom component it also takes a while and tries to connect but then throws a “Connection Failed” in the HA-Frontend. I am certain the IP and Password were correct since I double checked it and also tried via command line. Maybe the X3 is indeed differnt.

I’m no sure where I found the code below online, but it has been working fine for me for the last few weeks to get the data from my Solax Pocket WiFi, without having to setup any reverse proxy or another intermediate device. It goes in my sensors.yaml file.

  - platform: rest
    name: solaxx1data
    resource: http://192.168.1.77/?optType=ReadRealTimeData    # Local IP of Solax Pocket Wifi
    method: POST
    headers: 
      X-Forwarded-For: 5.8.8.8
    scan_interval: 5
    timeout: 4
    value_template: 'OK'
    json_attributes:
      - type
      - SN
      - ver
      - Data
      - Information

and then you can use something similar to the below to get the data.

  - platform: template
    sensors:
      solaxx1_energytoday:
        friendly_name: SolaxX1 ENERGYTODAY
        unit_of_measurement: "kWh"
        value_template: >
          {% if is_state('sensor.solaxx1data', 'unavailable') %}
            {{ states('sensor.solaxx1_energytoday') }}
          {% else %}
            {{ state_attr("sensor.solaxx1data", "Data")[8] }}
          {% endif %}
        icon_template: mdi:home-lightning-bolt-outline
        device_class: "energy"
        attribute_templates:
          state_class: total_increasing
          time_stamp: >
            {{ now() }}
1 Like

Correct! I am in the process of converting this system to this shortcut

I stopped using the inverse proxy setup, there is a more simple solution: Solax X1 Boost Air Mini : local data

Does a 2nd Raspberry PI need to be setup?
Why can not the HA PI be connected to its Ethernet and have a WIFI connection to the Pocket Wifi on the Solax.
Then just put the IP address of 11.11.11.1 to connect to Pocket Wifi on the solax and get the data.