SolarEdge - Energy Module

I also use SolarEdge and got it all working properly. The thing to remember for grid consumption and export is that Solar Edge resets these daily. HA expects counters which keep growing, so I have created following configuration with utility meters. And this now works perfectly:

homeassistant:
  customize_glob:
    sensor.*_power_yearly_kwh:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement
    sensor.*_power_yearly:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement
      
utility_meter:
  imported_power_yearly:
    source: sensor.solaredge_imported_power
    cycle: yearly 
  exported_power_yearly:
    source: sensor.solaredge_exported_power
    cycle: yearly 

template:
  - sensor:
    - name: "Imported Power Yearly kWh"
      unique_id: imported_power_yearly_kwh
      state_class: measurement
      device_class: energy  
      unit_of_measurement: 'kWh'
      state: "{{(states('sensor.imported_power_yearly') | float) / 1000}}"  
    - name: "Exported Power Yearly kWh"
      unique_id: exported_power_yearly_kwh
      state_class: measurement
      device_class: energy    
      unit_of_measurement: 'kWh'
      state: "{{(states('sensor.exported_power_yearly') | float) / 1000}}" 

The last 2 defined template sensors are the ones I use for imported and exported power in the Energy Dashboard. I use the default “Solar Edge Lifetime Energy” for the Solar Power of the Energy Dashboard and get accurate readings like below:

7 Likes

Everything seems to be ok ! Thank you :slight_smile:

Do you have any idea of what will happen when we’ll reach the yearly reset ?

No, but I expect something similar as in the solar edge app… It’ll start from scratch. But… Until then we’ll have a few updates and tweaks and we’ll cross that bridge when we get to it…:stuck_out_tongue_winking_eye:

When using a template sensor for the meters that get reset after midnight, the last_reset attribute needs to reflect this, otherwise (as mentioned above) if the Home Energy Management system thinks the meter values are forever increasing, then at midnight the Home Energy System will show imported energy as negative, and solar production as negative (which probably should be 0), and exported values as positive. Here is something I tried last night and it seems to fix this problem:

last_reset: '{{ now().replace(hour=0).replace(minute=10).replace(second=0).replace(microsecond=0).isoformat() }}'

Since these meter use cloud polling they do not actually get reset at midnight but some number of minutes after that. However, since it appears the Home Energy Management does an update around 12 minutes after the hour, I decided on minute=10, but again minute = 0 will probably work as well. The only downside I see is if by some chance the cloud polling takes 12 or more minutes after midnight.

1 Like

Does anyone know if a SolarEdge update is coming from the Dev for energy panel configuration? Lots of great work here, but I’d rather wait a few weeks for a built-in integration if that’s on the way. I’m having the same issue where for every dropdown in the setup I only have 1 option to choose lifetime energy and that doesn’t work.

I just set the integration up for the energy panel, so if there should be other options in the dropdown to choose already and there isn’t, I may not be aware of that. If so, if someone could let me know what should be there I can start troubleshooting it.

Thanks for the help!

2 Likes

I had this problem too. I created this thread with an alternative solution, but also describe how you could solve it with the cloud based Solar Edge integration:

The third post in that thread describes this.

I have all the templates and other sensors installed however, each day their is that data dump from SE that throws off the daily calculations. Anyone see this?

Where did you add this line of code? I am using the code that Remko wrote…

Thanks.

This is added in my configuration.yaml using the new way of doing Template Sensors. Here is an example for one of the SolarEdge sensors that resets at midnight:

template:
  - sensor:
      - name: "SolarEdge Exported Energy Template" 
        state: '{{(states("sensor.solaredge_exported_power") | float / 1000) | round(3)}}'
        unique_id: "solaredge_exported_energy_template"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        device_class: 'energy'
        state_class: 'measurement'
        attributes:
          last_reset: '{{ now().replace(hour=0).replace(minute=10).replace(second=0).replace(microsecond=0).isoformat() }}'
         #last_reset: '1970-01-01T00:00:00+00:00'

This creates a sensor named: sensor.solaredge_exported_energy_template
This sensor will show up in the selection of sensors in the Energy integration’s Electricity Grid and the Energy Integration seems to handle the reseting correctly.

I did similar template sensors for all my sensor.solaredge_xxx sensors that get reset at midnight.

Note: I read somewhere, I forget where, that this last_reset attribute is going away in the 2021.9 release as somehow HA will determine that a sensor is getting reset.

@wmaker Thanks for the update and the additional explanation. This helps me.

Hopefully this is not a silly or ignorant question from a newbie, why this is not included with Solar Edge integration?

1 Like

I see in the new update the SolarEdge is still not supported out of the box. Is that correct? best way forward is still creating Template Sensors?

Taking a look at the Home Assistant github master branch for the SolarEdge component, it appears to be the case that the lifetime energy is the only sensor that has been updated…so yes, template sensors is the way to go.

Ok. Have enabled this now (have to wait for a time to see if it works). I have also a battery. I see in the configuration that you need in and out battery entities. As far as I know there is only one entity for the battery in SolarEdge (Power) that show the usage of the power. Any idea how we could use this?

Does anyone use a SolarEdge with a Batterie and get the battery statistic to work?
I am currently struggling with that, because I only get the sensor.solaredge_storage_power, so the current level of the battery.
The energy battery statistics (as far as I know) needs a IN and an OUT sensor.
Does anyone know a way to solve this?

1 Like

I have switched to using the Modbus integration because that offers some more battery statistics. Using those values and creating some template sensors made it possible to get all the right readings for the Energy Dashboard.
This thread shows how the initial setup was done:

1 Like

Not sure if you found a solution for this but I was having the same issue. I read somewhere that the timezone for last_reset needs for be set to UTC. I updated my last_reset code to

last_reset: '{{ now(timezone.utc).replace(hour=0).replace(minute=10).replace(second=0).replace(microsecond=0).isoformat() }}'

and now it’s working for me :slight_smile:

Hi all,

Thanks for the informatino how to integrate imported / exported informatino from solarEdge into the Energy-Dashboard… :slight_smile:

Maybe, you also have an answer to my further question…

  • It is possible to call a complete history of the production data from the SolarEdge Monitoring via API.
    I already have all the Information for the time since the installation was going online available…

Now, I would like to feed HomeAssistant with this history, too…
Do you know, where the system does store this information?

[probably within my influxdb, but how could I insert / feed the data into the db?]

Thanks Remko - made it much easier

@James_Hendry : I redid the entire setup and gotten a lot further actually. For the full instructions, visit this thread: