SolarEdge configuration for Energy Dashboard using API [Working Example]

Sharing working config for the SolarEdge API using the Energy Dashboard. There were a lot of open topics arond this in the last 18 months, thought it would be useful for others.

Firstly:
Add sensors manually:

  - platform: template
    sensors:
      solaredge_battery_depletion_rate:
        friendly_name: "SolarEdge Battery Depletion Rate"
        unit_of_measurement: kW
        device_class: energy
        value_template: > 
          {% if (state_attr("sensor.solaredge_storage_power", "status")) == "Discharging"  %}
          {{(states('sensor.solaredge_storage_power') | float)}}
          {%- else -%}
          0
          {%- endif %}
        icon_template: mdi:lightning-bolt
      solaredge_battery_charge_rate:
        friendly_name: "SolarEdge Battery Charge Rate"
        unit_of_measurement: kW
        device_class: energy
        value_template: > 
          {% if (state_attr("sensor.solaredge_storage_power", "status")) == "Charging"  %}
          {{(states('sensor.solaredge_storage_power') | float) * -1}}
          {%- else -%}
          0
          {%- endif %}
        icon_template: mdi:lightning-bolt
      solaredge_pv_generation:
        friendly_name: "SolarEdge PV Generation"
        unit_of_measurement: kW
        device_class: energy
        value_template: > 
          {{(states('sensor.solaredge_solar_power') | float)}}
        icon_template: mdi:lightning-bolt    

After which, create Riemann sum integral (Install, then add via Helpers) as “left”, associated with each

You can then link those newly generated helpers to the dashboard config items. it will update once an hour. the dashboard will complain that the data types are not correct, but it does work.

I didn’t create for energy from the grid as this now comes from an Octopus Mini, and previously I was using a CT clamp.

confirmed working after a few days of testing:

3 Likes

This is really cool!

Thanks Maco. :slight_smile: hopefully others find it helpful, the Solar Edge API was driving me nuts for ages. Annoyingly their API still does not allow for config changes, only reading data so still can’t set it up for automated saving session battery exports… So annoying SolarEdge nerfed the local API access to the inverters to force the Cloud usage which means half the useful stuff is gone.

What drives me nuts is the backfill isn’t supported on the API. I just want some historical data.

What do you mean by Backfill?

Thank you very much for this guide!

I had to wait for a day before I could choose the “Riemann sum integral” helpers for the energy dashboard, but after that all looks well :slight_smile: