Solax X3-Hybrid G4 Wifi Firmware Solax module fw version 3.003.02 Home Assistant Integration

Simple code to get all Data via API direct from you Solax Pocket Wifi 2.0 with firmare 3.003.02.
I found a very interesting post homeassistant-cz, copied the code, reworked it.

Running on
Home Assistant 2022.11.3
Supervisor 2022.10.2
Operating System 9.3
Frontend 20221108.0 - latest

You just need to add code to configuration.yaml, templates.yaml and then add 1 device to the energy dashboard.

add this to configuration.yaml don’t forget to adapt the IP of your solax module amd the password (just read the QR code on the stick)

### Solax REST command online sensor ###
rest:
  - authentication: digest
    scan_interval: 10
    resource: http://###.###.###.####/                       # IP of solax module
    payload: "optType=ReadRealTimeData&pwd=xxxxxxxxxxx"  # replace xxxxxxxxxx with password in whole file
    method: POST
    headers: 
      Content-Type: "application/x-www-form-urlencoded"
    sensor:
      - name: "solax_rest_data"
        json_attributes:
        - sn
        - ver
        - type
        - Data
        - Information
        value_template: 'OK'  # dummy value, not used; avoids the "State max length is 255 characters" error

add this to templates.yaml
if you don~t use a template.yaml file add the templates to configuration.yaml and add this on top (as mentioned by Trilis29)
do not forget to exchange the “xxxxxxxxx” with the serial number of your device.

- platform: template
  sensors:
  ###Solax
  - name: solax
    state: > 
            {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx"  %}{{ now() }}
            {% else %}{{ (states('sensor.solax')) }}{% endif %}
    attributes: 
      sn: >-
            {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'sn')) }}
            {% else %}{{ (state_attr('sensor.solax', 'sn')) }}{% endif %}
      ver: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'ver')) }}
          {% else %}{{ (state_attr('sensor.solax', 'ver')) }}{% endif %}
      type: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'type')) }}
          {% else %}{{ (state_attr('sensor.solax', 'type')) }}{% endif %}
      Data: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'Data')) }}
          {% else %}{{ (state_attr('sensor.solax', 'Data')) }}{% endif %}
      Information: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'Information')) }}
          {% else %}{{ (state_attr('sensor.solax', 'Information')) }}{% endif %}

###AC detailed information
  - name: "Solax L1 Voltage"
    state: "{{ state_attr('sensor.solax', 'Data')[0] | int(default=2300) / 10}}"
    unit_of_measurement: "V"
    device_class: "voltage"

  - name: "Solax L2 Voltage"
    state: "{{ state_attr('sensor.solax', 'Data')[1] | int(default=2300) / 10}}"
    unit_of_measurement: "V"
    device_class: "voltage"

  - name: "Solax L3 Voltage"
    state: "{{ state_attr('sensor.solax', 'Data')[2] | int(default=2300) / 10 }}"
    unit_of_measurement: "V"
    device_class: "voltage"

  - name: "Solax L1 Current"
    state: >
      {% if state_attr('sensor.solax', 'Data')[3] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[3] - 65536) | int(default=0) / 10 }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[3] | int(default=0) / 10 }}{% endif %}
    unit_of_measurement: "A"
    device_class: "current"

  - name: "Solax L2 Current"
    state: >
      {% if state_attr('sensor.solax', 'Data')[4] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[4] - 65536) | int(default=0) / 10 }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[4] | int(default=0) / 10 }}{% endif %}
    unit_of_measurement: "A"
    device_class: "current"

  - name: "Solax L3 Current"
    state: >
      {% if state_attr('sensor.solax', 'Data')[5] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[5] - 65536) | int(default=0) / 10 }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[5] | int(default=0) / 10 }}{% endif %}
    unit_of_measurement: "A"
    device_class: "current"

  - name: "Solax L1 Power"
    state: >
      {% if state_attr('sensor.solax', 'Data')[6] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[6] - 65536) | int(default=0) }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[6] | int(default=0) }}{% endif %}
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax L2 Power"
    state: >
      {% if state_attr('sensor.solax', 'Data')[7] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[7] - 65536) | int(default=0) }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[7] | int(default=0) }}{% endif %}
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax L3 Power"
    state: >
      {% if state_attr('sensor.solax', 'Data')[8] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[8] - 65536) | int(default=0) }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[8] | int(default=0) }}{% endif %}
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax Total AC Power"
    state: >
      {% if state_attr('sensor.solax', 'Data')[9] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[9] - 65536) | int(default=0) }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[9] | int(default=0) }}{% endif %}
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax L1 Frequency"
    state: "{{ state_attr('sensor.solax', 'Data')[16] | int(default=5000) / 100}}"
    unit_of_measurement: "Hz"
    device_class: "frequency"

  - name: "Solax L2 Frequency"
    state: "{{ state_attr('sensor.solax', 'Data')[17] | int(default=5000) / 100}}"
    unit_of_measurement: "Hz"
    device_class: "frequency"

  - name: "Solax L3 Frequency"
    state: "{{ state_attr('sensor.solax', 'Data')[18] | int(default=5000) / 100}}"
    unit_of_measurement: "Hz"
    device_class: "frequency"

### Solax Summary and statistic sensors ###
  - name: "Solax Feed-in Power"
    state: >
      {% if state_attr('sensor.solax', 'Data')[34] > 32767 %}{{ state_attr('sensor.solax', 'Data')[34] - 65536 }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[34] }}{% endif %}
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax Consumption"
    state: >
      {% if state_attr('sensor.solax', 'Data')[47] > 32767 %}{{ state_attr('sensor.solax', 'Data')[47] - 65536 }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[47] }}{% endif %}
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax Energy total"
    state: "{{ ((state_attr('sensor.solax', 'Data')[69] * 65536) + state_attr('sensor.solax', 'Data')[68]) | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

### Today's statistics ###
  - name: "Solax Grid out today"
    state: "{{ state_attr('sensor.solax', 'Data')[90] | float / 100 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

  - name: "Solax Grid in today"
    state: "{{ state_attr('sensor.solax', 'Data')[92] | float / 100 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

  - name: "Solax Battery discharge today"
    state: "{{ state_attr('sensor.solax', 'Data')[78] | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

  - name: "Solax Battery charge today"
    state: "{{ state_attr('sensor.solax', 'Data')[79] | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

  - name: "Solax Energy today"
    state: "{{ state_attr('sensor.solax', 'Data')[82] | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

  - name: "Solax Energy incl battery today"
    state: "{{ state_attr('sensor.solax', 'Data')[70] | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

### Total values for Energy panel - needs customization in customize.yaml ###
  - name: "Solax Solar energy total"
    state: "{{ ((state_attr('sensor.solax', 'Data')[81] * 65536) + state_attr('sensor.solax', 'Data')[80]) | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

  - name: "Solax Grid out total"
    state: "{{ ((state_attr('sensor.solax', 'Data')[87] * 65536) + state_attr('sensor.solax', 'Data')[86]) | float / 100 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

  - name: "Solax Grid in total"
    state: "{{ ((state_attr('sensor.solax', 'Data')[89] * 65536) + state_attr('sensor.solax', 'Data')[88]) | float / 100 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

  - name: "Solax Consumption total"
    state: "{{ state_attr('sensor.solax', 'Data')[88] | float / 100 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

  - name: "Solax Battery discharge total"
    state: "{{ ((state_attr('sensor.solax', 'Data')[75] * 65536) + state_attr('sensor.solax', 'Data')[74]) | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

  - name: "Solax Battery charge total"
    state: "{{ ((state_attr('sensor.solax', 'Data')[77] * 65536) + state_attr('sensor.solax', 'Data')[76]) | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

### PV detailed information ###      
  - name: "Solax PV1 Voltage"
    state: "{{ state_attr('sensor.solax', 'Data')[10] | int(default=0) / 10}}"
    unit_of_measurement: "V"
    device_class: "voltage"

  - name: "Solax PV2 Voltage"
    state: "{{ state_attr('sensor.solax', 'Data')[11] | int(default=0) / 10}}"
    unit_of_measurement: "V"
    device_class: "voltage"
    
  - name: "Solax PV1 Current"
    state: "{{ state_attr('sensor.solax', 'Data')[12] | int(default=0) / 10 }}"
    unit_of_measurement: "A"
    device_class: "current"
    
  - name: "Solax PV2 Current"
    state: "{{ state_attr('sensor.solax', 'Data')[13] | int(default=0) / 10 }}"
    unit_of_measurement: "A"
    device_class: "current"

  - name: "Solax PV1 Power"
    state: "{{ state_attr('sensor.solax', 'Data')[14] | int(default=0) }}"
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax PV2 Power"
    state: "{{ state_attr('sensor.solax', 'Data')[15] | int(default=0) }}"
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax Total PV Power"
    state: "{{ (states('sensor.solax_pv1_power')|int + states('sensor.solax_pv2_power')|int) }}"
    unit_of_measurement: "W"
    device_class: "power"

### Battery detailed information ###      
  - name: "Solax Battery Voltage"
    state: "{{ state_attr('sensor.solax', 'Data')[39] | float / 100}}"
    unit_of_measurement: "V"
    device_class: "voltage"

  - name: "Solax Battery Current"
    state: >
      {% if state_attr('sensor.solax', 'Data')[40] > 32767 %}{{ (state_attr('sensor.solax', 'Data')[40] - 65536) / 100 }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[40] / 100 }}{% endif %}
    unit_of_measurement: "A"
    device_class: "current"

  - name: "Solax Battery Power"
    state:  >
      {% if state_attr('sensor.solax', 'Data')[41] > 32767 %}{{ state_attr('sensor.solax', 'Data')[41] - 65536 }}
      {% else %}{{ state_attr('sensor.solax', 'Data')[41] }}{% endif %}
    unit_of_measurement: "W"
    device_class: "power"

  - name: "Solax Battery SoC"
    state: "{{ state_attr('sensor.solax', 'Data')[103] | int(default=0) }}"
    unit_of_measurement: "%"

  - name: "Solax Battery Remain Energy"
    state: "{{ state_attr('sensor.solax', 'Data')[106] | int(default=0) / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"

  - name: "Solax Battery Temperature"
    state: "{{ state_attr('sensor.solax', 'Data')[105] | int(default=0) }}"
    unit_of_measurement: "°C"
    device_class: "temperature"

  - name: "Solax Battery BMS status"
    state:  >
      {% if state_attr('sensor.solax', 'Data')[45] | int == 1 %}OK
      {% else %}Fail{% endif %}
    unit_of_measurement: "%"

### Invertor modes, states ###
  - name: "Solax Battery Operation Mode"
    state: >
      {%   if state_attr('sensor.solax', 'Data')[168] == 0 %}Self Use Mode
      {% elif state_attr('sensor.solax', 'Data')[168] == 1 %}Force Time Use
      {% elif state_attr('sensor.solax', 'Data')[168] == 2 %}Back Up Mode
      {% elif state_attr('sensor.solax', 'Data')[168] == 3 %}Feed-in Priority
      {% else %}I dont know{% endif %}

  - name: "Solax Inverter Operation Mode"
    state: >
      {%   if state_attr('sensor.solax', 'Data')[19] ==  0 %}Waiting
      {% elif state_attr('sensor.solax', 'Data')[19] ==  1 %}Checking
      {% elif state_attr('sensor.solax', 'Data')[19] ==  2 %}Normal
      {% elif state_attr('sensor.solax', 'Data')[19] ==  3 %}Off
      {% elif state_attr('sensor.solax', 'Data')[19] ==  4 %}Permanent Fault
      {% elif state_attr('sensor.solax', 'Data')[19] ==  5 %}Updating
      {% elif state_attr('sensor.solax', 'Data')[19] ==  6 %}EPS Check
      {% elif state_attr('sensor.solax', 'Data')[19] ==  7 %}EPS Mode
      {% elif state_attr('sensor.solax', 'Data')[19] ==  8 %}Self Test
      {% elif state_attr('sensor.solax', 'Data')[19] ==  9 %}Idle
      {% elif state_attr('sensor.solax', 'Data')[19] == 10 %}Standby
      {% else %}I dont know{% endif %}

### Invertor and management module information ###
  - name: "Solax Module SN"
    state: "{{ state_attr('sensor.solax', 'sn') }}"

  - name: "Solax module fw version"
    state: "{{ state_attr('sensor.solax', 'ver') }}"

  - name: "Solax type"
    state: >  # Other Solax invertor type are described in web API manual
      {% if state_attr('sensor.solax', 'type') == 14 %}X3-Hybrid G4
      {% else %}Other{% endif %}

  - name: "Solax Inverter SN"
    state: "{{ state_attr('sensor.solax', 'Information')[2] }}"

  - name: "Solax Inverter Nominal Power"
    state: "{{ state_attr('sensor.solax', 'Information')[0] | float | round(1) }}"
    unit_of_measurement: "kW"

### Test parameters ###
  - name: "Solax Inverter Temperature inner ?"
    state: "{{ state_attr('sensor.solax', 'Data')[46] | int(default=0) }}"
    unit_of_measurement: "°C"
    device_class: "temperature"

  - name: "Solax Inverter Temperature ?"
    state: "{{ state_attr('sensor.solax', 'Data')[54] | int(default=0) }}"
    unit_of_measurement: "°C"
    device_class: "temperature"

do not forget to check configuration before rebooting.
After the reboot add “Solax Solar Energy total” to your energy dashboard as solar production and wait a little bit.
The trick to get the delta of the whole consumption into the energy board is this “state_class: total_increasing”

1 Like

Can you give more info?
should I !include templates.yaml in configuration???
rest sensor created sensor.solax_rest_data and templates using sensor.solax is this correct?

You could add the templates in the configuration,yaml as well, i have the templates split from configuration.yaml, as it looks nicer.
You can do that by adding this to configration.yaml “template: !include templates.yaml” and then just add a templates.yaml to your system.
You need the templates to have the API data usable in your system

yeah, done everything now, just need to find DATA values correctly, mine is X3-MIC-G2, so data is different. Also you missed to write one part of code to configuration yaml or sensors.yaml (if you are seperating):

- platform: template
  sensors:
    solax:
      friendly_name: "Solax last good result"
      value_template: > # last good real data timestamp
        {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxxxxx"  %}{{ now() }}
        {% else %}{{ (states('sensor.solax')) }}{% endif %}
      attribute_templates:
        sn: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'sn')) }}
          {% else %}{{ (state_attr('sensor.solax', 'sn')) }}{% endif %}
        ver: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'ver')) }}
          {% else %}{{ (state_attr('sensor.solax', 'ver')) }}{% endif %}
        type: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'type')) }}
          {% else %}{{ (state_attr('sensor.solax', 'type')) }}{% endif %}
        Data: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'Data')) }}
          {% else %}{{ (state_attr('sensor.solax', 'Data')) }}{% endif %}
        Information: >-
          {% if state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'Information')) }}
          {% else %}{{ (state_attr('sensor.solax', 'Information')) }}{% endif %}

where “xxxxxxxxxxxx” put your code

1 Like

thanks, yes i forgot the first part to write data to solax sensor, added it on top.
Be aware that the code from the original post on CZ is not working as it should not be == it should be not equals

{% if not state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'ver')) }}

the xxxxx… are just to verify if you get data, nothing to change there

found an error in a template, this is the fixed code (also updated it above in the full code’
Template was wrong

  - name: "Solax Total PV Power"
    state: "{{ (states('sensor.solax_pv1_power')|int + states('sensor.solax_pv2_power')|int) }}"
    unit_of_measurement: "W"
    device_class: "power"

Hello mf76130,
Can you tell me what should be configured in the customize.yaml?
Regarding the:

  - name: "Solax Total PV Power"
    state: "{{ (states('sensor.solax_pv1_power')|int + states('sensor.solax_pv2_power')|int) }}"
    unit_of_measurement: "W"
    device_class: "power"

In my x1 hybrid g4 is:

  - name: "Solax Total PV Power"
    state: "{{ (states('sensor.solax_l1_power')|int + states('sensor.solax_l2_power')|int + states('sensor.solax_l3_power')|int) }}"
    unit_of_measurement: "W"
    device_class: "power"

As the L1, L2 and L3 are the one’s reflecting the produced Watts… strange is that L3 is the one I get 99% of it and I suppose the the L1 is what the inverser need to work… L2 is null.

But now I’m struggling to have that value refleted in the energy folder as the energy sensor doesn’t show any values…

I do believe that is related to the fact that I need to make some kind of customization in the yaml, but can’t find out what or how.

Can you send me any example to make this work?

1 Like

can you give me some info on 32767 numbers and 65535, because mine is x3-Micro G2, so I haven’t found all values yet :slight_smile:

Sorry for the late reply, i didn’t get notified of a new message.

The PV Power, is power(W not Wh) side of the panels (before the inverter), i don’t know if you have there 3 strings, depends on your inverter if it has 3 DC inbounds for the panels.

And for the energy dashboard you should use “Solax Solar Energy total”

  - name: "Solax Solar energy total"
    state: "{{ ((state_attr('sensor.solax', 'Data')[81] * 65536) + state_attr('sensor.solax', 'Data')[80]) | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

Hi,

Data[81] is “0” (at the moment) in my case, so it is never used, don’t know why the coder added that calculation :slight_smile:
Data[80] is the total value if all time produced energy multiplied with 10, in my case at the moment its “8537” which is “853,7” kWh produced since its running, so you maybe want to search your data string for your total produced kWh

About the 32767(16bit Stackoverflow), no clue either, the coder maybe saw that some devices sind a higher value that it should be and recalculated it, but as far as i saw that was only on power and battery amperage.

for my case I am using grid in total and grid out total for energy dashboard, and for solar energy total but all seems straightforward, no need of calculation:
(commented what was before)

  - name: "Solax Solar energy total"
    # state: "{{ ((state_attr('sensor.solax', 'Data')[81] * 65536) + state_attr('sensor.solax', 'Data')[80]) | float / 10 }}"
    state: "{{ state_attr('sensor.solax', 'Data')[22] | float / 10 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

  - name: "Solax Grid out total"
    # state: "{{ ((state_attr('sensor.solax', 'Data')[87] * 65536) + state_attr('sensor.solax', 'Data')[86]) | float / 100 }}"
    state: "{{ state_attr('sensor.solax', 'Data')[74] | float / 100 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

  - name: "Solax Grid in total"
    # state: "{{ ((state_attr('sensor.solax', 'Data')[89] * 65536) + state_attr('sensor.solax', 'Data')[88]) | float / 100 }}"
    state: "{{ state_attr('sensor.solax', 'Data')[76] | float / 100 }}"
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: total_increasing

This is for X3-MIC-G2

for me the same, the calculation is just bypassed, cause 0*65536 = 0
these are my actual data values:

0 2380
1 2384
2 2376
3 11
4 11
5 12
6 135
7 154
8 149
9 438
10 5423
11 5167
12 3
13 3
14 190
15 197
16 4999
17 4999
18 4999
19 2
20 0
21 0
22 0
23 0
24 0
25 0
26 0
27 0
28 0
29 0
30 0
31 0
32 0
33 0
34 0
35 0
36 0
37 0
38 0
39 0
40 0
41 0
42 0
43 0
44 0
45 1
46 46
47 438
48 256
49 4608
50 265
51 5644
52 100
53 0
54 46
55 0
56 0
57 0
58 0
59 0
60 0
61 0
62 0
63 0
64 0
65 0
66 0
67 0
68 8638
69 0
70 6
71 0
72 0
73 0
74 0
75 0
76 0
77 0
78 0
79 0
80 8543
81 0
82 6
83 0
84 0
85 0
86 20
87 0
88 1601
89 0
90 0
91 0
92 1601
93 0
94 0
95 0
96 0
97 0
98 0
99 0
100 0
101 0
102 1
103 0
104 0
105 0
106 0
107 0
108 0
109 0
110 0
111 0
112 0
113 0
114 0
115 0
116 0
117 0
118 0
119 0
120 0
121 0
122 0
123 0
124 0
125 0
126 0
127 0
128 0
129 0
130 0
131 0
132 0
133 0
134 0
135 0
136 0
137 0
138 0
139 0
140 0
141 0
142 0
143 0
144 0
145 0
146 0
147 0
148 0
149 0
150 0
151 0
152 0
153 0
154 0
155 0
156 0
157 0
158 0
159 0
160 0
161 0
162 0
163 0
164 257
165 257
166 257
167 257
168 0
169 0
170 0
171 0
172 0
173 0
174 0
175 0
176 0
177 0
178 0
179 0
180 0
181 0
182 0
183 0
184 0
185 0
186 0
187 0
188 0
189 0
190 0
191 0
192 0
193 0
194 0
195 0
196 0
197 0
198 0
199 0

for now I can see grid in, grid out, total, solar power, also it is possible to see REAL TIME consumption in W.
[72] - 65535. If I am correct.

Don’t know if I need more info right now.

Found a mistake i made in

###Solax
  - name: solax
    state: > 
            {% if not state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx"  %}{{ now() }}
            {% else %}{{ (states('sensor.solax')) }}{% endif %}
    attributes: 
      sn: >-
            {% if not state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'ver')) }}
            {% else %}{{ (state_attr('sensor.solax', 'sn')) }}{% endif %}
      ver: >-
          {% if not state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'ver')) }}
          {% else %}{{ (state_attr('sensor.solax', 'ver')) }}{% endif %}

the “not” needs to be removed and the “xxxxxxxxx” after the ‘sn’ need to be set to your serial number of the device

updated it in the original code as well

Its always best to compate the values with what you see on the device itself or the solax cloud.
then you can verify if you took the correct data field.

There is one more error for SN

      sn: >-
            {% if not state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'ver')) }}
            {% else %}{{ (state_attr('sensor.solax', 'sn')) }}{% endif %}

should be this

      sn: >-
            {% if not state_attr('sensor.solax_rest_data', 'sn') == "xxxxxxxxx" %}{{ (state_attr('sensor.solax_rest_data', 'sn')) }}
            {% else %}{{ (state_attr('sensor.solax', 'sn')) }}{% endif %}

because you need to specify SN here not VER

1 Like

thanks a lot, corrected

Can confirm that this works on Home Assistant 2022.12.6 when denoting every single sensor in templates.yaml with it’s own “sensor” line, instead of a common “sensors” dictionary, like so:

###Solax
- sensor:
  - name: solax
    state: >
           ...

###AC detailed information
- sensor:
   - name: ...
1 Like

By the way, it would be amazing if this was fed back to the general Solax Power integation for it to support current firmware as well: core/homeassistant/components/solax at dev · home-assistant/core · GitHub

I’ll try to create a PR for it…

2 Likes

Hi, I am starating to figure out the data mappings for a Solax X1 Hybrid G4. I’ve worked quite a few out. Will post here when complete.

Has anyone found Solax documentation on this, or is this all reverse engineering?