Solax hybrid inverter

Can I get somes assistance configuring templates please. I’ve currently worked out the rest get functions to retrieve both history & live data. However I’m not so proficient at manipulation of the data to then be able to post to emoncms.
My yaml;

The info flowing from the inverter without any templates;

{“method”:“uploadsn”,“version”:“Solax_SI_CH_2nd_20160912 DE02”,“type”:“AL SE”,“SN”:“636B17DF”,“Data”:[0.0,0.0,0.0,0.0,1.2,248.9,222,31,10.9,2215.3,-18,0,0,50.26,-6.34,-320,11,0.0,445.9,0.00,0.00,50.09,0.0,0.0,0,0.00,0,0,0,0.00,0,8,0,0,0.00,0,8],“Status”:“2”}

As you can see there are lots of powers, currents, voltages spat out in the “data”: field and that’s all I want.
But my template just returns unknown.

If anyone else wants solax info I’m happy to help. I have reversed there app and packet sniffed.

Hi roy13, I have a Solax inverter and want it to be integrated in my HA. If I request the ip adress with api/realTimeData.htm I receive the mentioned data stream. Do you have the meaning of all the elements?

I have taken a few screen shots of my emoncms inputs. They are in order & I have labeled the ones I’ve worked out.
https://drive.google.com/folderview?id=0B15htSal63SJMTBXekNRZGNQelk
This is how I currently retrieve them.

  • platform: rest
    resource: http://10.19.79.100/api/realTimeData.htm
    value_template: ‘{{ value[102:1000] | replace("]","") | replace("}","") | replace(""","") | replace(“Status:”,"") | replace(",",",0") }}’
    name: Solax Live
    This is the automation i use to post them to emoncms

alias: SolaxLive to emoncms
trigger:
platform: time
minutes: ‘/1’
seconds: 0
action:
- service: rest_command.test_post
entity_id: rest_command.test_post

Don’t try to retreive them faster than 60 sec & if you stop retrieving them you can request history data

Hi Roy very interesting I have a solax invertet too. I insert the line that you suggested but i’m not able to collect all the relevant info, actual power, solar power, gride prover and battery.

this is the line that is coming from the inverter did you have suggestion to take the info ?

{“method”:“uploadsn”,“version”:“Solax_SI_CH_2nd_00000000_DE02”,“type”:“AL_SE”,“SN”:“12345678”,“Data”:[0.0,0.0,0.0,0.0,1.8,228.9,348,34,0.6,31.5,-40,0,0,51.87,-7.99,-416,19,58,0.0,10.9,0.00,0.00,50.01,0.0,0.0,0,0.00,0,0,0,0.00,0,8,0,0,0.00,0,8],“Status”:“2”}

what template i need to define ?

thank you

Sorry which part of my reply above on the 17th November how to template the data you sent doesn’t make sense. I also included screen shots of the data posted to emoncms.
Have you tried playing with my template in you template page?
Don’t forget you will get a large string of comma delimited numbers, not so usable in HASS that’s why I send them to emoncms.

Hi Roy, i’m not planning to use emoncms but i like to pass direct the json data from inverter to HASS. I understand that the interesting data are inside the “Data”:[0.0,0.0,0.0,0.0,1.8,228.9,348,34,0.6,31.5,-4… etc, so this is the point how to retrive these value from this type of json format. I did a search but i was not able to find any suggestion.

Hope that someone have the same problem.

I figured out the most of the meanings of the values. To show the data here is a html-file with ajax interface:

This is the styles file:

Just copy the html-file to you computer and start it. The current safety option of chrome do not support this data request so you have to start chrome with a lower safety option, this is it:

This is an overview of the known data fields:
Datafield:Description
0:PV1 Current
1:PV2 Current
2:PV1 Voltage
3:PV2 Voltage
4:Grid Current
5:Grid Voltage
6:Grid Power
7:Inner Temp
8:Solar Today
9:Solar Total
10:Feed In Power
11:PV1 Power
12:PV2 Power
13:Battery Voltage
14:Battery Current
15:Battery Power
16:Battery Temp
17
18:Battery Capacity
19:Solar Total 2
20

40
41:Energy to Grid
42:Energy from Grid
43

49
50:Grid Frequency
51
52
53:EPS Voltage
54:EPS Current
55:EPS VA
56:EPS Frequency

Hope this will bring light into the magic solax data stream.

By the way: What type of solax Inverter do you guys have?
Mine is a SK-SU5000E with Crystal-lead-battery and 4.3 kWp solar power on the Roof.

I found out that the measurement of the battery temperature with the external sensor is a unsigned number. That means if the battery temperature is negative the displayed temperatur value is 6550 degree Celsius. The Controller sees a “burning battery” and stops loading the battery. Can you observe tha same behavior?

I hope this helped you out marcoson.
I have a SK-TL5000E with 20kwh of Nissan leaf batteries.
Mine are inside so will never go below 0. So I cannot assist thank god, because what an oversight!

Hello Andreas great the HTML works ! now i need to scrape data from HTML to a sensor in HASSIO. My target is use HASSIO to switch some appliance automatically monitoring sun power, battery, temp etc, so now i need to work to isolate some variable but now should be more easy.

Regarding the battery temperature I have a Litium and the temperature stay in a range from 16 to 19 C max no over range.

That’s why I’m using emoncms as you can then make a sensor.

It will be nice once someone work’s out how to split the data into individual sensors.

Hi All
I know this sound like cheating, but does any one have a step by step guide as to the components & platforms needed to configure this as I just cannot get it to work with my HASSIO and Solax

Can you post the entries you have in your config files i.e configuration.yaml, sensor.yaml, automations.yaml etc

I am able to enter http://192.168.2.15/api/realTimeData.htm and get the following:
{“method”:“uploadsn”,“version”:“Solax_SI_CH_2nd_1234abcd_DE02”,“type”:“AL_SE”,“SN”:“123abc”,“Data”:[0.2,0.2,299.8,123.9,0.9,239.9,98,32,7.9,69.3,-6466,59,24,48.59,-0.15,-8,16,3,0.0,22.4,0.00,0.00,49.97,0.0,0.0,0,0.00,0,0,0,0.00,0,9,0,0,0.00,0,9],“Status”:“2”}

As above posts, am working on getting it into a emoncms sensor.ut struggling to get the config “valid”

Cheers
Matthew

step 1
set parameter to retrieve. This goes under sensor.

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

Next step in configuration sets up data to send to emoncms

rest_command:
test_post:
url: ‘http://EMONCMS.IP/emoncms/input/post.json?node=SELECTURNODENUMBERHERE&csv={{ states.sensor.solax_live.state }}&apikey=YOURAPIKEY’
method: ‘post’

This one goes in automation to send the data in the last step you just set up.

  • alias: SolaxLive to emoncms
    trigger:
    platform: time
    minutes: ‘/1’
    seconds: 0
    action:
    • service: rest_command.test_post
      entity_id: rest_command.test_post

Good luck.

Hi, Many thanks for the assistant

I have most of it in-place, but having issue with the live data. History seems to be working fine.

When i use value_template: ‘{{ value[102:1000] | replace("]","") | replace("}","") | replace(""","") | replace(“Status:”,"") | replace(",",",0") }}’

I get the following error when checking my config and cannot figure out why:
Sorry, this error: sensor.rest:

  • Invalid config for [sensor.rest]: invalid template (TemplateSyntaxError: expected token ‘,’, got ‘Status’) for dictionary value @ data[‘value_template’]. Got ‘{{ value[102:1000] | replace("]","") | replace("}","") | replace(""","") | replace(“Status:”,"") | replace(",",",0") }}’. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.rest/
  • platform: rest
    name: Solax Live
    resource: http://192.168.2.15/api/realTimeData.htm
    scan_interval: 0:01:00
    value_template: {{ value[102:1000] | replace("]","") | replace("}","") | replace(""","") | replace(“Status:”,"") | replace(",",",0") }}

If i replace the value_template with the history value_template it all checks out fine

Got my feed working with this value
{{ value[102:1000] | replace(“Status:”,"") | replace("]","") | replace("}","") | replace(""","") }}

Now to try and drop all the empty , or replace with 0

The best place to play with this is on the developers tools, templates page in the left panel of Home Assistant.
That’s how i got mine working. Unfortunately they have to be written differently so the sensor data can be called to template but nothing a bit of reading can’t find…Sorry it’s been a while since i set it up and cannot remember how to template.

Remember you can’t use realtime and history at the same time they must be separated by a set amount of time which i have not experimented with.

All working and in hassio now. Will post full details on how and what. I eventually figured out the template with the dev templates page

Many thanks to roy13 for the assistance and helping point me in the right direction.

Thank you to all the folks above for assistance in getting my SolaX Inverter info into hass.io especially roy13

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

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: Battery Capacity
19: ???
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 looking

45

Here is the yaml formated code: Solax hassio yaml.yaml (3.6 KB)

matthewjporter this is a really interesting work i’ will try on my inverter to see.

My question is. The flow of the process is : Take data from Solax inverter --> send to emoncms --> get data from emoncms ->> and finally convert these data for hassio.

Why we can not do simply this flow: Take data from Solax inverter–>> convert the data for Hassio.

is emoncms really needed ?

**