Solax Cloud - data over API

Solax inverter is connected to internet by wire, also worked when you have Wifi dongle. Tested on Solax X3.

Thank you for inspiration:

ToDo:

  • upload time timestamp
  • icons
  • device_states

https://github.com/lowprize/homeassistant-solax-api

  - platform: rest
    name: Solax API
    resource: https://www.eu.solaxcloud.com:9443/proxy/api/getRealtimeInfo.do?tokenId=XXXXXXXXXXXXXXXXXXXXXXXXXX&sn=XXXXXXXX
    method: GET
    scan_interval: 15
    value_template: 'OK'
    json_attributes:
    - success
    - exception
    - result
  - platform: template
    sensors:
      solax_api_sn:
        friendly_name: "Unique identifier of communication module"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["sn"] }}'
      solax_api_acpower:
        friendly_name: "Inverter AC power total"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["acpower"] }}'
        unit_of_measurement: "kW"
      solax_api_yieldtoday:
        friendly_name: "Inverter AC energy out daily"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["yieldtoday"] }}'
        unit_of_measurement: "kW"
      solax_api_yieldtotal:
        friendly_name: "Inverter AC energy out total"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["yieldtotal"] }}'
        unit_of_measurement: "kW"
      solax_api_feedinpower:
        friendly_name: "Grid power total"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["feedinpower"] }}'
        unit_of_measurement: "W"
      solax_api_feedinenergy:
        friendly_name: "Grid energy to Grid total"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["feedinenergy"] }}'
        unit_of_measurement: "kW"
      solax_api_consumeenergy:
        friendly_name: "Grid energy from Grid total "  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["consumeenergy"] }}'
        unit_of_measurement: "kW"    
      solax_api_feedinpowerm2:
        friendly_name: "Inverter Meter2 AC power total"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["feedinpowerM2"] }}'
        unit_of_measurement: "W"
      solax_api_soc:
        friendly_name: "BMS energy SOC"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["soc"] }}'
        unit_of_measurement: "%"
      solax_api_peps1:
        friendly_name: "Inverter AC EPS power R"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["peps1"] }}'
        unit_of_measurement: "W"
      solax_api_peps2:
        friendly_name: "Inverter AC EPS power S"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["peps2"] }}'
        unit_of_measurement: "W"
      solax_api_peps3:
        friendly_name: "Inverter AC EPS power T"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["peps3"] }}'
        unit_of_measurement: "W"
# Ivertor type
      solax_api_invertertype:
        friendly_name: "Inverter Type"  
        value_template: >-
          {% if states.sensor.solax_api.attributes["result"]["inverterType"] == "1" %}
            X1-LX
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "2" %}
            X-Hybrid
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "3" %}
            X1-Hybiyd/Fit
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "4" %}
            X1-Boost/Air/Mini
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "5" %}
            X3-Hybiyd/Fit
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "6" %}
            X3-20K/30K           
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "7" %}
            X3-MIC/PRO           
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "8" %}
            X1-Smart
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "9" %}
            X1-AC
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "10" %}
            A1-Hybrid
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "11" %}
            A1-Fit
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "12" %}
            A1-Grid
          {% elif states.sensor.solax_api.attributes["result"]["inverterType"] == "13" %}
            J1-ESS           
          {% else %}
            Unknown
          {% endif %}
# End of Invertor type
  
# Invertor status
      solax_api_inverterstatus:
        friendly_name: "Inverter status"
        value_template: >-
          {% if states.sensor.solax_api.attributes["result"]["inverterStatus"] == "100" %}
            Wait Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "101" %}
            Check Mode            
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "102" %}
            Normal Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "103" %}
            Fault Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "104" %}
            Permanent Fault Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "105" %}
            Update Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "106" %}
            EPS Check Mode           
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "107" %}
            EPS Mode           
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "108" %}
            Self-Test Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "109" %}
            Idle Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "110" %}
            Standby Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "111" %}
            Pv Wake Up Bat Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "112" %}
            Gen Check Mode
          {% elif states.sensor.solax_api.attributes["result"]["inverterStatus"] == "113" %}
            Gen Run Mode           
          {% else %}
            Unknown status
          {% endif %}
# End of Invertor status
        
      solax_api_uploadtime:
        friendly_name: "Update time"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["uploadTime"] }}' 
      solax_api_batpower:
        friendly_name: "Inverter DC Battery power total"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["batPower"] }}'
        unit_of_measurement: "W"
      solax_api_powerdc1 :
        friendly_name: "Inverter DC PV power MPPT1"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["powerdc1"] }}'
        unit_of_measurement: "W"
      solax_api_powerdc2:
        friendly_name: "Inverter DC PV power MPPT2"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["powerdc2"] }}'
        unit_of_measurement: "W"
      solax_api_powerdc3:
        friendly_name: "Inverter DC PV power MPPT3"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["powerdc3"] }}'
        unit_of_measurement: "W"
      solax_api_powerdc4:
        friendly_name: "Inverter DC PV power MPPT4"  
        value_template: '{{ states.sensor.solax_api.attributes["result"]["powerdc4"] }}'
        unit_of_measurement: "W"        

2 Likes

hi @lowprize … many thanks for sharing this, particularly as I think this is based on the most recent version of the Solax api (V6.1).

As a newbie to HA and onl “tinkered around” so far, I am using linking my Solax inverter as my first real venture into home assistant. I have HA (Home Assistant 2022.7.7 Supervisor 2022.07.0 Operating System 8.4 Frontend 20220707.1 - latest) installed on a rpi4.

I have managed to add your code to configuration.yaml and add the solax-api.yaml file to the \config directory, and pass the configuration check and restart HA . However, I don’t seem to be able to find any data when I look at either the “dashboards” or “devices and services” as there are no relevant “entities” showing, nor can I see any error showing in the logs.

Can you point me in the right direction to be able to access and use the data?

hi @lowprize … as they say in the instructions “read and follow”, which I obviously hadn’t, so sorry about that.

Having named the sensor file correctly and amended the configuration.yaml file as instructed, it all works!

1 Like

Sorry, dont have notification to mail. Im newbie and also not coder :slight_smile:

I’m very new at this too, I’m running HA in a virtual machine on my NAS, I’m VERY new to Linux etc and also have a Solax Inverter and would love to add to HA, would you give me an idiots guide on how to add this functionality to HA please? Where do I place the files and how?

Richard

Check first post, where is the link with install. First search for walkthru how to edit file and where is stored config folder.
You can find me on telegram @lowprize

I have implemented the code and it works perfectly! The only thing I would still like to do is add it to the energy dashboard, so I can combine it with the results from my SolarEdge. Has anyone got any suggestions on how to do this?

Same problem here, did not manage to get this in energy dashboard. I have seen a lot of ways to manage, but for some reason I don’t get it working here. In own dashboard this is working fine. It has to do with: kw > should be kWh, increasing and a start point/date. I put this in configuration.yaml. Not working yet.

Works now. I had to restart and wait for about 2 hours before running. Afther one full day, the dashboard was really running as it should be. Thanks for everyone who helped.
I enhanced the code a little bit in to this (not written by myself, only changed name, found other code in forum)

template:
  - sensor:
      - name: PV opbrengst (Total)
        state: "{{ states('sensor.solax_api_yieldtotal') | float }}"
        availability: "{{ states('sensor.solax_api_yieldtotal') | float > 0 }}"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        attributes:
           last_reset: "1970-01-01T00:00:00+00:00"
1 Like

I have a Solax Xi Mini 2kW, and have the above solaxcloud solution working fine (although there is a restriction on how many calls you can make in 1 minute), so I’ve been trying, unsucsessfully, to get realtime data locally, not via solaxcloud, but I am unable to get any retrun results. I have tried the various other solutions (5.8.8.8, etc) for other Solax Inverters, but it seems the Mini is different when it comes to local API.