|
## Aiswei Solplanet Inverter Template |
|
## Template for Solplanet Inverter consist of 2 API calls for PV and Battery. |
|
## Last modified: 23/09/2024 |
|
|
|
## Inverter Input ## |
|
input_text: |
|
solplanet_ip: |
|
name: "Solplanet IP" |
|
icon: mdi:ip |
|
solplanet_serialno: |
|
name: "Solplanet SerialNo" |
|
icon: mdi:card-account-details |
|
|
|
rest: |
|
## Battery Sensors ## |
|
- resource_template: "http://{{ states('input_text.solplanet_ip') }}:8484/getdevdata.cgi?device=4&sn={{ states('input_text.solplanet_serialno') }}" |
|
scan_interval: 10 |
|
sensor: |
|
- name: "Solplanet EPS Voltage" |
|
unique_id: solplanet_eps_voltage |
|
value_template: "{{ value_json.vesp | float / 10 }}" |
|
unit_of_measurement: "V" |
|
device_class: voltage |
|
state_class: measurement |
|
|
|
- name: "Solplanet EPS Current" |
|
unique_id: solplanet_eps_current |
|
value_template: "{{ value_json.cesp | float / 10 }}" |
|
unit_of_measurement: "A" |
|
device_class: current |
|
state_class: measurement |
|
|
|
- name: "Solplanet EPS Power" |
|
unique_id: solplanet_eps_power |
|
value_template: "{{ value_json.pesp | float }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery State" |
|
unique_id: solplanet_battery_state |
|
value_template: >- |
|
{% set bst = value_json.bst %} |
|
{% if bst == 1 %}Idle |
|
{% elif bst == 2 %}Charging |
|
{% elif bst == 3 %}Discharging |
|
{% elif bst == 4 %}Fault |
|
{% else %}Unknown ({{ bst }}){% endif %} |
|
icon: >- |
|
{% set bst = value_json.bst %} |
|
{% if bst == 1 %}mdi:battery |
|
{% elif bst == 2 %}mdi:battery-positive |
|
{% elif bst == 3 %}mdi:battery-negative |
|
{% elif bst == 4 %}mdi:battery-alert-variant |
|
{% else %}mdi:battery-unknown{% endif %} |
|
|
|
- name: "Solplanet Battery State of Charge" |
|
unique_id: solplanet_battery_soc |
|
unit_of_measurement: "%" |
|
value_template: "{{ value_json.soc }}" |
|
icon: mdi:battery |
|
device_class: battery |
|
|
|
- name: "Solplanet Battery State of Health" |
|
unique_id: solplanet_battery_soh |
|
unit_of_measurement: "%" |
|
value_template: "{{ value_json.soh }}" |
|
icon: mdi:battery |
|
|
|
- name: "Solplanet Battery Temperature" |
|
unique_id: solplanet_battery_temperature |
|
value_template: "{{ value_json.tb | float / 10 }}" |
|
unit_of_measurement: "°C" |
|
device_class: temperature |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery Voltage" |
|
unique_id: solplanet_battery_voltage |
|
value_template: "{{ value_json.vb | float / 100 }}" |
|
unit_of_measurement: "V" |
|
device_class: voltage |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery Current" |
|
unique_id: solplanet_battery_current |
|
value_template: "{{ value_json.cb | float / 10 }}" |
|
unit_of_measurement: "A" |
|
device_class: current |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery Power" |
|
unique_id: solplanet_battery_power |
|
value_template: "{{ value_json.pb | float }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery Charging Power" |
|
unique_id: solplanet_battery_charging_power |
|
value_template: >- |
|
{% if value_json.pb | int < 0 %}{{ (value_json.pb | int * -1) }} |
|
{% else %}0{% endif %} |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery Discharging Power" |
|
unique_id: solplanet_battery_discharging_power |
|
value_template: >- |
|
{% if value_json.pb | int > 0 %}{{ value_json.pb | int }} |
|
{% else %}0{% endif %} |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery PV Power" |
|
unique_id: solplanet_battery_pv_power |
|
value_template: "{{ value_json.ppv | float }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet Battery Daily Production" |
|
unique_id: solplanet_battery_daily_production |
|
unit_of_measurement: "kWh" |
|
value_template: "{{ value_json.etdpv | float / 1000 }}" |
|
device_class: energy |
|
state_class: total_increasing |
|
|
|
- name: "Solplanet Battery Total Production" |
|
unique_id: solplanet_battery_total_production |
|
value_template: "{{ value_json.etopv | float / 1000 }}" |
|
unit_of_measurement: "kWh" |
|
device_class: energy |
|
state_class: total_increasing |
|
|
|
## Inverter Sensors ## |
|
- resource_template: "http://{{ states('input_text.solplanet_ip') }}:8484/getdevdata.cgi?device=2&sn={{ states('input_text.solplanet_serialno') }}" |
|
scan_interval: 10 |
|
sensor: |
|
- name: "Solplanet Date/Time" |
|
unique_id: solplanet_datetime |
|
value_template: >- |
|
{% set solplanetdatetime = value_json.tim | replace('"', '') %} |
|
{{ as_timestamp(strptime(solplanetdatetime, '%Y%m%d%H%M%S')) | timestamp_local }} |
|
device_class: timestamp |
|
|
|
- name: "Solplanet Current Production" |
|
unique_id: solplanet_current_production |
|
value_template: "{{ value_json.pac | float }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet Daily Production" |
|
unique_id: solplanet_daily_production |
|
value_template: "{{ value_json.etd | float / 10 }}" |
|
unit_of_measurement: "kWh" |
|
device_class: energy |
|
state_class: total_increasing |
|
|
|
- name: "Solplanet Total Production" |
|
unique_id: solplanet_total_production |
|
value_template: "{{ value_json.eto | float / 10 }}" |
|
unit_of_measurement: "kWh" |
|
device_class: energy |
|
state_class: total_increasing |
|
|
|
- name: "Solplanet Temperature" |
|
unique_id: solplanet_temperature |
|
value_template: "{{ value_json.tmp | float / 10 }}" |
|
unit_of_measurement: "°C" |
|
device_class: temperature |
|
state_class: measurement |
|
|
|
- name: "Solplanet AC Voltage" |
|
unique_id: solplanet_ac_voltage |
|
value_template: "{{ value_json.vac.0 | float / 10 }}" |
|
unit_of_measurement: "V" |
|
device_class: voltage |
|
state_class: measurement |
|
|
|
- name: "Solplanet AC Current" |
|
unique_id: solplanet_ac_current |
|
value_template: "{{ value_json.iac.0 | float / 10 }}" |
|
unit_of_measurement: "A" |
|
device_class: current |
|
state_class: measurement |
|
|
|
- name: "Solplanet AC Power" |
|
unique_id: solplanet_ac_power |
|
value_template: "{{ '{:.2f}'.format((value_json.vac.0 | float / 10) * (value_json.iac.0 | float / 10)) }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet MPPT1 Voltage" |
|
unique_id: solplanet_mppt1_voltage |
|
value_template: "{{ value_json.vpv.0 | float / 10 }}" |
|
unit_of_measurement: "V" |
|
device_class: voltage |
|
state_class: measurement |
|
|
|
- name: "Solplanet MPPT1 Current" |
|
unique_id: solplanet_mppt1_current |
|
value_template: "{{ value_json.ipv.0 | float / 100 }}" |
|
unit_of_measurement: "A" |
|
device_class: current |
|
state_class: measurement |
|
|
|
- name: "Solplanet MPPT1 Power" |
|
unique_id: solplanet_mppt1_power |
|
value_template: "{{ '{:.2f}'.format((states('sensor.solplanet_mppt1_voltage') | float * states('sensor.solplanet_mppt1_current') | float)) }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet MPPT2 Voltage" |
|
unique_id: solplanet_mppt2_voltage |
|
value_template: "{{ value_json.vpv.1 | float / 10 }}" |
|
unit_of_measurement: "V" |
|
device_class: voltage |
|
state_class: measurement |
|
|
|
- name: "Solplanet MPPT2 Current" |
|
unique_id: solplanet_mppt2_current |
|
value_template: "{{ value_json.ipv.1 | float / 100 }}" |
|
unit_of_measurement: "A" |
|
device_class: current |
|
state_class: measurement |
|
|
|
- name: "Solplanet MPPT2 Power" |
|
unique_id: solplanet_mppt2_power |
|
value_template: "{{ '{:.2f}'.format((states('sensor.solplanet_mppt2_voltage') | float * states('sensor.solplanet_mppt2_current') | float)) }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
- name: "Solplanet MPPT Power" |
|
unique_id: solplanet_mppt_power |
|
value_template: "{{ '{:.2f}'.format((states('sensor.solplanet_mppt1_power') | float + states('sensor.solplanet_mppt2_power') | float)) }}" |
|
unit_of_measurement: "W" |
|
device_class: power |
|
state_class: measurement |
|
|
|
## Additional Sensors ## |
|
sensor: |
|
- platform: integration |
|
source: sensor.solplanet_mppt_power |
|
name: "Solplanet MPPT Energy" |
|
unit_prefix: k # Converts Wh to kWh |
|
round: 2 |
|
method: trapezoidal |
|
|
|
- platform: integration |
|
source: sensor.solplanet_battery_charging_power |
|
name: "Solplanet Battery Charging Energy" |
|
unit_prefix: k # Converts Wh to kWh |
|
round: 2 |
|
method: trapezoidal |
|
|
|
- platform: integration |
|
source: sensor.solplanet_battery_discharging_power |
|
name: "Solplanet Battery Discharging Energy" |
|
unit_prefix: k # Converts Wh to kWh |
|
round: 2 |
|
method: trapezoidal |
|
|
|
- platform: history_stats |
|
name: "Solplanet Battery Discharging Duration" |
|
entity_id: sensor.solplanet_battery_state |
|
state: 'Discharging' |
|
type: time |
|
start: '{{ now().replace(hour=0, minute=0, second=0) }}' |
|
end: '{{ now() }}' |
|
|
|
- platform: history_stats |
|
name: "Solplanet Battery Charging Duration" |
|
entity_id: sensor.solplanet_battery_state |
|
state: 'Charging' |
|
type: time |
|
start: '{{ now().replace(hour=0, minute=0, second=0) }}' |
|
end: '{{ now() }}' |
|
|
|
utility_meter: |
|
solplanet_mppt_production_daily: |
|
name: "Solplanet MPPT Production Daily" |
|
unique_id: solplanet_mppt_production_daily |
|
cycle: daily |
|
source: sensor.solplanet_mppt_energy |
|
|
|
solplanet_battery_charging_daily: |
|
name: "Solplanet Battery Charging Daily" |
|
unique_id: solplanet_battery_charging_daily |
|
cycle: daily |
|
source: sensor.solplanet_battery_charging_energy |
|
|
|
solplanet_battery_discharging_daily: |
|
name: "Solplanet Battery Discharging Daily" |
|
unique_id: solplanet_battery_discharging_daily |
|
cycle: daily |
|
source: sensor.solplanet_battery_discharging_energy |
|
|