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.
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
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.
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
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'
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.