Solaredge output not showing on Energy Dashboard

Hi All,

This has been bugging me for a while. I’m not seeing the inverter writing to the Energy Dashboard. I’m using the SolarEdge Multi Inverter plugin (Home · WillCodeForCats/solaredge-modbus-multi Wiki · GitHub) which appears to be working fine.

image

Added to the Energy Dashboard configuration

image

However nothing shows on the dashboard.

Looking at the sensor, it seems ok to me.

state_class: measurement
unit_of_measurement: kWh
device_class: energy
icon: mdi:solar-power
friendly_name: SolarEdge SE5000 (I1 AC Energy kWh)
last_reset: ‘1970-01-01T00:00:00+00:00’

Any guidance in sorting this issue out would be appreciated.

Cheers,
Paul

measurement is not a valid state_class for the energy dashboard. It needs to be total_increasing or total i believe

Hmm ok, so being hard coded in the integration should I set up a sensor in yaml with the correct parameters and update it as the hard coded one updates or can I modify the current sensor somehow

You could set up a template sensor pretty easily.

I have read you can change the state class through the customize interface though can’t find it right now in the new settings menu, maybe only by yaml.

You could also make a request on the integration github to change it but that will take the longest.

Yes, I agree. If the sensor is already reporting 28MWh, it should always be increasing, so it shouldn’t be too hard to create a template sensor from this using all the other parameters set accordingly.

Here is one I use for “Solar Production”. It takes an existing SolarEdge sensor that is in Wh and converts it to kWh.

      - name: "SolarEdge Production Energy Template" 
        state: >-
          {% if is_number(states("sensor.solaredge_production_energy"))  %}
            {{(states("sensor.solaredge_production_energy") | float / 1000) | round(3)}}
          {%- else -%}
            {{ states("sensor.solaredge_production_energy") }}
          {%- endif %}
        unique_id: "solaredge_production_energy_template"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        device_class: 'energy'
        state_class: 'total_increasing' #value monotonically increasing (may get reset occasionally)

I did create a template sensor last night, however it still isn’t playing good. What I realized was that the energy sensor from the integration was a running total for the life of the unit rather that a daily total so I ended up setting up the following.

Template sensor to hold the daily energy value:

  - sensor:
      - name: "SolarEdge Daily Energy KWh"
        icon: mdi:solar-power
        device_class: 'energy'
        state_class: 'total_increasing'
        unit_of_measurement: kWh
        unique_id: "solaredge_daily_energy_kwh"
        state: >
          {% if not is_state('sensor.solaredge_se5000_i1_ac_energy_kwh', 'unknown') and not is_state('input_number.solaredge_daily_reset', 'unknown') %}
            {% set m_ac_energy = states('sensor.solaredge_se5000_i1_ac_energy_kwh') | float %}
            {% set m_ac_energy_reset = states('input_number.solaredge_daily_reset') | float %}
          {% else %}
            {% set m_ac_energy = 0 | float %}
            {% set m_ac_energy_reset = 0 | float %}
          {% endif %}
          {{ m_ac_energy - m_ac_energy_reset }}

input_number which holds the reset value set at midnight

input_number:
  solaredge_daily_reset:
    name: Solaredge Daily Reset
    min: 0
    max: 100000
    initial: 0

And an automation to set the above input_number to the current total kwh value

- id: '1654934122628'
  alias: New Automation
  description: ''
  trigger:
  - platform: time
    at: 00:00:00
  condition: []
  action:
  - service: input_number.set_value
    data:
      value: '{{ states.sensor.solaredge_se5000_i1_ac_energy_kwh.state | float }}'
    target:
      entity_id: input_number.solaredge_daily_reset
  mode: single

This all works as expected in terms of updating, etc however still does not display on the energy page. What I notice is when looking at the sensor.solaredge_daily_energy_kwh in the dev tools, I see the following attributes. In particular, the state_class is seen as “measurement” as opposed to what was configured in yaml.

state_class: measurement
unit_of_measurement: kWh
device_class: energy
icon: mdi:solar-power
friendly_name: SolarEdge Daily Energy KWh
last_reset: '1970-01-01T00:00:00+00:00'

total lifetime should work fine.

But yes the state class is still wrong.

Looking at the code of the integration you are using it should have a state class of total increasing.
Is yours up to date?

Hi,

I’ve just gone through an hour or so of removing, reinstalling, etc. I was on version 1.22 or something similar (latest non beta version) and yes, I could see in code where the state_class should be total increasing however is was still set as measurement.

I’ve now installed the beta version and I have the same configuration. The beta version creates separate devices now for inverter and meter. I’ll wait until the sun comes up tomorrow and see if it actually writes, however at this point it still doesn’t appear to be showing the correct state class.

state_class: measurement
unit_of_measurement: kWh
device_class: energy
friendly_name: Solaredge I2 AC Energy kWh
last_reset: '1970-01-01T00:00:00+00:00'

Same applies as mentioned earlier with the sensor I created. state class was set accordingly, however shows as measurement.

I myself don’t understand how a template sensor w. state_class set to one thing gets change to another. I doubt it will make a difference, but maybe put the kWh in single quotes: 'kWh'.

As it turned out, it occurred to me why even the integration sensors were not showing the correct class_state, it had to do with the customize_glob section in the configuration yaml basically overriding any sensor with “energy” in the name.

#customize_glob:
    #sensor.*_energy*:
    #  last_reset: '1970-01-01T00:00:00+00:00'
    #  device_class: energy
    #  state_class: measurement

At least the sensors are showing the correct attributes now, will see what the dashboard looks like in a couple of hours.