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

Hey @spry-salt . I can confirm that (with a recently installed Australian SolarEdge SE8250H inverter) I have managed to get Modbus over TCP working on Wifi - it was running the latest firmware 4.16.19 which SolarEdge installed during some troubleshooting and it worked perfectly. However, that inverter had other issues and had to be swapped out under warranty. Now I have a replacement running on the older firmware 4.15.119 and it has stopped sending the Modbus data. I have a ticket in with SolarEdge to get the new August 2022 firmware installed and hopefully that will fix it once more. Iā€™ll report back.

1 Like

ah dang sorry I just saw this. Do you have an installer account on solaredge or something? I donā€™t have that level of detail anywhere in the interface from what I can tell.

Iā€™ve gone back and forth with solaredge support a couple times at this point, but they are very slow to respond. I sent them a wireshark pcap a couple weeks ago where I was just manually reading registers using this command-line tool. They sent me this link: https://solared.ge/modbus-tcp which includes a broken link to the ā€œPower Control Protocol Application Noteā€ that everyone has been using to implement the battery registers in their various libraries. The one everyone has been using is from 2017, so itā€™s possible thereā€™s a new version that has the correct registers in it.

Honestly I might write a script that just loops through addresses and sees if there are some registers somewhere that arenā€™t documented.

If you have any luck with solaredge support or any of this, please let me knowā€¦ Iā€™ll try to keep a closer eye on this, I figured Iā€™d get an email if someone replied but I guess not.

1 Like

try this repo in hacs:

2 Likes

I tried your fix, but I still get the 0 a lot.
I will look into it

Thanks. How did you convince them to update your firmware? Iā€™ve asked my installer but I donā€™t know whether theyā€™ll be willing to do it.

Let us know how you get on, Iā€™ve not seen any zeros on house consumption since and am keen to make this family proof without them questioning the accuracy!

I havenā€™t yet :slight_smile: I have a ticket open with SolarEdge directly asking for it to be done. They havenā€™t said they wonā€™t do it so Iā€™m hopeful. Theyā€™re inundated with tickets though and it has to be escalated to a senior engineer. Iā€™ll chase them tomorrow if I donā€™t hear anything today.

That looks interesting. Iā€™d love to get panel-level data into HA. I tried it but had an ā€œInvalid authenticationā€ error. I wonder whether thatā€™s because I have a regular genesis SE8250H and not the Energy Hub version (or the Genesis Enhancement Pack) which adds the panel level monitoring)?

No replies - is there a trick (or hardware) I need to get the M1 data showing up? Without that info, none of the great graphs in this post are working. Thanks.

Seems I did the same thing and am in the same boat. M1 data doesnā€™t appear. Not clear what the solution is. Ethernet should be all we need. Some portion of this is obviously working because we get a bunch of other values over it just not the M1.

I do not know the physical layout but did you try m2 or m3. No idea if thats something the installer could have done, just thinking out loud.

Hi everybody,
I do have a question. Itā€™s not directly for the Homeassistent communication but here are the experts :wink:
I checked my consumption from grid accord to solaredge and from my local energy meter. Solaredge says 25 kWh and my energy meter (evu) 45 kWh over 2
1/2 month .
Is this difference normal or do I have to check the measurement?
Thank you for your help.

Does anyone know a way to get remote control of the battery for a setapp Solaredge inverter? Reading through forums and manuals for hours and the only options I can see are MSC (Self Consumption) and ToU (time of use).

I would love to be able to control the battery through HA to charge from the grid overnight on cheap rates but only somedays where PV production wont fill the battery.

Running a SE4000H inverter, SE Energy Bank 10kW, SE optimizers and Trina panels if that makes any difference.

Yeah, Iā€™ve tried 1,2,3 with nothing showing for the latter.
I have setapp access so I can mess with things if I need to.
All I see are two RS485 connections set to SolarEdge forwarder and then the enabling of ModBus over TCP/IP which is enabled.
I guess the issue is related to where M1 comes from.
I didnā€™t think something else was required other than ā€œModBus over TCPā€ ?

Does anybody knows if the Solaredge inverter (SE6000h or another one) could work witout optimizers?
I m thinking to install PV, but my installer propose me a Solaredge Inverter wihtout Optimizers (no SMA, Fronius, Huawei inverter available).

Hey @Remko,
had some time to redo my calculations. The Ā»strange lookĀ« is just due to some extra configurations like

hide_inactive_lines: 1
show_gap: true

explained in the repository of the Tesla style solar power card : GitHub - reptilex/tesla-style-solar-power-card: Home assistant power card mimicking the one tesla provides for the powerwall app.
I also changed the icons and so on.

UPDATE:

So here is my new energy.yaml for the 2 inverter situation. I work with local variables to have a better understanding of the calculations, wich appear much cleaner this was:

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 i2_dc_power = states('sensor.solaredge_i2_dc_power') | float(0) %}
          {% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
          {% set i2_ac_power = states('sensor.solaredge_i2_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 + i2_dc_power < 100 or i1_ac_power + i2_ac_power < 100) %}
            {{ inverter_effectiveness }}
          {% else %}
            {{ (i1_ac_power + i2_ac_power) / (i1_dc_power + i2_dc_power) }}
          {% endif %}

      - 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 i2_dc_power = states('sensor.solaredge_i2_dc_power') | float(0) %}
          {% set b1_dc_power = states('sensor.solaredge_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)) %}
            1
          {% elif (i1_dc_power + i2_dc_power + b1_dc_power <= 0) %}
            {% if (b1_dc_power >= 0 or i1_dc_power + i2_dc_power <= 0) %}
              {{ battery_effectiveness }}
            {% else %}
              {{ (1 - ((b1_dc_power * -1 - (i1_dc_power + i2_dc_power)) / b1_dc_power * -1)) }}
            {% endif %} 
          {% else %}
            {{ battery_effectiveness }}
          {% endif %}

      - 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 i2_dc_power = states('sensor.solaredge_i2_dc_power') | float(0) %}
          {% set b1_dc_power = states('sensor.solaredge_b1_dc_power') | float(0) %}

          {% if (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
          {% elif (i1_dc_power + i2_dc_power + b1_dc_power <= 0) %}
            0
          {% else %}
            {{ (i1_dc_power + i2_dc_power + b1_dc_power) }}
          {% endif %}

      - 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 i2_dc_power = states('sensor.solaredge_i2_dc_power') | float(0) %}
          {% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
          {% set i2_ac_power = states('sensor.solaredge_i2_ac_power') | float(0) %}
          {% set b1_dc_power = states('sensor.solaredge_b1_dc_power') | float(0) %}
          {% set m1_ac_power = states('sensor.solaredge_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 + i2_ac_power - m1_ac_power) }}
            {% else %}
              {{ (i1_ac_power + i2_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) %}
              {{ (i1_dc_power + i2_ac_power) }}
            {% else %}
              {{ (i1_ac_power + i2_ac_power) }}
            {% endif %}
          {% elif (b1_dc_power < 0) %}
            {% if (i1_dc_power + i2_dc_power + b1_dc_power < 0) %}
              0
            {% else %}
              {{ ((i1_dc_power + i2_dc_power + b1_dc_power) * inverter_effectiveness) }}
            {% endif %}   
          {% 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: >
          {% set b1_dc_power = states('sensor.solaredge_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) %}
              0
            {% else %}
              {{ b1_dc_power }}
            {% endif %} 
          {% 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: >
          {% 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_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 %}

      - 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_m1_ac_power') | float(0) %}

          {% if (m1_ac_power <= 0) %}
            {{ (m1_ac_power * -1) }}
          {% 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: >
          {% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
          {% set i2_ac_power = states('sensor.solaredge_i2_ac_power') | float(0) %}
          {% set b1_dc_power = states('sensor.solaredge_b1_dc_power') | float(0) %}

          {% if (i1_ac_power <= 0 and i2_ac_power <= 0 and b1_dc_power > 0) %}
            {{ b1_dc_power }}
          {% else %}
            0
          {% endif %}

      - 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_m1_ac_power') | float(0) %}

          {% if (m1_ac_power < 0) %}
            {{ (m1_ac_power * -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: >
          {% set m1_ac_power = states('sensor.solaredge_m1_ac_power') | float(0) %}

          {% if (m1_ac_power > 0) %}
            {{ (m1_ac_power) }}
          {% else %}
            0
          {% endif %}

      - 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_ac_energy_kwh') | float(0) %}

          {{ ((ac_energy_kwh / 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

I tweaked the Ā»solar_panel_to_grid_wĀ« sensor and added a Ā»solar_battery_to_grid_wĀ« sensor as well. So now all occurring energy flows are covered:

And for the sake of completeness here is what my tesla-style-solar-power-card configuration looks like:

- type: custom:tesla-style-solar-power-card
  name: Home Energy Flow
  # 7 flows between bubbles
  grid_to_house_entity: sensor.solar_grid_to_house_w
  grid_to_battery_entity: sensor.solar_grid_to_battery_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
  battery_to_grid_entity: sensor.solar_battery_to_grid_w
  # extra values to show as text above icons
  battery_extra_entity: sensor.solaredge_b1_state_of_energy
  house_extra_entity: sensor.aussentemperatur
  generation_extra_entity: sensor.cloud_coverage_guetersloh
  # grid_extra_entity: sensor.solar_exported_power_daily
  # optional appliances with consumption and extra values
  # appliance1_consumption_entity: sensor.car_consumption
  # appliance1_extra_entity: sensor.car_battery_state_of_charge
  # appliance2_consumption_entity: sensor.heating_consumption
  # appliance2_extra_entity: sensor.heating_operation
  # optional 4 main bubble icons for clickable entities
  # grid_entity: sensor.grid_consumption
  # house_entity: sensor.house_consumption
  # generation_entity: sensor.solar_yield
  # battery_entity: sensor.battery_consumption
  show_gap: true
  hide_inactive_lines: 1
  threshold_in_k: 1
  grid_icon: mdi:transmission-tower
  generation_icon: mdi:solar-power-variant-outline
  house_icon: mdi:home-lightning-bolt-outline
  battery_icon: mdi:battery-high

I hope some of you can use this!

1 Like

SolarEdge kindly remotely updated the firmware on my inverter and modbus is now working over wifi.

Iā€™m the author of solaredge-modbus-multi so if youā€™re having problems with it that are something I can improve on, please let me know.

3 Likes

Thanks. We already had some contact where your fixed an issue with the additional meter showing up. I now have it all running for a while without any issues. Just still need to post there new configs for that. Still got some minor modifications to implement, but no issues so far!

1 Like

Oh yes, the changing meter ID thing. I remember now, didnā€™t make the connection right away.