can you help me with the below?
sensor that you can use in the energy dashboard:
this is the code
‘’‘’‘’## X3 ##
- platform: rest
resource: https://www.solaxcloud.com:9443/proxy/api/getRealtimeInfo.do?tokenId=XXXXXXX&sn=XXXXXXX
name: “Solax X3”
json_attributes_path: “$.result”
json_attributes:- yieldtoday
- yieldtotal
- acpower
- uploadTime
- inverterStatus
- sn
value_template: ‘1’ # dummy value, not used; avoids the “State max length is 255 characters” error
- platform: template
sensors:
solax_x3_today:
friendly_name: “Solax X3 today”
value_template: “{{ state_attr(‘sensor.solax_x3’, ‘yieldtoday’) }}”
unit_of_measurement: “KWh”
device_class: energy
solax_x3_total:
friendly_name: “Solax X3 total”
value_template: “{{ state_attr(‘sensor.solax_x3’, ‘yieldtotal’) }}”
unit_of_measurement: “KWh”
device_class: energy
solax_x3_now:
friendly_name: “Solax X3 now”
value_template: “{{ state_attr(‘sensor.solax_x3’, ‘acpower’) }}”
unit_of_measurement: “W”
device_class: energy
solax_x3_upload_time:
friendly_name: “Solax X3 upload time”
value_template: “{{ state_attr(‘sensor.solax_x3’, ‘uploadTime’) }}”
solax_x3_status:
friendly_name: “Solax X3 status”
value_template: >
{% if state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘100’ %}Wait
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘101’ %}Check
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘102’ %}Normal
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘103’ %}Fault
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘104’ %}Permanent Fault
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘105’ %}Update
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘106’ %}EPS Check
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘107’ %}EPS
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘108’ %}Self-test
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘109’ %}Idle
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘110’ %}Standby
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘111’ %}Pv Wake Up Bat
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘112’ %}Gen Check
{% elif state_attr(‘sensor.solax_x3’, ‘inverterStatus’) == ‘113’ %}Gen Run
{% else %}I dont know{% endif %}
solax_x3_sn:
friendly_name: “Solax X3 sn”
value_template: “{{ state_attr(‘sensor.solax_x3’, ‘sn’) }}”
template:- sensor:
- name: test_energy
state: “{{ states(‘sensor.solax_total’) }}”
unit_of_measurement: ‘kWh’
state_class: measurement
device_class: energy
attributes:
last_reset: ‘1970-01-01T00:00:00+00:00’
‘’‘’‘’‘’
This is the message that we get in the configuration test:
The system cannot restart because the configuration is not valid: Invalid config for [sensor.template]: expected dictionary for dictionary value @ data[‘sensors’][‘template’]. Got [OrderedDict([(‘sensor’, None)]), OrderedDict([(‘name’, ‘test_energy’), (‘state’, “{{ states(‘sensor.solax_total’) }}”), (‘unit_of_measurement’, ‘kWh’), (‘state_class’, ‘measurement’), (‘device_class’, ‘energy’), (‘attributes’, OrderedDict([(‘last_reset’, ‘1970-01-01T00:00:00+00:00’)]))])]. (See ?, line ?).
.
Do you have a idea what we do wrong?