This is a fork of the great work already done by Remko with his post: Solaredge Modbus Configuration for Single Inverter and Battery. For the HACS integration:
For who is this fork?
Remko’s original post was from Sep '22. Things have changed in the mean time. I used his code, but I had to change a lot because my entity names were not the same. My 3 devices were named:
- Solaredge I1
- Solaredge I1 M1
- Solaredge I1 B1
Also I wanted the bare essentials and no tariffs etc.
Backstory
From 2023 up till April 2025 I had a SolarEdge SE3K inverter. I wanted a SolarEdge Battery and this was not possible with this inverter. SolarEdge had a trade-in program (new inverter for the old), so I got the new SE5K-RWB48 (SE5K-HUB) with the SolarEdge Home Backup Interface (BI-EU3P) and 2 SolarEdge 48V Home Battery’s.
Up until the new system I ran the official SolarEdge integration in Home Assistant and that worked great. I got the same numbers as the Monitoring app from SolarEdge. This al changed with the new system. The numbers SolarEdge’s API gave me weren’t correct. Also within the app of my energy provider, where I also made a link to SolarEdge was providing very strange numbers.
I created a case with SolarEdge, and after some convincing that their numbers where wrong, they admitted that there was a problem:
Our monitoring system displays data based on numerous calculations and algorithms, and lately, we’ve noticed that this isn’t always calculated correctly on our end.
This is a long-standing bug in our monitoring portal.
A completely new monitoring system will be rolled out in the near future that will resolve these types of issues.
So left with nothing to see what my system was doing, I searched for a solution. The HA original integration “SolarEdge Local” didn’t work for me. So HACS to the rescue. There I found “SolarEdge Modbus”. But this didn’t worked also. And so I came to “SolarEdge Modbus Multi” and this one worked! I asked my installer to enable the Modbus TCP in my inverter and got to work.
This integration gave me a bunch of numbers, but I soon noticed that it didn’t gave me all the numbers I was looking for. Especially what my solar panels were doing, and where the power went. So more searching and reading. And that’s how I ended up with Remko’s post.
But… Like so many times getting it all to work wasn’t straightforward. The naming of my entity’s didn’t correspond with Remko’s. The recorder part shutdown all other recordings. Some naming was different. Dashboard was in the old style and many more things. Also I missed some key information in the main post, so I had to read a lot to get everything working.
So in this post I will try to give a complete manual of everything I did. If you see anything wrong, let me know!
I’ll assume that you already have Modbus TCP acces to you’re inverter and you have HACS installed in you’re Home Assistant.
- With HACS install the “SolarEdge Modbus Multi”. Then in “Integrations” add the “SolarEdge Modbus Multi”. I use 10 sec for ‘call frequency’ (haven’t had any problems with this high frequency), but you can change that if you want. I checked the boxes for “Automatic meter detection” and “Automatic battery detection” and left the others unchecked or standard.
Now this is key!! The naming of my devices is “Solaredge I1”, “Solaredge I1 M1” and “Solaredge I1 B1”. So an entity within my meter looks like this: sensor.solaredge_i1_m1_ac_power. This is key, because that’s where my files are based on.
- From the GitHub Remko’s created I only used 3 files: “energy_utilities.yaml”, “energy_stats.yaml” and "“electricity.yaml”. I changed the naming of the entities to mine, and also deleted some code that I didn’t find necessary like weekly numbers. Here are the 3 files: (check different entity names in the code below if they correspond to your entities!!)
electricity.yaml
template:
- sensor:
- name: "Solar Panel Production W"
unique_id: solar_panel_production_w
unit_of_measurement: "W"
icon: mdi:solar-power
state: >
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% set b1_dc_power = states('sensor.solaredge_i1_b1_dc_power') | float(0) %}
{% if (is_state('sensor.solaredge_i1_dc_power', 'unknown') or is_state('sensor.solaredge_i1_b1_dc_power', 'unknown')) %}
0
{% elif (i1_dc_power + b1_dc_power <= 0) %}
0
{% else %}
{{ (i1_dc_power + b1_dc_power) }}
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_dc_power') | is_number and states('sensor.solaredge_i1_ac_power') | is_number and states('sensor.solaredge_i1_b1_dc_power') | is_number }}
- name: "Solar Panel To House W"
unique_id: solar_panel_to_house_w
unit_of_measurement: "W"
icon: mdi:solar-power
state: >
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
{% set b1_dc_power = states('sensor.solaredge_i1_b1_dc_power') | float(0) %}
{% set m1_ac_power = states('sensor.solaredge_i1_m1_ac_power') | float(0) %}
{% set inverter_effectiveness = states('sensor.solar_inverter_effectiveness') | float(0) %}
{% if (b1_dc_power >= 0 and m1_ac_power > 0) %}
{% if (i1_dc_power < 0 and i1_ac_power <= 0) %}
{{ (i1_dc_power - m1_ac_power) }}
{% else %}
{{ (i1_ac_power - m1_ac_power) }}
{% endif %}
{% elif (b1_dc_power >= 0 and m1_ac_power <= 0) %}
{% if (i1_dc_power < 0 and i1_ac_power <= 0) %}
0{#{{ (i1_dc_power) }}#}{# Added 0 #}
{% else %}
{{ (i1_ac_power) }}
{% endif %}
{% elif (b1_dc_power < 0) %}
{% if (i1_dc_power + b1_dc_power < 0) %}
0
{% else %}
{{ ((i1_dc_power + b1_dc_power) * inverter_effectiveness) }}
{% endif %}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_dc_power') | is_number and states('sensor.solaredge_i1_ac_power') | is_number and states('sensor.solaredge_i1_b1_dc_power') | is_number and states('sensor.solaredge_i1_m1_ac_power') | is_number }}
- name: "Solar Panel To Battery W"
unique_id: solar_panel_to_battery_w
unit_of_measurement: "W"
icon: mdi:solar-power
state: >
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
{% set b1_dc_power = states('sensor.solaredge_i1_b1_dc_power') | float(0) %}
{% set grid_to_battery_w = states('sensor.solar_grid_to_battery_w') | float(0) %}
{% if (b1_dc_power > 0) %}
{% if (grid_to_battery_w > 0) %} {# Added this snippet instead of 0 #}
{% if (i1_dc_power < 0 and i1_ac_power <= 0) %}
{{ (b1_dc_power+i1_dc_power) }}
{% else %}
0
{% endif %}
{% else %}
{{ b1_dc_power }}
{% endif %}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_b1_dc_power') | is_number }}
- name: "Solar Panel To Grid W"
unique_id: solar_panel_to_grid_w
unit_of_measurement: "W"
icon: mdi:solar-power
state: >
{% set panel_production_w = states('sensor.solar_panel_production_w') | float(0) %}
{% set exported_power_w = states('sensor.solar_exported_power_w') | float(0) %}
{% if (exported_power_w > 0 and panel_production_w > 0) %}
{% if (exported_power_w > panel_production_w) %}
{{ panel_production_w }}
{% else %}
{{ exported_power_w }}
{% endif %}
{% 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: >
{% set b1_dc_power = states('sensor.solaredge_i1_b1_dc_power') | float(0) %}
{% set battery_effectiveness = states('sensor.solar_battery_effectiveness') | float(0) %}
{% set inverter_effectiveness = states('sensor.solar_inverter_effectiveness') | float(0) %}
{% if (b1_dc_power < 0) %}
{{ (b1_dc_power * -1 * battery_effectiveness * inverter_effectiveness) }}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_b1_dc_power') | is_number }}
- name: "Solar Battery To Grid W"
unique_id: solar_battery_to_grid_w
unit_of_measurement: "W"
icon: mdi:solar-power
state: >
{% set exported_power_w = states('sensor.solar_exported_power_w') | float(0) %}
{% set panel_to_grid_w = states('sensor.solar_panel_to_grid_w') | float(0) %}
{% if (exported_power_w > panel_to_grid_w) %}
{{ exported_power_w - panel_to_grid_w }}
{% 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: >
{% set m1_ac_power = states('sensor.solaredge_i1_m1_ac_power') | float(0) %}
{% set grid_to_battery_w = states('sensor.solar_grid_to_battery_w') | float(0) %}
{% if (m1_ac_power <= 0) %}
{{ (m1_ac_power * -1) - grid_to_battery_w }} {# Added grid_to_battery_w. #}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_m1_ac_power') | is_number }}
- name: "Solar Grid To Battery W"
unique_id: solar_grid_to_battery_w
unit_of_measurement: "W"
icon: mdi:battery-positive
state: >
{% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
{% set b1_dc_power = states('sensor.solaredge_i1_b1_dc_power') | float(0) %}
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% if (i1_ac_power <= -25 and b1_dc_power > 0) %} {#added -25 instead of 0#}
{{ i1_dc_power|abs }} {# Changed to i1_dc_power #}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_ac_power') | is_number and states('sensor.solaredge_i1_b1_dc_power') | is_number}}
- name: "Solar Battery In W"
unique_id: solar_battery_in_w
unit_of_measurement: "W"
icon: mdi:battery-positive
state: >
{% set grid_to_battery_w = states('sensor.solar_grid_to_battery_w') | float(0) %}
{% set panel_to_battery_w = states('sensor.solar_panel_to_battery_w') | float(0) %}
{{ (grid_to_battery_w + panel_to_battery_w) }}
- name: "Solar House Consumption W"
unique_id: solar_house_consumption_w
unit_of_measurement: "W"
icon: mdi:home
state: >
{% set panel_to_house_w = states('sensor.solar_panel_to_house_w') | float(0) %}
{% set battery_to_house_w = states('sensor.solar_battery_to_house_w') | float(0) %}
{% set grid_to_house_w = states('sensor.solar_grid_to_house_w') | float(0) %}
{{ (panel_to_house_w + battery_to_house_w + grid_to_house_w) }}
- name: "Solar Imported Power W"
unique_id: solar_imported_power_w
unit_of_measurement: "W"
icon: mdi:transmission-tower-export
state: >
{% set m1_ac_power = states('sensor.solaredge_i1_m1_ac_power') | float(0) %}
{% if (m1_ac_power < 0) %}
{{ (m1_ac_power * -1) }}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_m1_ac_power') | is_number}}
- name: "Solar Exported Power W"
unique_id: solar_exported_power_w
unit_of_measurement: "W"
icon: mdi:transmission-tower-import
state: >
{% set m1_ac_power = states('sensor.solaredge_i1_m1_ac_power') | float(0) %}
{% if (m1_ac_power > 0) %}
{{ (m1_ac_power) }}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_ac_power') | is_number }}
- name: "Solar Lifetime Production"
unique_id: solar_lifetime_production
unit_of_measurement: "MWh"
icon: mdi:solar-power
state: >
{% set ac_energy_kwh = states('sensor.solaredge_i1_ac_energy') | float(0) %}
{{ ((ac_energy_kwh / 1000) | round (2)) }}
availability: >
{{ states('sensor.solaredge_i1_ac_energy') | is_number }}
sensor:
# Panels
- platform: integration
source: sensor.solar_panel_production_w
method: left
unit_prefix: k
name: solar_panel_production_kwh
- platform: integration
source: sensor.solar_panel_to_house_w
method: left
unit_prefix: k
name: solar_panel_to_house_kwh
- platform: integration
source: sensor.solar_panel_to_battery_w
method: left
unit_prefix: k
name: solar_panel_to_battery_kwh
# Grid
- platform: integration
source: sensor.solar_imported_power_w
method: left
unit_prefix: k
name: solar_imported_power_kwh
- platform: integration
source: sensor.solar_grid_to_battery_w
method: left
unit_prefix: k
name: solar_grid_to_battery_kwh
- platform: integration
source: sensor.solar_exported_power_w
method: left
unit_prefix: k
name: solar_exported_power_kwh
# Battery
- 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
# House
- platform: integration
source: sensor.solar_house_consumption_w
method: left
unit_prefix: k
name: solar_house_consumption_kwh
energy_stats.yaml
template:
- sensor:
- name: "Solar Selfconsumption Ratio"
unique_id: solar_selfconsumption_ratio
icon: mdi:percent-outline
state: >
{% set panel_to_house_daily = states('sensor.solar_panel_to_house_daily') | float(0) %}
{% set battery_in_daily = states('sensor.solar_battery_in_daily') | float(0) %}
{% set exported_power_daiy = states('sensor.solar_exported_power_daiy') | float(0) %}
{% if (panel_to_house_daily + battery_in_daily + exported_power_daiy <= 0) %}
0
{% else %}
{{ ((panel_to_house_daily + battery_in_daily) / (panel_to_house_daily + battery_in_daily + exported_power_daiy) * 100) | round (1) }}
{% endif %}
- name: "Solar Autarkie Ratio"
unique_id: solar_autarkie_ratio
icon: mdi:percent-outline
state: >
{% set house_consumption_daily = states('sensor.solar_house_consumption_daily') | float(0) %}
{% set imported_power_daily = states('sensor.solar_imported_power_daily') | float(0) %}
{% if (house_consumption_daily <= 0) %}
0
{% else %}
{{ (1 - (imported_power_daily / house_consumption_daily) * 100) | round (1) }}
{% endif %}
- name: "Solar Inverter Effectiveness"
unique_id: solar_inverter_effectiveness
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
{% set inverter_effectiveness = states('sensor.solar_inverter_effectiveness') %}
{% if (is_state('sensor.solar_inverter_effectiveness', 'unknown')) %}
1
{% elif (i1_dc_power < 100 or i1_ac_power < 100) %}
{{ inverter_effectiveness }}
{% else %}
{{ (i1_ac_power ) / (i1_dc_power) }}
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_dc_power') | is_number and states('sensor.solaredge_i1_ac_power') | is_number }}
- name: "Solar Battery Effectiveness"
unique_id: solar_battery_effectiveness
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% set b1_dc_power = states('sensor.solaredge_i1_b1_dc_power') | float(0) %}
{% set battery_effectiveness = states('sensor.solar_battery_effectiveness') %}
{% if (is_state('sensor.solar_battery_effectiveness', 'unknown') or (solar_battery_effectiveness == 0)) or (is_state('sensor.solar_battery_effectiveness', 'unavailable'))%}
1
{% elif (i1_dc_power + b1_dc_power <= 0) %}
{% if (b1_dc_power >= 0 or i1_dc_power <= 0) %}
{{ battery_effectiveness }}
{% else %}
{{ (1 - ((b1_dc_power * -1 - (i1_dc_power)) / b1_dc_power * -1)) }}
{% endif %}
{% else %}
{{ battery_effectiveness }}
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_dc_power') | is_number and states('sensor.solaredge_i1_ac_power') | is_number and states('sensor.solaredge_i1_b1_dc_power') | is_number }}
- name: "Solar Inverter Effectiveness Int"
unique_id: solar_inverter_effectiveness_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_inverter_effectiveness') | float(0)) * 100) | round(2) }}
- name: "Solar Battery Effectiveness Int"
unique_id: solar_battery_effectiveness_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_battery_effectiveness')| float(0)) * 100) | round(2) }}
- name: "Solar Inverter Effectiveness Average Int"
unique_id: solar_inverter_effectiveness_average_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_inverter_effectiveness_average') | float(0)) * 100) | round(2) }}
- name: "Solar Battery Effectiveness Average Int"
unique_id: solar_battery_effectiveness_average_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_battery_effectiveness_average')| float(0)) * 100) | round(2) }}
sensor:
- 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
energy_utilities.yaml
utility_meter:
### Daily
# Electricity PV Panels
solar_panel_to_house_daily:
source: sensor.solar_panel_to_house_kwh
name: Solar Panel To House Daily
cycle: daily
solar_panel_production_daily:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Daily
cycle: daily
# Electricity Grid
solar_imported_power_daily_solaredge:
source: sensor.solaredge_i1_m1_ac_energy_imported
name: Solar Imported Power Daily Solar Edge
cycle: daily
solar_imported_power_daily:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Daily
cycle: daily
# Electricity Battery
solar_battery_from_grid_daily:
source: sensor.solar_grid_to_battery_kwh
name: Solar Battery Imported Daily
cycle: daily
solar_battery_from_panels_daily:
source: sensor.solar_panel_to_battery_kwh
name: Solar Battery Generated 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
# Electricity Export
solar_exported_power_daily:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Daily
cycle: daily
# Consumption
solar_house_consumption_daily:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Daily
cycle: daily
#### Monthly
# Electricity PV Panels
solar_panel_to_house_monthly:
source: sensor.solar_panel_to_house_kwh
name: Solar Panel To House Monthly
cycle: monthly
solar_panel_production_monthly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Monthly
cycle: monthly
# Electricity Grid
solar_imported_power_monthly_solaredge:
source: sensor.solaredge_i1_m1_ac_energy_imported
name: Solar Imported Power Monthly Solar Edge
cycle: monthly
solar_imported_power_monthly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Monthly
cycle: monthly
# Electricity Battery
solar_battery_from_grid_monthly:
source: sensor.solar_grid_to_battery_kwh
name: Solar Battery Imported Monthly
cycle: monthly
solar_battery_from_panels_monthly:
source: sensor.solar_panel_to_battery_kwh
name: Solar Battery Generated 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
# Electricity Export
solar_exported_power_monthly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Monthly
cycle: monthly
# Consumption
solar_house_consumption_monthly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Monthly
cycle: monthly
####### Yearly
# Electricity PV Panels
solar_panel_to_house_yearly:
source: sensor.solar_panel_to_house_kwh
name: Solar Panel To House Yearly
cycle: yearly
solar_panel_production_yearly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Yearly
cycle: yearly
# Electricity Grid
solar_imported_power_yearly_solaredge:
source: sensor.solaredge_i1_m1_ac_energy_imported
name: Solar Imported Power Yearly Solar Edge
cycle: yearly
solar_imported_power_yearly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Yearly
cycle: yearly
# Electricity Battery
solar_battery_from_grid_yearly:
source: sensor.solar_grid_to_battery_kwh
name: Solar Battery Imported Yearly
cycle: yearly
solar_battery_from_panels_yearly:
source: sensor.solar_panel_to_battery_kwh
name: Solar Battery Generated 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
# Electricity Export
solar_exported_power_yearly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Yearly
cron: "0 0 30 9 *"
# Consumption
solar_house_consumption_yearly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Yearly
cycle: yearly
-
With “File editor” (or any other similar editing program in Home Assistant) create a folder “solaredge” on top level (next to all your other HA files and folders). Within this folder create 3 files: “electricity.yaml”, “energy_stats.yaml” and “energy_utilities.yaml”. Copy the code from above.
-
In your “configuration.yaml” add the following code:
homeassistant:
packages: !include_dir_named solaredge
customize:
sensor.solar_imported_power_kwh:
device_class: energy
sensor.solar_exported_power_kwh:
device_class: energy
sensor.solar_panel_production_kwh:
device_class: energy
sensor.solar_panel_to_house_kwh:
device_class: energy
sensor.solar_panel_to_battery_kwh:
device_class: energy
sensor.solar_grid_to_battery_kwh:
device_class: energy
sensor.solar_battery_out_kwh:
device_class: energy
sensor.solar_battery_in_kwh:
device_class: energy
sensor.solar_house_consumption_kwh:
device_class: energy
Off course after this restart your Home Assistant.
That’s it! In my next post I’ll share what to put in your Energy dashboard, Remko’s adjusted dashboard with the right entity names and other helpful tips.