UPDATE (March 1st): Added utility meters for more stats.
UPDATE (August 10th): Configuration without battery can be found here, thanks to @SgtBatten :UPDATED! SolarEdge Modbus full setup guide with Energy Dashboard integration for Installations with Battery connected - #306 by SgtBatten
I completely redid the integration and calculation of the sensors and am very happy with the results I have now.
Purpose:
I don’t like how Solaredge reports the production and usage statistics. When I use the default cloud based integration, or the sensors provided by the modbus integration directly, I do not see my true panel production. The reason for this is that Solaredge does not count charging of the connected battery into the production, but only the discharging. This means I get a distorted image about my production.
I spend a lot of time actually analyzing all the sensors, dependencies and actual consumption in house to get to my correct result.
Notes:
You will see differences in some situations. Mainly when discharging of the battery is involved. The reason for this is that both the battery and the inverter have a certain effectiveness (Wirkungsgrad in German). I found out how I can calculate these from the available sensors, so they are taking into account. That means for example:
My battery has a maximum output of 5 kW, however on the AC side of the inverter (that what actually goes into the house) there is only maximum 4,7 kW. This is due to the losses we have from both the battery and the inverter. Actually the inverter normally is pretty stable at 98%, the battery output however varies between as low as 60% and as high as 96%. Solaredge chooses to ignore this which leads to the effect that the House Consumption and the “Usage of Battery” in the monitoring platform are actually both too high. It doesn’t matter that much, since the import and export values are correct, but I like to see the real values.
You may need to wait a day or so before the utilty meters actually have values before you can add them to the Energy Dashboard
If you had the previous version of my integration setup, you may need to reset some statistics. Go to “Developer Tools - Statistics” and use the “Fix Issue” if these are available. Another option to really start clean is of course to delete your database…
Changes to the previous version of my integration:
- Packaged the sensor setup in a new “energy.yaml” file
- Redid all the sensors for the Tesla Style card
- Included Battery and Inverter effectivness sensors
- Making sure that minor deviations are ignored
- Probably a lot more minor things
I will keep working on this, since there is also a request from @stephanschuster (further below in the thread) so you can expect more updates in the future. However, it will be additions to this setup, not a complete rework anymore.
So…to the setup:
I am using this integration:
which is available through HACS. For the setup and installation just follow the instructions. There is an option to select the interval in which it should update, I use 3 seconds for this, since I like to see almost instant values. It does put a strain on the SD card, since the database will grow fast. So…I chose to use the recorder configuration to only include the entities I need. On top of that I now have an SSD connected to my Raspberry and run HASS on there.
I then have the Tesla Style Power card from here:
This is the result:
Next I have the Power distribution card from here:
Looks like this:
This is how my Energy Dashboard now looks after a sunny day:
Following configuration, sensors and templates:
configuration.yaml:
homeassistant:
packages:
energy: !include energy.yaml
create a new file called “energy.yaml” in a subfolder called “packages” of your config directory with following contents:
template:
- sensor:
- name: "Solar Selfconsumption Ratio"
unique_id: solar_selfconsumption_ratio
icon: mdi:percent-outline
state: >
{% if (((states('sensor.solar_panel_to_house_daily')| float(0)) + (states('sensor.solar_battery_in_daily')| float(0)) + (states('sensor.solar_exported_power_daiy')| float(0))) <= 0) %}
0
{% else %}
{{((((states('sensor.solar_panel_to_house_daily')| float(0)) + (states('sensor.solar_battery_in_daily')| float(0))) / ((states('sensor.solar_panel_to_house_daily')| float(0)) + (states('sensor.solar_battery_in_daily')| float(0)) + (states('sensor.solar_exported_power_daily')| float(0)))) * 100) | round (0) }}
{% endif %}
- name: "Solar Autarkie Ratio"
unique_id: solar_autarkie_ratio
icon: mdi:percent-outline
state: >
{% if ((states('sensor.solar_house_consumption_daily') | float(0)) <= 0) %}
0
{% else %}
{{((1 - ((states('sensor.solar_imported_power_daily') | float(0)) / (states('sensor.solar_house_consumption_daily') | float(0)))) * 100 ) | round (0)}}
{% endif %}
- name: "Solar Inverter Effectiveness"
unique_id: solar_inverter_effectiveness
icon: mdi:percent-outline
unit_of_measurement: '%'
state: >
{% if ((states('sensor.solaredge_dc_power') | float(0)) < 100) or ((states('sensor.solaredge_ac_power') | float(0)) < 100)%}
{{(states('sensor.solar_inverter_effectiveness'))}}
{% else %}
{% if is_state('sensor.solar_inverter_effectiveness', 'unknown') %}
1
{% elif ((states('sensor.solaredge_ac_power') | float(0)) <= 0) %}
{{(states('sensor.solar_inverter_effectiveness'))}}
{% elif ((states('sensor.solaredge_dc_power') | float(0)) <= 0) %}
{{(states('sensor.solar_inverter_effectiveness'))}}
{% else %}
{{(states('sensor.solaredge_ac_power') | float(0)) / (states('sensor.solaredge_dc_power') | float(0))}}
{% endif %}
{% endif %}
- name: "Solar Battery Effectiveness"
unique_id: solar_battery_effectiveness
icon: mdi:percent-outline
unit_of_measurement: '%'
state: >
{% if (((states('sensor.solaredge_dc_power') | float(0)) + (states('sensor.solaredge_battery1_power') | float(0))) <= 0 ) %}
{% if ((states('sensor.solaredge_battery1_power')| float(0)) >= 0) %}
{{(states('sensor.solar_battery_effectiveness'))}}
{% elif ((states('sensor.solaredge_dc_power') | float(0)) <= 0) %}
{{(states('sensor.solar_battery_effectiveness'))}}
{% else %}
{{1 - ((((states('sensor.solaredge_battery1_power') | float(0)) * -1) - (states('sensor.solaredge_dc_power') | float(0))) / ((states('sensor.solaredge_battery1_power') | float(0)) * -1))}}
{% endif %}
{% elif is_state('sensor.solar_battery_effectiveness', 'unknown') %}
1
{% elif is_state('sensor.solar_battery_effectiveness', 0) %}
1
{% else %}
{{(states('sensor.solar_battery_effectiveness'))}}
{% endif %}
- name: "Solar Panel Production W"
unique_id: solar_panel_production_w
unit_of_measurement: 'W'
icon: mdi:solar-power
state: >
{% if ((states('sensor.solaredge_dc_power') | float(0)) + (states('sensor.solaredge_battery1_power') | float(0)) <= 0) %}
0
{% elif (is_state('sensor.solaredge_dc_power', 'unknown')) or (is_state('sensor.solaredge_battery1_power', 'unknown'))%}
0
{% else %}
{{((states('sensor.solaredge_dc_power') | float(0)) + (states('sensor.solaredge_battery1_power') | float(0)))}}
{% endif %}
- name: "Solar Panel To House W"
unique_id: solar_panel_to_house_w
unit_of_measurement: 'W'
icon: mdi:solar-power
state: >
{% if ((states('sensor.solaredge_battery1_power') | float(0)) >= 0) and ((states('sensor.solaredge_m1_ac_power') | float(0)) > 0) %}
{{(states('sensor.solaredge_ac_power') | float(0) - states('sensor.solaredge_m1_ac_power') | float(0))}}
{% elif ((states('sensor.solaredge_battery1_power') | float(0)) >= 0) and ((states('sensor.solaredge_m1_ac_power') | float(0)) < 0) %}
{{states('sensor.solaredge_ac_power') | float(0)}}
{% elif ((states('sensor.solaredge_battery1_power') | float(0)) < 0)%}
{% if ((states('sensor.solaredge_dc_power') | float(0) + states('sensor.solaredge_battery1_power') | float(0)) < 0 ) %}
0
{% else %}
{{((states('sensor.solaredge_dc_power') | float(0)) + (states('sensor.solaredge_battery1_power') | float(0))) * (states('sensor.solar_inverter_effectiveness') | float(0))}}
{% endif %}
{% else %}
0
{% endif %}
- name: "Solar Grid To House W"
unique_id: solar_grid_to_house_w
unit_of_measurement: 'W'
icon: mdi:transmission-tower-export
state: >
{% if ((states('sensor.solaredge_m1_ac_power') | float(0)) <= 0) %}
{{((states('sensor.solaredge_m1_ac_power') | float(0)) *-1)}}
{% else %}
0
{% endif %}
- name: "Solar Panel To Grid W"
unique_id: solar_panel_to_grid_w
unit_of_measurement: 'W'
icon: mdi:solar-power
state: >
{% if ((states('sensor.solaredge_m1_ac_power') | float(0)) > 0) %}
{{(states('sensor.solaredge_m1_ac_power') | float(0))}}
{% else %}
0
{% endif %}
- name: "Solar Battery To House W"
unique_id: solar_battery_to_house_w
unit_of_measurement: 'W'
icon: mdi:battery-negative
state: >
{% if ((states('sensor.solaredge_battery1_power') | float(0)) < 0) %}
{{((states('sensor.solaredge_battery1_power') | float(0)) * -1) * (states('sensor.solar_battery_effectiveness')| float(0)) * (states('sensor.solar_inverter_effectiveness')| float(0))}}
{% else %}
0
{% endif %}
- name: "Solar Panel To Battery W"
unique_id: solar_panel_to_battery_w
unit_of_measurement: 'W'
icon: mdi:solar-power
state: >
{% if ((states('sensor.solaredge_battery1_power') | float(0)) > 0) %}
{% if ((states('sensor.solar_grid_to_battery_w') | float(0)) > 0) %}
0
{% else %}
{{(states('sensor.solaredge_battery1_power') | float(0))}}
{% endif %}
{% else %}
0
{% endif %}
- name: "Solar Grid To Battery W"
unique_id: solar_grid_to_battery_w
unit_of_measurement: 'W'
icon: mdi:battery-positive
state: >
{% if (is_state('sensor.solaredge_ac_power', '0')) and ((states('sensor.solaredge_battery1_power') | float(0)) > 0) %}
{{(states('sensor.solaredge_battery1_power') | float(0))}}
{% else %}
0
{% endif %}
- name: "Solar Battery In W"
unique_id: solar_battery_in_w
unit_of_measurement: 'W'
icon: mdi:battery-positive
state: >
{{(states('sensor.solar_grid_to_battery_w') | float(0)) + (states('sensor.solar_panel_to_battery_w') | float(0))}}
- name: "Solar House Consumption W"
unique_id: solar_house_consumption_w
unit_of_measurement: 'W'
icon: mdi:home
state: >
{{(states('sensor.solar_panel_to_house_w') | float(0)) + (states('sensor.solar_battery_to_house_w') | float(0)) + (states('sensor.solar_grid_to_house_w') | float(0))}}
- name: "Solar Imported Power W"
unique_id: solar_imported_power_w
unit_of_measurement: 'W'
icon: mdi:transmission-tower-export
state: >
{% if ((states('sensor.solaredge_m1_ac_power') | float(0)) <= 0) %}
{{((states('sensor.solaredge_m1_ac_power') | float(0)) *-1)}}
{% else %}
0
{% endif %}
- name: "Solar Exported Power W"
unique_id: solar_exported_power_w
unit_of_measurement: 'W'
icon: mdi:transmission-tower-import
state: >
{% if ((states('sensor.solaredge_m1_ac_power') | float(0)) > 0) %}
{{(states('sensor.solaredge_m1_ac_power') | float(0))}}
{% else %}
0
{% endif %}
- name: "Solar Lifetime Production"
unique_id: solar_lifetime_production
unit_of_measurement: 'MWh'
icon: mdi:solar-power
state: >
{{(((states('sensor.solaredge_ac_energy_kwh') | float(0)) / 1000) | round (2))}}
sensor:
- platform: integration
source: sensor.solar_panel_production_w
method: left
unit_prefix: k
name: solar_panel_production_kwh
- platform: integration
source: sensor.solar_battery_to_house_w
method: left
unit_prefix: k
name: solar_battery_out_kwh
- platform: integration
source: sensor.solar_battery_in_w
method: left
unit_prefix: k
name: solar_battery_in_kwh
- platform: integration
source: sensor.solar_house_consumption_w
method: left
unit_prefix: k
name: solar_house_consumption_kwh
- platform: integration
source: sensor.solar_imported_power_w
method: left
unit_prefix: k
name: solar_imported_power_kwh
- platform: integration
source: sensor.solar_exported_power_w
method: left
unit_prefix: k
name: solar_exported_power_kwh
- platform: integration
source: sensor.solar_panel_to_house_w
method: left
unit_prefix: k
name: solar_panel_to_house_kwh
- platform: statistics
name: "Solar Battery Effectiveness Average"
unique_id: solar_battery_effectiveness_average
state_characteristic: mean
sampling_size: 1200
max_age:
hours: 24
entity_id: sensor.solar_battery_effectiveness
- platform: statistics
name: "Solar Inverter Effectiveness Average"
unique_id: solar_inverter_effectiveness_average
state_characteristic: mean
sampling_size: 1200
max_age:
hours: 24
entity_id: sensor.solar_inverter_effectiveness
utility_meter:
solar_panel_production_daily:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Daily
cycle: daily
solar_battery_in_daily:
source: sensor.solar_battery_in_kwh
name: Solar Battery In Daily
cycle: daily
solar_battery_out_daily:
source: sensor.solar_battery_out_kwh
name: Solar Battery Out Daily
cycle: daily
solar_house_consumption_daily:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Daily
cycle: daily
solar_imported_power_daily:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Daily
cycle: daily
solar_imported_power_daily_solaredge:
source: sensor.solaredge_m1_imported_kwh
name: Solar Imported Power Daily Solar Edge
cycle: daily
solar_exported_power_daily:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Daily
cycle: daily
solar_panel_to_house_daily:
source: sensor.solar_panel_to_house_kwh
name: Solar Panel To House Daily
cycle: daily
solar_panel_to_house_weekly:
source: sensor.solar_panel_to_house_kwh
name: Solar Panel To House Weekly
cycle: weekly
solar_imported_power_weekly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Weekly
cycle: weekly
solar_house_consumption_weekly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Weekly
cycle: weekly
solar_panel_production_weekly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Weekly
cycle: weekly
solar_battery_in_weekly:
source: sensor.solar_battery_in_kwh
name: Solar Battery In Weekly
cycle: weekly
solar_battery_out_weekly:
source: sensor.solar_battery_out_kwh
name: Solar Battery Out Weekly
cycle: weekly
solar_exported_power_weekly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Weekly
cycle: weekly
solar_panel_to_house_monthly:
source: sensor.solar_panel_to_house_kwh
name: Solar Panel To House Monthly
cycle: monthly
solar_imported_power_monthly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Monthly
cycle: monthly
solar_house_consumption_monthly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Monthly
cycle: monthly
solar_panel_production_monthly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Monthly
cycle: monthly
solar_battery_in_monthly:
source: sensor.solar_battery_in_kwh
name: Solar Battery In Monthly
cycle: monthly
solar_battery_out_monthly:
source: sensor.solar_battery_out_kwh
name: Solar Battery Out Monthly
cycle: monthly
solar_exported_power_monthly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Monthly
cycle: monthly
solar_panel_to_house_yearly:
source: sensor.solar_panel_to_house_kwh
name: Solar Panel To House Yearly
cycle: yearly
solar_imported_power_yearly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Yearly
cycle: yearly
solar_house_consumption_yearly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Yearly
cycle: yearly
solar_panel_production_yearly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Yearly
cycle: yearly
solar_battery_in_yearly:
source: sensor.solar_battery_in_kwh
name: Solar Battery In Yearly
cycle: yearly
solar_battery_out_yearly:
source: sensor.solar_battery_out_kwh
name: Solar Battery Out Yearly
cycle: yearly
solar_exported_power_yearly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Yearly
cycle: yearly
Configuration for the Tesla Style Card:
type: custom:tesla-style-solar-power-card
name: Home Energy Flow
grid_to_house_entity: sensor.solar_grid_to_house_w
generation_to_grid_entity: sensor.solar_panel_to_grid_w
generation_to_battery_entity: sensor.solar_panel_to_battery_w
generation_to_house_entity: sensor.solar_panel_to_house_w
battery_to_house_entity: sensor.solar_battery_to_house_w
grid_to_battery_entity: sensor.solar_grid_to_battery_w
battery_extra_entity: sensor.solaredge_battery1_state_of_charge
Configuration of the Power Distribution Card:
type: custom:power-distribution-card
title: ''
entities:
- decimals: 2
display_abs: true
name: solar
unit_of_display: adaptive
icon: mdi:solar-power
producer: true
entity: sensor.solar_panel_production_w
preset: solar
- decimals: 2
display_abs: true
name: grid
unit_of_display: adaptive
icon: mdi:transmission-tower
entity: sensor.solaredge_m1_ac_power
preset: grid
threshold: ''
icon_color:
bigger: ''
equal: ''
smaller: ''
invert_value: true
- decimals: 2
display_abs: true
name: home
unit_of_display: W
consumer: true
icon: mdi:home-assistant
entity: sensor.solar_house_consumption_w
preset: home
threshold: ''
icon_color:
bigger: ''
equal: ''
smaller: ''
invert_value: true
- decimals: 2
display_abs: true
name: battery
unit_of_display: W
consumer: true
icon: mdi:battery-outline
producer: true
entity: sensor.solaredge_battery1_power
preset: battery
threshold: ''
icon_color:
bigger: ''
equal: ''
smaller: ''
invert_value: true
center:
type: bars
content:
- preset: autarky
name: autark
bar_color: green
bar_bg_color: ''
entity: sensor.solar_autarkie_ratio
- preset: ratio
name: selbst
bar_color: blue
bar_bg_color: ''
entity: sensor.solar_selfconsumption_ratio
animation: none
Configuration of the Energy Dashboard:
Have fun… Look forward to the feedback on this work.