Solax X1 Hybrid G4 (local & cloud API)

I have found updating the sensor.solax_rest_local_settings,
every 10 seconds was causing issues with timeouts etc.
So I backed it off to 3600 second updates.

Then in my automation when I set the value, i wait 5 seconds then call

service: homeassistant.update_entity
data: {}
target:
  entity_id: sensor.solax_rest_local_settings

@kamilb I have this working, thanks for sharing!

However, I don’t think I can set up correctly the Energy Dashboard with the current setup. How do you have it done?

It doesn’t really let me select any of the Local ones which are accurate.

Thanks @ColinRobbins - yes, changing settings refresh to 3600 seconds seems very sensible. I also added the refresh step in automation as you suggested, but also a loop to ensure the new settings reflect the new target. I still see it occasionally going the second time, so three is just in case. I’ve also tried to fine-tune the forecast-based target, to avoid 100% charge with solar. This will certainly require fine tuning depending on everyone’s usage. Next on my list:

  • Update the base target depending on number of hours between end of charging and sunrise
  • Another automation to put an electric heater on/off depending on feed-in energy
  • Look at putting the immersion heater (hot water) on/off depending on solar forecast & solar pv output (although for that I first need a switch - maybe Sonoff Powr3?

Are any of these of any interest?

Hi @ALaguna. So far I’ve only configured the energy dashboard with the cloud sensors:

It should be possible to do it of the local readings, but I’m not sure how reading frequency (every 5s) would affect that, hence sticking with the cloud ones for now.

BTW - don’t use the yield value from solax - it’s wrong in case you charge battery from grid. Also, the total yield recently jumped from 500kWh to over 1MWh!!! I just don’t trust it any more…

Better use the PV output with powercalc, altough that will be higher that actual field.

1 Like

Thanks for getting back!

I’m not sure the numbers from the cloud make sense. It’s night right now and I don’t have any battery or solar production:

"feedinpower": -1537.0,
"feedinenergy": 206.17,
"consumeenergy": 553.68,

Do you happen to know how does the local array work? I can’t really make sense of it, specially when it comes to Production, Feed In and Load Generator

{
  "sn": "SXXXXXXXX",
  "ver": "3.003.02",
  "type": 4,
  "Data": [
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3986, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 287, 0, 0, 0, 0, 0, 0, 64384, 65535, 20617, 0, 55374, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  ],
  "Information": [
    5, 4, "XBXXXXXXXXXXX", 8, 0, 0, 1.35, 0, 0, 1
  ]
}

Here is a link to some information regarding the data in the cloud api https://www.eu.solaxcloud.com/phoebus/resource/files/userGuide/Solax_API_for_End-user_V1.0.pdf
feedinenergy should be total energy (kWh) put in to the grid and consume energy is total energy consumed from the grid and has nothing to do with current power. Feedinpower is negative because you are not feeding energy in to the grid, but taking from.
Regarding the data, @kamilb has a nice google sheets document in his first post ( X1 Hybrid G4 - Google Sheets ) and you can also check Solax X3-Hybrid G4 Wifi Firmware Solax module fw version 3.003.02 Home Assistant Integration (also linked in the first post) for more info about what the different values in the array denotes.

Just started with this myself the other day, thanks a lot for the information @kamilb !
I’m going to take a deep dive into the settings data any day now, to see if I can help with some decoding. Especially regarding charge&discharge hours.

2 Likes

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).

Sorry @witterholt, won’t be able to help with your firmware & inverter version. Have you reached out to Solax for a firmware update?

No, I am using the reverse proxy method now.

1 Like

Hi @ALaguna ,

I am just setting my own Solax string inverter up and trying the same thing. I started off by modifying a copy of the cloud total yield template:

#### Solar AC Total Yield ###

    - name: "Solax Local AC Total Yield"
      unique_id: solax_local_ac_total_yield
      state: "{{ (state_attr('sensor.solax_local', 'Data')[11]) | float(default=0) / 10 }}"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"

However, at the start of the day, it seemed to have a glitch where Total Yield would be its correct value, then drop to zero, then go back up to its correct value. The dashboard would then count the increase as generation, which would be wrong.

I am now trying 2 different definitions out:

  1. Continue to use the Total Yield data, but add a check for a 0 result and re-use the previous value, to get past the glitch
  2. Use the Daily Yield data. However, this drops to zero at sun down and I’m not sure how the dashboard will react to that.

The code I am using for these 2 new templates is:

#### Solar AC Total Yield - Error Check 0 Value ###

    - name: "Solax Dashboard AC Total Yield"
      unique_id: solax_dashboard_ac_total_yield
      state:  >
        {% if state_attr('sensor.solax_local', 'Data')[11] == 0 %}{{ states('sensor.solax_dashboard_ac_daily_yield') }}
        {% else %}{{ (state_attr('sensor.solax_local', 'Data')[11]) | float(default=0) / 10 }}{% endif %}
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"

#### Solar AC Dashboard Daily Yield ###

    - name: "Solax Dashboard AC Daily Yield"
      unique_id: solax_dashboard_ac_daily_yield
      state: "{{ (state_attr('sensor.solax_local', 'Data')[13]) | float(default=0) / 10 }}"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"

I updated these just now, so I’m trying these for the first time tomorrow. Feel free to give it a go too.

Hey! Thanks for answering!

What’s your inverter_type the Data makes me a bit nervous

Hi,

I have an X1 Boost string inverter, as opposed to the Hybrid. The Yield data appears to be in the same place in the output for both types of inverter, but other fields are in different places (PV1 power and PV2 power for example … I’m still working out which position in the array they are in).

BTW, the “Solax Dashboard AC Daily Yield” entity that I tested appears to be working correctly in the energy dashboard.

FYI had Issue with not reconnecting with inverter when router reset as it assigned a different Local IPv4 address to the inverter. Overcame this with IP reservation in the router settings. Might sound simple and people might know this ,but I am sure many do not. Did the same for home assistant just in case

1 Like

Hi Kamil,
Thanks for your great work! I have a Pocket Wifi version 2 so I uploaded the modified firmware from ChriSoft and was able to use the HA Solax integration from which I then copied and adapted all your nice sensor templates. :wink: :clap:
That seemed easier for me than use the REST platform with reverse proxy that somehow worked weird.

I’m now trying to get the automation for the hot water heater working but then I’m stuck trying to understand your binary sensor template. I don’t understand your OR statements and don’t see how the set states will make the binary sensor go from on to off to use in the automation as I don’t see any if or trigger.

Could you try to explain me in plain words what it is doing? (I’m pretty bad at templating…)

TIA

1 Like

Hi KamilB, thanks for this great way to get the data from LAN out of the Solax invertor. I was struggeling a lot with cloundrelated time-outs and slow refresh rates.

I have all scripts working, but all the LAN sensors doesn’t show any data. The Cloud sensors are working fine. When I do CURL via cli I get all data fine:

{“type”:“X1-Boost-Air-Mini”,“SN”:“SW…”,“ver”:“2.033.20”,“Data”:[5.3,0.0,392.5,0.0,8.7,233.2,2034,33,4.9,335.8,0,2084,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.00,0.00,0,0,0,0,0,0,0,50.00,0,0,0,0,0,0,0,0,0,0.00,0,0,0,0,0.00,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],“Information”:[5.000,4,“X1-Boost-Air-Mini”,“XB…”,1,2.18,0.00,1.36,0.00]}

So you can see I have a X1-Boost invertor (I have removed the serialnumbers from the output above). Is there something different with the mapping of the data?

I hope you can assist a little to get me running with Solax LAN.

Thank you!

1 Like

This worked great thank you very much for the simple instructions!

With the API documentation having a maximum 10,000 a day limit, I have changed the rate to 9 seconds. Is there a way to change the poll frequency dependent on time of day? Live data is useful during daylight hours but can be updated less in the evening/night as it would only be battery changes. The reason for asking is that it seems that with the high frequency the Solax Cloud app struggles with timeouts.

1 Like

Hi @ColinRobbins. I think I’ve managed to get the off-peak charging working pretty well, but there is one remaining scenario for which I’m not sure yet what’s the best strategy:

  • we get plenty of sunshine and the battery gets charged to full
  • by 0030 the next day (when the night tariff starts) the charge level is well above the charge from grid target (e.g. 50% left with target being 10%)
  • forced charge set from 0030 to 0430, allowed discharge 0000-2359
  • it seems that battery won’t discharge at all during the forced charge period
    What I’d like is to let the battery discharge until it drops to the new target rather than keep using off-peak grid and saving the battery for peak use. Any thoughts?

@leigh258 sorry, I don’t know how to make the poll frequency dynamic. I believe the API day limit only applies to the cloud API, doesn’t it? I haven’t seen any timeouts using the local connection and I poll every 5 seconds.

Hi @Freakandel. Unfortunately these mappings from an array to actual properties seem to differ from inverter to inverter. Maybe yours is one of those: solax/solax/inverters at 5fdb6d18acd78350b33fd645f69b4eb301167a72 · squishykid/solax · GitHub
Otherwise you might need to decode it yourself. Best way probably is to use the ‘local’ connection in the Solax app and while it’s refreshing the values, run the curl command to see which ones match. It’s a real shame that Solax don’t publish these mappings for us to use. Not sure how else to help…

1 Like

@patitocanardo give me a few days and I will try to describe the binary sensor idea better - just finishing a similar one for hot water immersion with Sonoff Powr3.

1 Like