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

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)

To elaborate the sensors come from the modbus integration
sensor.solaredge_b1_dc_power: this is the power (DC) being outputted by the battery
sensor.solaredge_i1_dc_power: this is the power (DC) being outputted by the inverter

So a simple calculation: 1 - (battery power - inverter power / battery power) gives me the percentage of the power being lost there. The same kind of thing is what I do with the inverter, the only difference is I compare DC power vs AC power, so…what is lost in conversion.

To your battery…yes, this is what I see as well. The sensor which I use (battery output) is not used directly by the solaredge portal. Solaredge wisely chooses to ignore this and only report what is actually consumed by the house so ignoring all the losses in between. So tha fact that you charge more as you use is made visible with my configuration, whereas Solaredge chooses to not show this to their customers. Which I fully understand because 95 % of them would never get it and would start asking difficult questions…:wink:

Did a bit of research,
I‘m not familiar with the effectiveness sensors yet, but found the reason why „Solar Battery Out“ is that low (too low) at the energy dashboard:

You multiplied sensor.solaredge_battery1_power with the i+b effectivenesses. Maybe for the tesla style card?

    - 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 %} 

At the sensor section that sensor is used further:

  - platform: integration
    source: sensor.solar_battery_to_house_w
    method: left
    unit_prefix: k
    name: solar_battery_out_kwh 

and following on the ulility meter „Solar Battery Out“. That means, for my understanding, the utility meter has the doubled impact of the multiplied effectivenesses. sensor.solaredge_battery1_power should give the effectiveness of the metered readings between „Solar Battery In“ and „Solar Battery Out“ by itself.

Maybe you could read the battery effectiveness every midnight by 1-(„Solar Battery Out“/„Solar Battery In“…) after fixing it?

What do you think about?

The Inverter Consumption only shows up when there is no Solar Power. Then the Inverter DC Power drops below 0 and stays at about -70 Watts till Solar power kicks back in around sunrise. (Only if you draw power from the battery of course. Otherwise the Inverter shuts off.)

1 Like

For everyone who has a 2 Inverter 1 Battery setup: I modified the »energy.yaml« to fit those needs.

First of all you’ll need to use the SolarEdge Modbus Multi Device Integration: https://github.com/WillCodeForCats/solaredge-modbus-multi

Make sure it’s set up correctly. I had to fix the Modbus ID on the secondary inverter!

And that’s the corresponding »energy.yaml«

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_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0)) < 100 or (states('sensor.solaredge_i1_ac_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0)) < 100) %}
          {{ (states('sensor.solar_inverter_effectiveness')) }}
        {% else %}
          {% if (is_state('sensor.solar_inverter_effectiveness', 'unknown')) %}
            1
          {% elif (states('sensor.solaredge_i1_ac_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0) <= 0) %}
            {{ (states('sensor.solar_inverter_effectiveness')) }}
          {% elif (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) <= 0) %}
            {{ (states('sensor.solar_inverter_effectiveness')) }}
          {% else %}
            {{ (states('sensor.solaredge_i1_ac_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0)) / (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_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_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) + states('sensor.solaredge_b1_dc_power') | float(0) <= 0) %}
          {% if (states('sensor.solaredge_b1_dc_power') | float(0) >= 0) %}
            {{ (states('sensor.solar_battery_effectiveness')) }}
          {% elif (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) <= 0) %}
            {{ (states('sensor.solar_battery_effectiveness')) }}
          {% else %}
            {{ (1 - (((states('sensor.solaredge_b1_dc_power') | float(0)) * -1 - (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0))) / (states('sensor.solaredge_b1_dc_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_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) + states('sensor.solaredge_b1_dc_power') | float(0) <= 0) %}
          0
        {% elif (is_state('sensor.solaredge_i1_dc_power', 'unknown') or is_state('sensor.solaredge_i2_dc_power', 'unknown') or is_state('sensor.solaredge_b1_dc_power', 'unknown')) %}
          0
        {% else %}
          {{ (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) + states('sensor.solaredge_b1_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_b1_dc_power') | float(0) >= 0 and states('sensor.solaredge_m1_ac_power') | float(0) > 0) %}
          {% if (states('sensor.solaredge_i1_dc_power') | float(0) < 0 and states('sensor.solaredge_i1_ac_power') | float(0) <= 0) %}
            {{ (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0) - states('sensor.solaredge_m1_ac_power') | float(0)) }}
          {% else %}
            {{ (states('sensor.solaredge_i1_ac_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0) - states('sensor.solaredge_m1_ac_power') | float(0)) }}
          {% endif %}
        {% elif (states('sensor.solaredge_b1_dc_power') | float(0) >= 0 and states('sensor.solaredge_m1_ac_power') | float(0) < 0) %}
          {{ (states('sensor.solaredge_i1_ac_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0)) }}
        {% elif (states('sensor.solaredge_b1_dc_power') | float(0) < 0) %}
          {% if (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) + states('sensor.solaredge_b1_dc_power') | float(0) < 0) %}
            0
          {% else %}
            {{ ((states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) + states('sensor.solaredge_b1_dc_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_b1_dc_power') | float(0) < 0) %}
          {{ (states('sensor.solaredge_b1_dc_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_b1_dc_power') | float(0) > 0) %}
          {% if (states('sensor.solar_grid_to_battery_w') | float(0) > 0) %}
            0
          {% else %}
            {{ (states('sensor.solaredge_b1_dc_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_b1_dc_power') | float(0) > 0) %}
          {{ (states('sensor.solaredge_b1_dc_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

In this setup you also have to change the configuration of the »Tesla style solar power card«

battery_extra_entity: sensor.solaredge_b1_state_of_energy

–––

UPDATE: I ran into an issue while the battery is charging! When battery charging power exceeds what the hybrid inverter delivers (which may occur since also the secondary inverter power is used for battery charging) i1_ac_power stays 0 while i1_dc_power may drop significantly below 0. Therefore I had to modify the solar_panel_to_house_w value while battery is charging and i1_dc_power is blow 0.

Here is the section I modified which I also integrated in the code you find above.

    - 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_b1_dc_power') | float(0) >= 0 and states('sensor.solaredge_m1_ac_power') | float(0) > 0) %}
          {% if (states('sensor.solaredge_i1_dc_power') | float(0) < 0 and states('sensor.solaredge_i1_ac_power') | float(0) <= 0) %}
            {{ (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0) - states('sensor.solaredge_m1_ac_power') | float(0)) }}
          {% else %}
            {{ (states('sensor.solaredge_i1_ac_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0) - states('sensor.solaredge_m1_ac_power') | float(0)) }}
          {% endif %}
        {% elif (states('sensor.solaredge_b1_dc_power') | float(0) >= 0 and states('sensor.solaredge_m1_ac_power') | float(0) < 0) %}
          {{ (states('sensor.solaredge_i1_ac_power') | float(0) + states('sensor.solaredge_i2_ac_power') | float(0)) }}
        {% elif (states('sensor.solaredge_b1_dc_power') | float(0) < 0) %}
          {% if (states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) + states('sensor.solaredge_b1_dc_power') | float(0) < 0) %}
            0
          {% else %}
            {{ ((states('sensor.solaredge_i1_dc_power') | float(0) + states('sensor.solaredge_i2_dc_power') | float(0) + states('sensor.solaredge_b1_dc_power') | float(0)) * states('sensor.solar_inverter_effectiveness') | float(0)) }}
          {% endif %}   
        {% else %}
          0
        {% endif %}

This feels ‘a bit dirty’, so maybe someone of you has a better solution in this 2 inverter scenario?

1 Like

Hey @Remko,

I appreciate your great work and thanks for sharing!

Watching my new Solar-Card at night showed a little inconsistency: All exported energy is condensed to »Solar Panel To Grid W«, although Energy at night is exported by the battery. Slight energy imports and exports result from the inertia of the battery management system, that won’t adapt to quick changes in energy consumption fast enough.

Maybe this should be devided into »Solar Panel to Grid W« and »Solar Battery to Grid W«? What do you think?

Have a great day!
Björn

Exporting energy from your battery?? That is a use case I have not considered in my configuration. I never export any energy from my battery to my grid.

I would need to understand that better and it actually may be quite a puzzle of doing that. Maybe you can add some screenshots with what you are seeing and what you expect to see…

As you can See in the screenshot, Panel Production is 0, but due to your Panel to Grid calculation Panel to Grid shows 16W.
I agree that battery to grid is an »unwanted« state, but it occurs ever so slightly due to battery management inertia. So for example when you use your toaster or oven, there is an instant need for 1 or 2 kW or so. Battery management adapts to that need, but for a few seconds you will draw energy from the grid. The other way around: When your toast is done, the toaster shuts off and there is an instant excess of the no more needed energy. And until the battery management adopts to the changed need for energy, that excess-energy will be exported to the grid. So there is your battery to grid situation that occurs all the time – at least seen with short polling intervals.

What I would expect to see: an energy flow from the battery to the grid… or from the house to the grid, since it’s excess power not consumed by the household.

Your graph looks strange to me. Have you configured all the options for that? For me it always shows all the lines between the different entities, also a Grid to Batery (which can be negative of course).

But…to the actual problem. I understand what you are saying and I agree that it is not flawless. I do see these small effects too, but have chosen to ignore them. The reason is that these fluctuations are very small and in my mind do not have a big impact on the overall situation.
The other issue we are seeing I guess, is the delay in reporting through the modbus. I have my polling interval set to 3 seconds, but the fluctuations can occur in a much shorter timeframe of course. The only way to visualise it 100% correct is if we would have instant values. The question here…what is instant?
I also agree with the battery management inertia…I do see some of those effects too, but honestly do not know how to get it more accurate without using actual instant values, which I think are not available or…if they were available…they would probably overload HASS with data.

I am not saying my configuration is 100% correct, but I also do not know how to improve this further. I think the calculations which are done in the template sensors are correct, but due to the inertia and minor fluctuations I do not know what else I can do. If anyone else sees these effects and has ideas to optimise this further…please contribute here…

Hi

I also export from battery to the grid as I am on 30 minute market rates (soon to be 5 minutes) with my electricity supplier (Amber Australia) so when there are large fluctuations in the import/export prices my system can make quite a bit of money. :partying_face: The stats do go a bit haywire when charging/discharging from/to the grid.
The below is when the system is set to maximum self-consumption so is normal
image
image

And then when maximise export is set with no change to house load
image
image

The house is actually only consuming 2.5kw, not 5kw
Solar is actually producing 2.9kw, not 5kw so it looks like the battery adds to the solar output and the battery inverted to ac adds to the house consumption which is not correct.

Conversely when the battery charges from the grid
image
image
House Consumption Feeds to Solar Panels (via negative value on solar to house) which then feeds to battery

Is there a way to fix this so the stats read correctly or are there not enough clamps to differentiate the inputs and outputs when the battery is discharging/charging to/from the grid?

P.S I appreciate your effort in this dashboard setup as it looks fantastic and works very well! :slight_smile: