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
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:
- rest_command.solax_history
- minutes: ‘/30’
seconds: 00
platform: time
- data:
- action:
- data:
entity_id:- rest_command.solax_live
service: rest_command.solax_live
alias: Solax Live to emoncms
condition: []
id: ‘1521733112076’
trigger:
- rest_command.solax_live
- minutes: ‘/1’
seconds: 00
platform: time
- data:
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”
- 222533
-
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”
- 222539
-
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”
- 222536
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
Solax hassio yaml.yaml (3.6 KB)