SolaX Solar Inverter Setup Guide

So, here is my “How to” guide on setting up a SolaX Inverter with hass.io using emoncms

Shout out to the chaps on this thread https://community.home-assistant.io/t/solax-hybrid-inverter/22123

45

Step 1 – SolaX inverter setup
Ensure inverter is either wired or WiFi to your network
!!! Make sure you use a static or DHCP reservation for the IP of your inverter !!!
Login to http://INVERTERIP

Confirm datastream from inverter by checking you can access the following URL’s and get a response similar to these. Copy them to your favourite text editor
http://INVERTERIP/api/historyData.htm
datastream - [7.6,7.4,129.8,0.0,129.8,0.1,0.1,33.3,0.0,33.3]
http://INVERTERIP/api/realTimeData.htm
datastream - {“method”:“uploadsn”,“version”:“INVERTERVERSIONNUMBER”,“type”:“AL_SE”,“SN”:“INVERTERSERIALNUMBER”,“Data”:[1.4,1.5,313.7,129.9,2.8,244.2,660,33,4.3,126.5,-5167,439,194,48.58,-0.21,-11,11,4,0.0,33.3,0.00,0.00,50.03,0.0,0.0,0,0.00,0,0,0,0.00,0,9,0,0,0.00,0,9],“Status”:“2”}

Step 2 – emoncms setup part 1
You will need to setup and configure an emoncms account to manipulate the datastream from the Solax inverter to a sensor that hass.io can read
Create an Account at emoncms.org
!!! Take a note of your Read API Key and your Read & Write API Key !!!

Step 3 – hass.io setup part 1
Add to your configuration.yaml
emoncms_history:
api_key: Your Read&Write emoncms API Key
url: https://emoncms.org
inputnode: 11
whitelist:
- sensor.solax_live
- sensor.solax_history

rest_command:
solax_history:
url: ‘https://emoncms.org/input/post.json?node=1&csv={{ states.sensor.solax_history.state }}&apikey=Your Read&Write emoncms API Key’
method: ‘post’
solax_live:
url: ‘https://emoncms.org/input/post.json?node=2&csv={{ states.sensor.solax_live.state }}&apikey=Your Read&Write emoncms API Key’
method: ‘post’

!!! Change your node ID for each entry above to any number/name you wish as long as you do not have one already in use at emoncms

Step 4 – automations
Add the following to your automations.yaml

  • action:
    • data:
      entity_id:
      • rest_command.solax_history
        service: rest_command.solax_history
        alias: Solax History to emoncms
        condition: []
        id: ‘1521733256076’
        trigger:
    • minutes: ‘/30’
      seconds: 00
      platform: time
  • action:
    • data:
      entity_id:
      • rest_command.solax_live
        service: rest_command.solax_live
        alias: Solax Live to emoncms
        condition: []
        id: ‘1521733112076’
        trigger:
    • minutes: ‘/1’
      seconds: 00
      platform: time

Step 5 - Save all files & Reboot home assistant/hass.io

Step 6 – emoncms part 2
Wait at least 5 mins after reboot for the datastream to be uploaded and the two nodes and keys to be created in the inputs section of emoncms
Node 1 Should be the Historical data (uploaded every 5 mins)
Node 2 should be the Live data (uploaded every 1 min)

Currently I have the following datastream parameters mapped out (awaiting feedback from SolaX on exact datastream parameters)
Historical datastream
1: Solar Today
3: Solar Month or Year ?? (System to new to know yet)
5: Solar Month or Year ?? (System to new to know yet)

Live datastream
1: PV1 Current
2: PV2 Current
3: PV1 Voltage
4: PV2 Voltage
5: Grid Current
6: Grid Voltage
7: Grid Power
8: Inner Temp
9: Solar Today
10: Solar Total
11: Feed In Power
12: PV1 Power
13: PV2 Power
14: Battery Voltage
15: Battery Current
16: Battery Power
17: Battery Temp
18: ???
19: Battery Capacity
20: Solar Total 2

42: Energy to Grid
43: Energy from Grid

51: Grid Frequency

54: EPS Voltage
55: EPS Current
56: EPS VA
57: EPS Frequency

63: ???
68: ???
69: Status

Step 7 - hass.io part 2
Create Solax datastream read sensors under your sensor: section in configuration.yaml and add the following

  • platform: rest
    name: Solax Live
    resource: http://INVERTERIP/api/realTimeData.htm
    value_template: ‘{{ value[102:1000] | replace(“Status:”,"") | replace("]","") | replace("}","") }}’
    scan_interval: 60

  • platform: rest
    name: Solax History
    resource: http://192.168.2.15/api/historyData.htm
    value_template: ‘{{ value | replace("[","{") | replace("]", “};”) }}’
    scan_interval: 60

!!! You may need to run your value_template via the “Developver tools” Template section – took me some time, but the above works for me !!!

Step 8 - emoncms part 2
Create emoncms feeds based on the inputs that should now have been created
Take note of the feed ID’s

!!! I found it easier to edit the input description before creating the feeds as this will become you sensor name i.e sensor.emoncms_pv1_current !!!

Step 9 - hass.io part 3 - Create emoncms sensors in hassio
I have setup specific sensors from the datastream i want and are a usefull examples
I have also done some additional renaming based on the feedid passed from emoncms as i did not like having sonsor.emoncmsx_xxx_xxxxxx

Add the following into your sensor: section
!!! Replace the include_only_feed_id: sections with the feedid’s for the sensor you want from emoncms
!!! Replace the sensor_name: with each ID you want and add a freindlyname !!!
!!! I have split into different sections for the unit of measure otherwise all will come in as “A” !!!

  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    scan_interval: 30
    id: 2
    unit_of_measurement: “”
    include_only_feed_id:

    • 222533
      sensor_names:
      222533: “Inverter Status”
  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    scan_interval: 30
    id: 2
    unit_of_measurement: “W”
    include_only_feed_id:

    • 222533
    • 222528
    • 222524
    • 222529
    • 222530
      sensor_names:
      222533: “Battery Power”
      222528: “Grid Usage”
      222524: “Grid Power”
      222529: “PV1 Power”
      222530: “PV2 Power”
  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    id: 2
    scan_interval: 30
    unit_of_measurement: “A”
    include_only_feed_id:

    • 222519
    • 222520
    • 222522
    • 222532
      sensor_names:
      222519: “PV1 Current”
      222520: “PV2 Current”
      222522: “Grid Current”
      222532: “Battery Current”
  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    id: 2
    scan_interval: 30
    unit_of_measurement: “%”
    include_only_feed_id:

    • 222539
      sensor_names:
      222539: “Battery Capacity”
  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    id: 2
    scan_interval: 60
    unit_of_measurement: “V”
    include_only_feed_id:

    • 222523
    • 222538
    • 222521
    • 222531
      sensor_names:
      222523: “Grid Voltage”
      222538: “PV1 Voltage”
      222521: “PV2 Voltage”
      222531: “Battery Voltage”
  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    id: 2
    scan_interval: 60
    unit_of_measurement: “°C”
    include_only_feed_id:

    • 222525
    • 222534
      sensore_names:
      222525: “Inner Temp”
      222534: “Battery Temp”
  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    id: 2
    scan_interval: 30
    unit_of_measurement: “kWh”
    include_only_feed_id:

    • 222526
    • 222527
    • 222535
      sensor_names:
      222526: “Total Energy Today”
      222527: “Total Energy”
  • platform: emoncms
    api_key: Your Read emoncms API Key
    url: https://emoncms.org
    id: 2
    scan_interval: 30
    unit_of_measurement: “Hz”
    include_only_feed_id:

    • 222536
      sensor_names:
      222536: “Grid Frequency”

Step 10 - Save & Reboot

You should now have the individual sensor added to the top of your home page, If using then I suggest putting into a group as its a lot cleaner

Attached is a yaml formated file to copy and paste from :slight_smile:
Solax hassio yaml.yaml (3.6 KB)

This information was extremely helpful. Thank you! How did you find the hidden web pages?

Using this and some other geekery I’ve managed to get the Solax info into HASS using node-red. I’ll work on tidying it up over the next few days and share it as well. It takes out the EMONCMS requirements (then you don’t need na internet connection either!)

Hi Hotswapster

To answer you question, simply trawling the web for as much info, also the other post I have commented on in this regards had a lot of info

I have been in contact with my local Solax installer and they could not tell me much

Solaxpower have also been a waste of time as they never respond to emails from their website contact form

Anyway, Would be very interested in knowing your setup. Seems like it is the answer to moving away from emoncms

yeah i tried getting in contact with Solax also and they wouldn’t give me the configuration software :confused:

Here’s how I get the info from the inverter to my HASS:

  1. Put Inverter on your network (Ethernet or Wifi). Use either a DHCP Reservation, Static IP or configure your DNS and give your inverter a name.
  2. Install an MQTT Broker (if you do not already have one)
  3. Install Node-red (google instructions, it’s not hard).
  4. Install the following nodes in Node-red: node-red-dashboard, node-red-contrib-string
  5. Copy code below
  6. In your Node-red installation <<IP_of_Node-red>>:1880
  7. Click menu in top right corner>Import>From Clipboard
  8. Paste the code below into that space
  9. Read the readme
  10. Put Inverter IP/Name in the “Inverter IP Here” node (replace the IP address that is there, leave the rest of the address as is).
  11. Hit Deploy
  12. Click square to the left of “Make Request”
  13. Go to <<IP_of_Node-red>>:1880/ui
  14. You should see values in the Dashboard under the IP in Step 13. If you do, the connection from the Inverter to Node-red is good.
  15. Configure MQTT broker in the “Configure MQTT here” node. Click the pencil next to the server. Remember authentication if you have it on your MQTT server. Leave topic blank (it’s configured in the large function).
  16. Hit Deploy.
  17. Check values at your MQTT server (you can google this as each server is different).
  18. Configure sensors in HASS as per sensor code below.
  19. Voila!

Sensor yaml:
- platform: mqtt
state_topic: “solax/energy/gridPower”
name: “Grid Power”
unit_of_measurement: “KW”
payload_not_available: “offline”

Node-red Code:
https://www.dropbox.com/sh/fsxabozu4b2gkaf/AABXy8GGOy0VLekWIKHB_jlqa?dl=0

…and some screenshots to top it off:


Can you paste you code in a file, I think as I had with mine, it is screwing it around and changing characters.

I have tried to import and also run via a json validator but it is finding many errors

Cheers

hey @matthewjporter, have put a text file in dropbox. Let me know if the link doesn’t work.

I found that the realtime data updates often. I set the code above to do a 5 minute refresh but it appears to update every second or so.

Thank you, worked like a charm. I now have my Solax Hybrid and Boost inverters in the Node-Red dashboard

Thinking of putting a pi zerow with a 3.5" or 5" display in the utility room and the parents annexe to show if we are producing power or not and id the dish washer, washing and drying machines be put on etc :slight_smile:

Working on my required sensors and will post pics once I have completed a dashboard and hassio

P.S Love the naming convention used :slight_smile:

1 Like

I’m interested to see your Pi zero when it’s done. I have been trying to think of ways to achieve the same thing - identify what can be run with the spare generating capacity.

Hey @matthewjporter, I found an error in the function. “Status” had the wrong array address in it. Was listed at 68 and should be 62.

Thanks @hotswapster,

Was wondering why it was not showing up but I have not really figured the need for the status or its meaning so was not conecerned

I am now, thanks to your efforts on this, starting to learn Node-Red and am going to try combining my X1 Hybrid and X1 Boost into single feed to present into Hassio (any tips) for my pi zerow/wemos project to show either the dashboard on a pi zerow or have a wemos with a red & green LED to show generation status - will keep you updated

On another note, do you have a battery on your system? My X1 Hybrid shows my battery capacity as 0

You can see on my summary I have changed the reading 100 and %

Node-red is neat. The more I used it, the more I like it. I just found there is a HASS node for node red and a Node-red plug-in(?) for HASS. The two can integrate better than what I showed above (I’m still learning too).

I don’t have a battery. If you take the http address out of the “Inverter IP here” box and put it in a browser, see if there is a number there that relates to how full your battery it.

In regards to sending it all to HASS in one feed, I’m assuming that you have your node-red configurations in one flow. I think the way to do it, would be change the topic. One way (which I haven’t tried and don’t know it will work) if to add a topic in the MQTT node. This may add an extra topic prefix? I’m not sure.

The other way, and one I would be able to “see” work, is to open the function up and change the topic there. Example below. First line same as you code, second line has the X1 addition:

PV1Current = { payload: realtimeArray[0][0], topic: “solax/energy/pv1i”};
PV2Current = { payload: realtimeArray[0][1], topic: “solaxX1/energy/pv2i”};

once you do this, you can wire the outputs of the function to the same MQTT node.

I also got history working. I put the code in that same dropbox link.

Looks like I had miss counted along datastream for the battery, I had put 18 but its 17 as you have to start at 0 and is now showing correct

42

I have already created a single flow using one mqqt feed as you have suggested using a single mqqt node

My next step is to combine the output of similar nodes i.e PV1 & PV2 on the one inverter and PV1 + PV2 on the other inverter = total generation - I think I have it, just testing today

I am going to try for a single function block which will have both inverters feeding in but as you suggested, will need to get the topics separate as I think that will be the key

Will look at the history, that was going to be my next attempt but since yo have done the work saves me the trouble

Cheers

1 Like

Hey @matthewjporter,
I managed to tidy up the start of this code a bit. The string from the inverter is a JSON object but the node-red JSON node errors out. If you replace it with a YAML node, it reads the object correctly.
If you want to update you code, I’ve put a file in that dropbox called new_data_aq.json. Import that through the menu and then wire it to the large function. This means you can delete the splits and switches. The last thing to do is open the function and change the array references.

  1. Remove the first [0] on each line:
    PV2Current = { payload: realtimeArray[0][1], topic: “solax/energy/pv2i”}; //original
    PV2Current = { payload: realtimeArray[1], topic: “solax/energy/pv2i”}; //updated
  2. Change the realtimeArray reference:
    var realtimeArray = msg.payload ; //original
    var realtimeArray = msg.payload.Data ; //updated

You can also pull the other data out by referencing msg.payload.version, msg.payload.type, msg.payload.SN, msg.payload.status.

1 Like

I managed to get this working.
The dashboard is working fine. but the message are not send to MQTT, so I can see them also in Hassio.
I have one error “SyntaxError: Unexpected token u in JSON at position 0” where do I have to look to fixed this.

Hi Jossie67

Are you trying to setup the realtime or history? are you importing the new yaml flow or old json flow
First off, I would check you did not miss off a character when copying and pasting
Second, check you function and see if you have removed the leading [0] based on the updated yaml not the old json format / flow
Third, Are you using the built mqtt server? do you have other mqtt feeds? if not a good place to start is ssh into hassio and run the following:
mosquitto_sub -h YOUR.HASSIO.IP.HERE -v -t “#”

This will list all mqtt feeds into the broker and will confirm mqtt is actually working

Matthew

Hey @jossie67,

use the debug node to find out where the error start’s occurring. There are some videos on YouTube that show you how to use it. Show us where the error is appearing and maybe we can help a little more?

Also post the string you read form your inverter. It may be a different model?

Sorry, wasn’t at home te last day’s
it working this issue was that some
“these a quotes are used”
“and sometime these”
So I changed them al to
“these”
Since then is it working :grinning:

Has some also add the way to send this also to pvout.org

That was my initial issue, which I have had many times. The forum does not convert " " correctly when copying and pasting (both ways)

Glad you got it sorted

Hello,

A question a bit absurd, which are or where you get the credentials of access to the investor?

regards