After along time reading and implementing and testing ended up with this configuration
sensor:
- platform: rest
resource: https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId=2XXXXXXXXXXXXXXXXXX&sn=SXXXXXXXXX
method: GET
name: "Solax X1"
scan_interval: 15
json_attributes_path: "$.result"
json_attributes:
- yieldtoday
- yieldtotal
- acpower
- uploadTime
- inverterStatus
- feedinpower
- feedinenergy
- consumeenergy
value_template: "1" # dummy value, not used; avoids the "State max length is 255 characters" error
- platform: template
sensors:
solax_x1_yieldtoday:
friendly_name: "Solax X1 yieldtoday"
value_template: "{{ state_attr('sensor.solax_x1', 'yieldtoday') }}"
unit_of_measurement: "kWh"
solax_x1_consumeenergy:
friendly_name: "Solax X1 consumeenergy"
value_template: >-
{% if (state_attr('sensor.solax_x1', 'consumeenergy')| float | round(2)) > 0 -%}
{{ (state_attr('sensor.solax_x1', 'consumeenergy')| float | round(2))}}
{%- endif %}
availability_template: >-
{{ state_attr('sensor.solax_x1', 'consumeenergy') not in ['unknown', 'unavailable', '0', '0.0']}}
unit_of_measurement: "kWh"
solax_x1_yieldtotal:
friendly_name: "Solax X1 yieldtotal"
value_template: >-
{% if (state_attr('sensor.solax_x1', 'yieldtotal')| float | round(2)) > 0 -%}
{{ (state_attr('sensor.solax_x1', 'yieldtotal')| float | round(2))}}
{%- endif %}
availability_template: >-
{{ state_attr('sensor.solax_x1', 'yieldtotal') not in ['unknown', 'unavailable', '0', '0.0']}}
unit_of_measurement: "kWh"
solax_x1_acpower:
friendly_name: "Solax X1 acpower"
value_template: "{{ state_attr('sensor.solax_x1', 'acpower') }}"
unit_of_measurement: "Wh"
solax_x1_feedinenergy:
friendly_name: "Solax X1 feedinenergy"
value_template: >-
{% if (state_attr('sensor.solax_x1', 'feedinenergy')| float | round(2)) > 0 -%}
{{ (state_attr('sensor.solax_x1', 'feedinenergy')| float | round(2))}}
{%- endif %}
availability_template: >-
{{ state_attr('sensor.solax_x1', 'feedinenergy') not in ['unknown', 'unavailable', '0', '0.0']}}
unit_of_measurement: "kWh"
solax_x1_feedinpower:
friendly_name: "Solax X1 feedinpower"
value_template: "{{ state_attr('sensor.solax_x1', 'feedinpower') }}"
unit_of_measurement: "Wh"
solax_x1_upload_time:
friendly_name: "Solax X1 upload time"
value_template: "{{ state_attr('sensor.solax_x1', 'uploadTime') }}"
solax_x1_status:
friendly_name: "Solax X1 status"
value_template: >
{% if state_attr('sensor.solax_x1', 'inverterStatus') == '100' %}Wait
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '101' %}Check
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '102' %}Normal
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '103' %}Fault
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '104' %}Permanent Fault
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '105' %}Update
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '106' %}EPS Check
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '107' %}EPS
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '108' %}Self-test
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '109' %}Idle
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '110' %}Standby
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '111' %}Pv Wake Up Bat
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '112' %}Gen Check
{% elif state_attr('sensor.solax_x1', 'inverterStatus') == '113' %}Gen Run
{% else %}Offline{% endif %}
to be able to use on energy meter panel this also needs to be applied under homeassistant customization
homeassistant:
customize:
#From grid consumption
sensor.solax_x1_consumeenergy:
state_class: total_increasing
device_class: energy
#Solar Production Today
sensor.solax_x1_yieldtoday:
state_class: total_increasing
device_class: energy
#Total Production Since Reset
sensor.solax_x1_yieldtotal:
state_class: total_increasing
device_class: energy
#grid return
sensor.solax_x1_feedinenergy:
state_class: total_increasing
device_class: energy
#Current Power Grid Injection
sensor.solax_x1_feedinpower:
state_class: measurement
device_class: power
#Current Solar Production
sensor.solax_x1_acpower:
state_class: measurement
device_class: power