Solax X1 Hybrid G4 (local & cloud API)

Awesome. Ill have to modify my sensors. Seems to only be the cloud data, solax app has no interruptions when i monitor that data. Habent figured out the local connection yet, cant enter the login/pwd

@kamilb @ColinRobbins Hi, many thanks for a fantastic collaboration between the two if you providing a fantastic solax solution to many of us.
As a newbie I do have one small query though. Could you please advise how to configure the power flow chart correctly with the local data.
I have one running with the cloud info which appears correct when compared to the solax app, but for some reason I can’t get the grid and load parts to show correct flows or figures.
Many thanks.

Can you provide more information on what the problem is?
When you say it is not showing correctly, what exactly do you see?
Which sensors have you used in the chart?
Outside of the chart, as these sensors showing the correct data?

Can anyone send me csv of the data they collect, 1-4months

Much appreciated!

@patitocanardo @ColinRobbins I’ve finally managed to finish my immersion heating for hot water - see Smart immersion heating for domestic hot water for details. If it’s still not clear there, do let me know and I will try to describe it better :slight_smile:

1 Like

Hi, I have implemented the code as above (left out the battery part since I do not have a battery). But whatever I do, I can’t get any data shown in the local sensors. The cloud sensors are working. I see the local api is running every minute (i have set to 60 seconds). But the sensor.solax_local_xx are not available, not contain any data. Let alone the correct mapping for my X1-Boost-Air-mini inverter.

I find it hard to troubleshoot this, because I can’t see what Home Assistant is getting from the local API request. Maybe it is an errormessage. The local CURL command is working perfectly, but maybe Home Assistant gets another answer.

@kamilb Many thanks for this great work. I am using your latest code as a template for my project.

I notice the secrets file has changed since the original post. Could you add or document the format needed for e.g. solax_local_set_battery_grid_charge_level_payload :+1:

Hi @Belly_Buster. Well spotted! The secrets.yaml is missing from the git repo as I couldn’t find an easy way to exclude the senstitive info there. I’ve updated the secrets.yaml snippet here so it should be complete now.

1 Like

@kamilb : just starting to integrate the solax cloud in to HA and find your great posting here. One question: do you use a wifi dongle for the inverter or a lan version? I have only the lan version installed. Any diiferences betwwen both ?

As answer to my own post I am a step further but still I can’t get the local sensor data active in HA.

This is a screenshot from the sensors (test_cloud and rest_local) from the developmenttool:

So I know that the local readout of the Solax is working correctly. Also, what I can see from the data, is that the following mapping is applicable for my Solax X1-Boost-Air-Mini (the important ones):

image

How can I change the sourcecoude to these values? I find it very strange that my devices are all ‘not available’ in HA:

Please help, I think it is not a very complicated issue since all data is in HA.

@Freakandel I believe you need to parse these values and turn them into individual template sensors - see my configuration.yaml

@StephanErdmann I only have the Wifi dongle

@StephanErdmann I also have the PocketLan v3.0 and cannot talk to it…

Hope someone has a clue but it appears not to listen on any port.
Cannot believe such a difference between LAN and WIFI.

If this does not work I will try the DNS option to fetch it’s outgoing communication

Hi Kamil

Great work! I have just started setting up Home Assistant and I had my Solax inverter connected just following your steps!
I have a question for all of you, I am getting crazy trying to get this working. I need to store the local values for some Solax power meterings to be sent to a Trydan car charger, so I need to store them in mqtt. I have been trying to send the information to mqtt or tell HA to store them somewhere there but I am getting no sucess at all. How can I store for example solax_local_pv_output in mqtt?

Thanks!!

@kamilb - First of all, Thanks for the brilliant piece of work. I was looking for a similar setup like this and I landed on your page. I have set up everything as you mentioned in your page. Set up the dashboard as well. I am able to successfully pull the data from Cloud. But when it comes to local then I am struggling. I believe I have set up all codes and parameters correctly. However, the dashbaoard is not fetching any Local data. Can you think of any reason which might be causing this? Please see below my setups. I have also checked my API using the Curl command example you provided, it also working fine. So don’t able to figure out where exactly its going wrong. Any help will be highly appreciated.

BR
Manu

Hi @ColinRobbins many thanks for your reply, please see screenshots attached taken at the same time. Cloud chart is correct but local chart completely incorrect including the flow arrows.

20230218_135157|690x388!

20230218_135208|690x388

So either you have not used the correct sensors in the chart, the sensor are not configured correctly, or you solax is returning data in different fields.
You’ll need to trace this back, looking at the sensors values in developer / states.

I had issues connecting to local also These are all the steps I took:

Had to find the dongle local IP address. Mine is 192.168.0.1xx Found it in the router attached devices on and showed as “espressif”
I did a IP reservation in my router settings for the inverter to ensure it always has the same IP address.

The password for the local query in the secrets.yaml will be the dongle serial the one below the QR code on the dongle.

Finally I substituted the serial number from the dongle above in all these areas in the config file

Hope this helps. Took me a while to get right

1 Like

Hi, I’ve finally figure it out, now the local values are working fine.

In the local API output of my Solax invertor the serial number entity “sn” is capitalized as “SN”. I didn’t realized that this make a difference in the parsing of the JSON. After changing the script it worked!

Now I can begin mapping the correct values. A mayor step forward!

2 Likes

Hi,

I have been following a few guides with this API for solax etc. Can anyone tell me where I could be going wrong. It is reading data through the entities, but im not getting anything on the Energy dashboard.

Thankyou so much in advance.



sensor:
- platform: rest
  scan_interval: 60
  resource: https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId=XXXXX&sn=XXXXX
  name: "Solax 1"
  json_attributes_path: "$.result"
  json_attributes:
    - yieldtoday
    - yieldtotal
    - powerdc1
    - powerdc2
    - uploadTime
    - inverterStatus
    - acpower
    - feedinpower
    - feedinenergy
    - soc
    - consumeenergy
  value_template: "1" # dummy value; not used; avoids error
- platform: template
  sensors:
    solax_1_today:
      friendly_name: "Solax 1 today"
      value_template: "{{ state_attr('sensor.solax_1', 'yieldtoday') }}"
      unit_of_measurement: "kWh"
    solax_1_total:
      friendly_name: "Solax 1 total"
      value_template: "{{ state_attr('sensor.solax_1', 'yieldtotal') }}"
      unit_of_measurement: "kWh"
    solax_1_now:
      friendly_name: "Solax 1 now"
      value_template: "{{ state_attr('sensor.solax_1', 'acpower') }}"
      unit_of_measurement: "W"
    solax_1_pv1:
      friendly_name: "Solax 1 PV Power1"
      value_template: "{{ state_attr('sensor.solax_1', 'powerdc1') }}"
    solax_1_pv2:
      friendly_name: "Solax 1 PV Power2"
      value_template: "{{ state_attr('sensor.solax_1', 'powerdc2') }}"
      unit_of_measurement: "W"
      icon_template: mdi:solar-panel
    solax_1_pin:
      friendly_name: "Solax 1 FeedIn Power"
      value_template: "{{ state_attr('sensor.solax_1', 'feedinpower') }}"
      unit_of_measurement: "W"
    solax_1_ein:
      friendly_name: "Solax 1 FeedIn Energy"
      value_template: "{{ state_attr('sensor.solax_1', 'feedinenergy') }}"
      unit_of_measurement: "kWh"
    solax_1_econ:
      friendly_name: "Solax 1 Consume Energy"
      value_template: "{{ state_attr('sensor.solax_1', 'consumeenergy') }}"
      unit_of_measurement: "kWh"
    solax_1_upload_time:
      friendly_name: "Solax 1 upload time"
      value_template: "{{ state_attr('sensor.solax_1', 'uploadTime') }}"
      icon_template: mdi:alarm-check
    solax_1_status:
      friendly_name: "Solax 1 status"
      value_template: >
        {% if state_attr('sensor.solax_1', 'inverterStatus') == '100' %}Wait
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '101' %}Check
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '102' %}Normal
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '103' %}Fault
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '104' %}Permanent Fault
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '105' %}Update
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '106' %}EPS Check
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '107' %}EPS
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '108' %}Self-test
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '109' %}Idle
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '110' %}Standby
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '111' %}Pv Wake Up Bat
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '112' %}Gen Check
        {% elif state_attr('sensor.solax_1', 'inverterStatus') == '113' %}Gen Run
        {% else %}I dont know{% endif %}
    solax_now:
      friendly_name: "Inverter Power"
      unit_of_measurement: "W"
      value_template: "{{ (states('sensor.solax_1_now') | float) }}"
      icon_template: mdi:lightning-bolt-circle
    solax_today:
      friendly_name: "PV today"
      unit_of_measurement: "kWh"
      value_template: "{{ (states('sensor.solax_1_today') | float) }}"
    solax_total:
      friendly_name: "PV total"
      unit_of_measurement: "kWh"
      value_template: "{{ (states('sensor.solax_1_total') | float) }}"
    solax_pv_power1:
      friendly_name: "PV Power1"
      unit_of_measurement: "W"
      value_template: "{{ (states('sensor.solax_1_pv1') | float) }}"
      icon_template: mdi:solar-power-variant-outline
    solax_pv_power2:
      friendly_name: "PV Power2"
      unit_of_measurement: "W"
      value_template: "{{ (states('sensor.solax_1_pv2') | float) }}"
      icon_template: mdi:solar-power-variant-outline
    solax_pv_power_total:
      friendly_name: "PV Power Total"
      unit_of_measurement: "W"
      value_template: "{{ (states('sensor.solax_1_pv2') | float) + (states('sensor.solax_1_pv1') | float) }}"
      icon_template: mdi:solar-power-variant
    solax_house_cons:
      friendly_name: "House Power"
      unit_of_measurement: "W"
      value_template: "{{ (states('sensor.solax_1_now') | float) - (states('sensor.solax_1_pin') | float) }}"
      icon_template: mdi:home-lightning-bolt-outline
    solax_feedin_power:
      friendly_name: "Grid Power"
      unit_of_measurement: "W"
      icon_template: mdi:transmission-tower
      value_template: "{{ (states('sensor.solax_1_pin') | float) }}"
    solax_feedin_energy:
      friendly_name: "FeedIn Energy"
      unit_of_measurement: "kWh"
      value_template: "{{ (states('sensor.solax_1_ein') | float) }}"
    solax_consume_energy:
      friendly_name: "Consume Energy"
      unit_of_measurement: "kWh"
      value_template: "{{ (states('sensor.solax_1_econ') | float) }}"
    solax_consume_power:
      friendly_name: "Consume Power"
      unit_of_measurement: "W"
      value_template: "{{ (states('sensor.solax_1_now') | float) - (states('sensor.solax_1_pin') | float) }}"
      
- platform: integration
  source: sensor.solax_house_cons
  name: selfiehome_energy_spent
  unit_prefix: k
  round: 2
template:
  - sensor:
    - name: test_energy
      state: "{{ states('sensor.solax_total') }}" 
      unit_of_measurement: 'kWh'
      state_class: measurement
      device_class: energy
      attributes:         
          last_reset: '1970-01-01T00:00:00+00:00'