SolarEdge - Energy Module

Hi All,

I’ve upgraded yesterday to the latest version of HA

I discovered the Energy module and tried to add my SolarEdge module.

For an unknown reason only 1 sensor is compatible with Energy module. I tried to customize other sensor with Measurement & Energy classes but without success

Does someone used SolarEdge & Energy module ?

Thank you

1 Like

Same for me. I also have the modbus consumption monitor installed but it appears those sensors have a “power” device_class or no device_class.

Yes indeed

I tried to customize the devices but still not appearing

I have a SolarEdge Inverter with the ModBus monitor. I’ve been working on this and am getting closer, but not quite there yet. I now have all of the appropriate entities selectable in the Energy dashboard, but it’s not showing any data. I’ve verified the entities have (increasing) values.

I used templates to create the appropriate sensors:

  - name: Solar Panel Production Energy Today
    unit_of_measurement: "kWh"
    unique_id: 12a5c37cc0ac4f15b609c17f81713e41
    state: "{{ states('sensor.solaredge_production_power') | float / 1000 | round(4) }}"
    device_class: energy
    state_class: measurement
    #last_reset: '1970-01-01T00:00:00+00:00'

  - name: Grid Energy Consumption Today
    unit_of_measurement: "kWh"
    unique_id: 5082ce586f93494289e521a4bb903924
    state: "{{ states('sensor.solaredge_imported_power') | float / 1000 | round(4) }}"
    device_class: energy
    state_class: measurement
    #last_reset: '1970-01-01T00:00:00+00:00'

  - name: Energy Export to Grid Today
    unit_of_measurement: "kWh"
    unique_id: f4fae8a6e46243ad85792344a0bea461
    state: "{{ states('sensor.solaredge_exported_power') | float / 1000 | round(4) }}"
    device_class: energy
    state_class: measurement
    #last_reset: '1970-01-01T00:00:00+00:00'

Since the “last_reset” does not seem to be valid in a template (yet?), I set those in customize.yaml:

sensor.solar_panel_production_energy_today:
  last_reset: "2021-07-30T00:00:00+00:00"
sensor.grid_energy_consumption_today:
  last_reset: "2021-07-30T00:00:00+00:00"
sensor.energy_export_to_grid_today:
  last_reset: "2021-07-30T00:00:00+00:00"

EDIT: And, yes, the “energy” sensors from SolarEdge really are labeled as “power” sensors. ::

1 Like

Well, this above still does not show in the energy

I can confirm that the ‘normal’ cloud solar edge integration also only shows the lifetime energy sensor as compatible with energy integration.

It seems that the source in GitHub is updated 5 days ago to make it work, but nothing happens on my side?
I’m using docker images

1 Like

After waiting for hour or 2, lifetime energy is showing proper date in home asssistant energy

Hi @Sabat

Can you please share the full section in configuration.yaml ?

I’m getting some error when trying to add the template

Error loading /config/configuration.yaml: while parsing a block collection
in "/config/configuration.yaml", line 24, column 7
expected <block end>, but found '?'
in "/config/configuration.yaml", line 25, column 7
template:
   - sensor:

      - name: Solar Panel Production Energy Today
      unit_of_measurement: "kWh"
      unique_id: 12a5c37cc0ac4f15b609c17f81713e41
      state: "{{ states('sensor.solaredge_production_power') | float / 1000 | round(4) }}"
      device_class: energy
      state_class: measurement
      #last_reset: '1970-01-01T00:00:00+00:00'

      - name: Grid Energy Consumption Today
      unit_of_measurement: "kWh"
      unique_id: 5082ce586f93494289e521a4bb903924
      state: "{{ states('sensor.solaredge_imported_power') | float / 1000 | round(4) }}"
      device_class: energy
      state_class: measurement
      #last_reset: '1970-01-01T00:00:00+00:00'

      - name: Energy Export to Grid Today
      unit_of_measurement: "kWh"
      unique_id: f4fae8a6e46243ad85792344a0bea461
      state: "{{ states('sensor.solaredge_exported_power') | float / 1000 | round(4) }}"
      device_class: energy
      state_class: measurement
      #last_reset: '1970-01-01T00:00:00+00:00'

Thank you

Here is an example of one I use:

template:
  - sensor:
    #Solar Edge Convert to kWH, customize names, icons, etc
      #Convert Solar Edge units from W to kW or Wh to kWh
      - name: "SolarEdge Current Power Template" #solaredge_current_power_template:
        state: '{{(states("sensor.solaredge_current_power") | float / 1000) | round(3)}}'
        unique_id: "solaredge_current_power_template"
        unit_of_measurement: 'kW'
        icon: mdi:solar-power
        device_class: 'power'
        state_class: 'measurement'
        attributes:
          last_reset: '1970-01-01T00:00:00+00:00'

@shaps just use solaredge Lifetime energy from standard solar edge integration, you don’t need to configure anything more

Indeed but how do you split Grid consumption and solar production ?

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.