UPDATED! SolarEdge Modbus full setup guide with Energy Dashboard integration for Installations with Battery connected

@athanbako Basically everything with “battery” in the name…:wink: I think @SgtBatten did this for himself, so maybe he can share his config file with you.

That is strange… are you using the “SolarEdge modbus” integration I referenced in my first post? I did not have to do anything special to get the battery data, it just showed up automatically.

I am currently also testing the “MultiInverter” (https://github.com/WillCodeForCats/solaredge-modbus-multi) fork of this integration and that may be my way for the future. I am still having some minor issues with this, so I did not post a changed config, but it is not hard to change my config to match that integration. So you may want to try that out and see if that does give you the proper data.

1 Like

yup, I’m using the non-multi solaredge modbus integration, but the multi-inverter integration also doesn’t work. I’m really quite certain that my inverter isn’t exposing any of the battery or power control registers. I was able to successfully read a random sampling of inverter, meter 1, and meter 2 registers manually, but none of the offsets for the battery or power control are available. I’ll bug SolarEdge I guess, it’s pretty obvious that it’s not exposing stuff in the expected location. No integration will work if the data’s not there. :wink:

energy.yaml for setups without a battery / batteries.

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_exported_power_daily')| float(0)) <= 0 %}
            0
          {% else %}
            {{ (((states('sensor.solar_panel_to_house_daily')| float(0)) / (states('sensor.solar_panel_to_house_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 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) <= 0 %}
            0
          {% elif is_state('sensor.solaredge_dc_power', 'unknown') %}
            0
          {% else %}
            {{ states('sensor.solaredge_dc_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_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_m1_ac_power') | float(0) < 0 %}
            {{states('sensor.solaredge_ac_power') | float(0)}}
          {% elif ((states('sensor.solaredge_dc_power') | float(0)) < 0)%}
            0  
          {% else %}
            {{(states('sensor.solaredge_dc_power') | float(0)) * (states('sensor.solar_inverter_effectiveness') | float(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 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_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_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 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_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_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_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_exported_power_yearly:
    source: sensor.solar_exported_power_kwh
    name: Solar Exported Power Yearly
    cycle: yearly

@Remko perhaps you might link to this post in the OP to save repeat questions?

*note I made extensive name changes to my own file so i’ve just edited the OP here right now. It is possible I’ve deleted one too many brackets by accident so any troubleshooting should start there (and please let me know so I can fix for the next person.)

Bonus link to my guide for handling complex demand tariffs that we seem to be getting in Australia.

2 Likes

It does sound like your inverter either has a problem or just simply does not expose the data as we have seen so far. So yes, maybe Solaredge can help you here, I am afraid I cannot… :slight_smile:

1 Like

I am having the same issue with a SE7600H-US; battery information does not show, but everything else is present. I’ve tried debugging with the solaredge_modbus library in python, and I can’t get that to return anything either.

If you’re using the Solaredge cloud monitoring platform, I’d be curious how the following information looks on your “Analysis” tab? The Battery 1.2 part doesn’t look right to me. Screenshot from 2022-08-10 15-32-36

Hi, I just had a LAN line installed this morning and MODBus is talking to my install. Unfortunately, your template is indeed broken. It appears to be somewhere in the first section.

Really looking forward to getting this going. Not sure I will syntax my way out of this one but I may try. Best if you can please provide a fix.

Thank you kindly,

Thanks, try now. Found 2 broken things and have edited the post.

2 Likes

Yeah man. Rock and roll.

Cheers!

This had been frustrating for the last six months.

Looks like SolarEdge have re-enabled ModbusTCP over wifi with the new firmware release!

https://www.solaredge.com/aus/setapp-inverters-firmware

Nice work.

Except for Australia?

Does it mean we just have a different firmware number, not that the update isn’t applicable?

It looks like Australia might still be on the older version. Maybe it’ll be updated in the future?

@Remko I have to thank you a lot, that‘s the solution I was searching for ages!!

On that base I was able to integrate an easy automation for predictive charging to maximize the daily production (my system is limited to 50% active power) and care a bit more gently about the storage.

I’d like to share it. Though this is my first try on ha as a newbie and I can’t guarantee a seamless function. The automation is running a few days now. Note, that the charge limit will be exceeded as soon as the power production is higher than self consumption plus export limit (plus charge limit). That’s the neat trick for the available control modes. Every sunset one of the two following automations showing at the end resets “Storage Control” back to “Maximize Self Consumption”, to not mess up the buggy solaredge monitoring values.

At first I created an account type “My home PV system only” at Solcast, which gives me better data since you are able to create two roofs. I have three different roof alignments, so I middled out the angles of two areas to reach the available ammount of two roofs. The API will throw the data-set as addition of both roofs.

As next I installed the Solcast PV Solar hacs integration and replaced the original forecast integration at the energy dashboard.

Finaly this two automations are running:

- id: 'xxxxxxxxxxxx'
  alias: PV abends auf Max. Eigenverbrauch
  description: ''
  trigger:
  - platform: sun
    event: sunset
    offset: 0
  condition: []
  action:
  - service: select.select_option
    data:
      option: Maximize Self Consumption
    target:
      entity_id: select.solaredge_storage_control_mode
  mode: single
- id: 'xxxxxxxxxxxx'
  alias: PV Überschussladen prüfen/aktivieren
  description: Morgens Prüfung, ob SolCast-API polled und Grenzwerte (Ertrag und Peak-Energie
    in kW/h) für Überschussladen erreicht werden. Zuerst Speicher auf x% laden wenn
    Wert darunter, danach Ladeleistung reduzieren, bis Prognose-Restenergie für den
    Tag kritischen Wert erreicht, um Speicher voll zu laden. Nach Unterschreitung
    wieder max. Ladeleistung.
  trigger:
  - platform: time
    at: 06:15:00
  condition:
  - condition: numeric_state
    entity_id: sensor.solcast_peak_forecast_today
    above: '3200'
  - condition: numeric_state
    entity_id: sensor.solcast_forecast_today
    above: '15'
  - condition: numeric_state
    entity_id: sensor.solcast_api_remaining
    below: '50'
    above: '45'
  action:
  - repeat:
      until:
      - condition: numeric_state
        entity_id: sensor.solaredge_battery1_state_of_charge
        above: '49'
      sequence:
      - delay:
          hours: 0
          minutes: 5
          seconds: 0
          milliseconds: 0
  - service: select.select_option
    data:
      option: Remote Control
    target:
      entity_id: select.solaredge_storage_control_mode
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - repeat:
      until:
      - condition: numeric_state
        entity_id: sensor.solcast_forecast_remaining_today
        below: '8'
      sequence:
      - service: number.set_value
        data:
          value: '240'
        target:
          entity_id: number.solaredge_storage_remote_charge_limit
      - delay:
          hours: 0
          minutes: 15
          seconds: 0
          milliseconds: 0
  - service: number.set_value
    data:
      value: '5000'
    target:
      entity_id: number.solaredge_storage_remote_charge_limit
  mode: single
1 Like

Maybe you found it out yourself in the meantime. If not, maybe we are talking about this issue:
The inverter’s and storage’s controllers self consumption are around 60-70W, which is not represented in the solaredge portal - guess why :smile: . So if at night the house consumption ist around 200W, the battery needs to deliver 270W. Thanks to your setup this ist visible. That big (and waste) consumption from the controllers was discussed at photovoltaikforum.com as well. Something we need to tolerate is the system consumes around ~570kWh/a just for running. But the hurting behavior comes up, if the battery is empty and the inverter+storage controllers are sucking the lasting electrons out of it until the grid needs to recharge it back up to 10% reserve. The quest to resolve is, that the inverter never goes to a „real“ standby if a battery is installed.
Hopefully we can trick this out by a smart automation like: If battery is empty (10%), and no production forecasted (better 30% “backup reserve” instead of 10% to extend battery’s state of health - at 10% the chemical aging will be high) shut down the battery for a time period, but don’t mess up the solaredge portals values also! This should make happen the inverter is going to sleep meanwhile at night as well and grid consumption will be about that 60-70w less.
Recently I didn’t dive deep enough to know how to realize that. Autumn and winter are coming. Maybe there’s folks out here which can support?

Hmm…very interesting information. Hadn’t thought about the fact that simply having the inverter and battery active actually consumes energy (fully logical of course). The other effect which is visible in my configuration is the fact that the battery itself varies it effectivness based on load and state of charge. I find these effects to be even more “dramatic” but that is just the nature of a battery of course.

To think about automations which would control the power usage of the inverter is an interesting thought. I am just not sure if that actually is possible, I mean; can we put the inverter in a sleep mode externally or does it even have such a thing…? But worth investigating more, I hope someone here might have some good ideas on that.

The battery effectivness in my understanding should be the ratio discharged:charged. But I am not shure how to fetch the datapoints correctly. Maybe it could be possible for fixed runs like:

Counting discharged energy from 100% down to 70% : charged energy from 70% up to 100%
But the more charges and discharges are pendling inbetween, the lower the effectivness might be.

I havn’t looked inside your code and didn’t try to understand it yet. My thought was: Okay, it seems the calculation is doing something like comparing house consumption vs. battery discharge. So for example if the house needs 150W and the battery delivers 220W (including 70W controller consumption) the value is 100 / 220 * 150 = 68%, while a higher house consumption relatives the controller consumption: 100 / 670 * 600 = 90%. I can go with that method, since this gives a better picture of how efficient the whole system performs after sunset. If I’m looking at the energy-dashboards battery in/out since recording started the battery is like 57% efficient (187,2kWh in, 106,9kWh out). Maybe that’s the truth. Can you check, if the “battery out” energy is fetched from the correct entity? Maybe it is the se’s lying one, which means the discussed 60-70W out aren’t considered.

To your last point:
If you set the inverter into “Control Mode” you are able to turn the storage “Off”. But I won’t mess around with it, until the battery is empty at night the following weeks/months.

Basically I use this formula for the batttery effectiveness:
{{1 - ((((states('sensor.solaredge_b1_dc_power') | float(0)) * -1) - (states('sensor.solaredge_i1_dc_power') | float(0))) / ((states('sensor.solaredge_b1_dc_power') | float(0)) * -1))}}

So I compare the battery output vs the inverter output. All still on the DC side of things, so neglecting the conversion to AC part of it, which is calculated in the Inverter Effectivness with this formula:
{{(states('sensor.solaredge_i1_ac_power') | float(0)) / (states('sensor.solaredge_i1_dc_power') | float(0))}}

Here I compare inverter DC vs inverter AC side, basically calculating the loss because of the conversion.

Where the 60-70W would be visible is something I would need to think about. I actually do not think this can be calculated from the modbus sensors, but I am not sure…have to think about it a bit more.

(weren’t allowed to embed more than one picture)