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

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.

This is working for me and actually I don’t need much more (no batteries here).

When overlaying the realtime data from modbus-tcp against the cloud data they match nicely (but 15 minutes delayed).

I also submitted a PR to fix an issue where people might have inactive optimizers.
My inverter is a SE3000H-RWXXXBNN4

1 Like

I am unable to connect, TCP is enabled in the inverters settings, getting the following errors.

pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.1.131:1502)]
2022-09-21 11:02:53.489 ERROR (MainThread) [pymodbus.client.sync] Connection to (192.168.1.131, 1502) failed: [Errno 111] Connection refused
2022-09-21 11:02:53.491 ERROR (MainThread) [custom_components.solaredge_modbus] Error reading modbus data
Traceback (most recent call last):
  File "/config/custom_components/solaredge_modbus/__init__.py", line 195, in async_refresh_modbus_data
    update_result = self.read_modbus_data()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 246, in read_modbus_data
    self.read_modbus_data_inverter()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 570, in read_modbus_data_inverter
    inverter_data = self.read_holding_registers(unit=self._address, address=40071, count=38)
  File "/config/custom_components/solaredge_modbus/__init__.py", line 233, in read_holding_registers
    return self._client.read_holding_registers(address, count, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 106, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))

Any pointers?

I have updated and changed my configuration, you can find the new setup in a new thread. I will ask the admins to lock this thread. New post can be found here: