Solaredge Modbus Configuration for Single Inverter and Battery

I think we need the entity names for:
AC Power
Exported kWh
Imported kWh

All from the meter, not the inverter.

With those I should be able to get the formulas correct.

1 Like

@bkj
How did you get the WND-3C-240-MB to show up as a meter device?
I have a similar? meter (WND-3Y-400-MB) but it doesnā€™t show up in Home Assistant.

Andy

Can anyone tell me why canā€™t get the configuration in this thread to work. I donā€™t seem to get any meter information.

This is the Json output I get from the test example.

{
    "c_id": "SunS",
    "c_did": 1,
    "c_length": 65,
    "c_manufacturer": "SolarEdge",
    "c_model": "SE8000H-RW000BEN4",
    "c_version": "0004.0016.0023",
    "c_serialnumber": "xxxxxxxx",
    "c_deviceaddress": 1,
    "c_sunspec_did": 101,
    "c_sunspec_length": 50,
    "current": 1046,
    "l1_current": 1046,
    "l2_current": 0,
    "l3_current": 0,
    "current_scale": -2,
    "l1_voltage": 2480,
    "l2_voltage": 0,
    "l3_voltage": 0,
    "l1n_voltage": 2480,
    "l2n_voltage": 0,
    "l3n_voltage": 0,
    "voltage_scale": -1,
    "power_ac": 25916,
    "power_ac_scale": -1,
    "frequency": 49945,
    "frequency_scale": -3,
    "power_apparent": 25936,
    "power_apparent_scale": -1,
    "power_reactive": 10133,
    "power_reactive_scale": -2,
    "power_factor": 9992,
    "power_factor_scale": -2,
    "energy_total": 35674,
    "energy_total_scale": 0,
    "current_dc": 6332,
    "current_dc_scale": -3,
    "voltage_dc": 4155,
    "voltage_dc_scale": -1,
    "power_dc": 26311,
    "power_dc_scale": -1,
    "temperature": 3667,
    "temperature_scale": -2,
    "status": 4,
    "vendor_status": 0,
    "rrcr_state": 0,
    "active_power_limit": 100,
    "cosphi": 0,
    "commit_power_control_settings": 0,
    "restore_power_control_default_settings": 0,
    "reactive_power_config": 0,
    "reactive_power_response_time": 200,
    "advanced_power_control_enable": 1,
    "export_control_mode": 1024,
    "export_control_limit_mode": 0,
    "export_control_site_limit": 0,
    "meters": {
        "Meter3": {
            "c_manufacturer": "\u0002/\u0001\u0006\u0002",
            "c_model": "\u0001",
            "c_option": "False",
            "c_version": "False",
            "c_serialnumber": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
            "c_deviceaddress": 2400,
            "c_sunspec_did": 0,
            "c_sunspec_length": 8,
            "current": -9824,
            "l1_current": 0,
            "l2_current": 8,
            "l3_current": -9824,
            "current_scale": 0,
            "voltage_ln": 8,
            "l1n_voltage": -9824,
            "l2n_voltage": 0,
            "l3n_voltage": 8,
            "voltage_ll": -9824,
            "l12_voltage": 0,
            "l23_voltage": 0,
            "l31_voltage": 0,
            "voltage_scale": 0,
            "frequency": 0,
            "frequency_scale": 0,
            "power": 0,
            "l1_power": 0,
            "l2_power": 0,
            "l3_power": 0,
            "power_scale": 0,
            "power_apparent": 0,
            "l1_power_apparent": 0,
            "l2_power_apparent": 0,
            "l3_power_apparent": 0,
            "power_apparent_scale": 0,
            "l1_power_reactive": 0,
            "l2_power_reactive": 0,
            "l3_power_reactive": 0,
            "power_reactive_scale": 0,
            "power_factor": 0,
            "l1_power_factor": 0,
            "l2_power_factor": 0,
            "l3_power_factor": 0,
            "power_factor_scale": 0,
            "export_energy_active": 0,
            "l1_export_energy_active": 0,
            "l2_export_energy_active": 0,
            "l3_export_energy_active": 0,
            "import_energy_active": 0,
            "l1_import_energy_active": 0,
            "l2_import_energy_active": 0,
            "l3_import_energy_active": 0,
            "energy_active_scale": 0,
            "export_energy_apparent": 0,
            "l1_export_energy_apparent": 0,
            "l2_export_energy_apparent": 0,
            "l3_export_energy_apparent": 0,
            "import_energy_apparent": 0,
            "l1_import_energy_apparent": 0,
            "l2_import_energy_apparent": 0,
            "l3_import_energy_apparent": 0,
            "energy_apparent_scale": 0,
            "import_energy_reactive_q1": 0,
            "l1_import_energy_reactive_q1": 0,
            "l2_import_energy_reactive_q1": 0,
            "l3_import_energy_reactive_q1": 0,
            "import_energy_reactive_q2": 0,
            "l1_import_energy_reactive_q2": 0,
            "l2_import_energy_reactive_q2": 0,
            "l3_import_energy_reactive_q2": 0,
            "export_energy_reactive_q3": 0,
            "l1_export_energy_reactive_q3": 0,
            "l2_export_energy_reactive_q3": 708,
            "l3_export_energy_reactive_q3": 6946815,
            "export_energy_reactive_q4": 1,
            "l1_export_energy_reactive_q4": 327682,
            "l2_export_energy_reactive_q4": 4294901757,
            "l3_export_energy_reactive_q4": 65536,
            "energy_reactive_scale": 0
        }
    },
    "batteries": {}
}

Seems there is a meter3 but I donā€™t get any information shown in the dashboard. Do I need to do anything to get information from meter 3.

Thanks

Andy

@arcaic

Iā€™m not sure how much help I will be. The meter shows up when I add the IP address of my system. See below screen caps. The biggest thing for me was making sure the slave inverters were numbered correctly. So my master inverter is on IP .84 (yours will probably be different) and my other two inverters were set to slave 2 (inverter #2) and slave 1 (inverter #3). So I needed to change inverter #3 to slave 3. Once I did that everything showed up for me. See this link for more info on setting slaves up. Configuration Ā· WillCodeForCats/solaredge-modbus-multi Wiki Ā· GitHub

after adding my IP and number of inverters
sol1

after clicking on configure
sol2

Show debug from my integration, not other random ones.

@Remko
I think I may have found the issue. My Solar House Consumption shows twice what it should be. Solar Grid To House is showing about the same as my panel production. I donā€™t understand the math/coding but I think it might be in the Sensor ā€œSolar Grid To House Wā€. Any help would be greatly appreciated.

      - 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 %}
        availability: >
          {{ states('sensor.solaredge_m1_ac_power') | is_number }}

Below are the values that I am seeing. the ones with ** are the ones that are showing incorrect values.

sensor.solaredge_m1_ac_power 9k
Solar Selfconsumption Ratio 100
Solar Autarkie Ratio -49
Solar Inverter Effectiveness .9
Solar Panel Production W 10k
Solar Panel To House W 10k - charging a car
**Solar Panel To Grid W 0
**Solar Grid To House W 9K
**Solar House Consumption W 20K
**Solar Imported Power W 9k
**Solar Exported Power W 0

Hello,
@Remko thanks for what you did. Is it possible to refactor the accounting so i can use different tariffs? I have night and day tariffs which are very different.

I think the car charging is an issue. I do not have that anywhere in my configuration and I remember that in my old thread someone also had the issue that the values are way off than. So I am afraid I cannot really help thereā€¦

I am sure that is possible. I do currently not have any day or night rates, so it is not present in my config.

      - name: "Solar Accounting Cost Rate"
        unique_id: solar_accounting_cost_rate
        icon: mdi:cash-plus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.305

      - name: "Solar Accounting Compensation Rate"
        unique_id: solar_accounting_compensation_rate
        icon: mdi:cash-minus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.0864

      - name: "Solar Accounting Total Daily"
        unique_id: solar_accounting_total_daily
        icon: mdi:currency-eur
        unit_of_measurement: "ā‚¬"
        state: >
          {% set cost = (states('sensor.solar_imported_power_daily') | float(0)) * (states('sensor.solar_accounting_cost_rate') | float(0)) %}
          {% set compensation = (states('sensor.solar_exported_power_daily') | float(0)) * (states('sensor.solar_accounting_compensation_rate') | float(0)) %}
          {{ (cost - compensation) | round(2) }}

I guess you would need to create an extra sensor for night tariff and then modify the calculation based on a timeframe.
I havenā€™t done this myself, but I guess you would need to rebuild the templates to include things like this:

{% if now().strftime('%T') < strptime('21:30:00', '%T') %}

EDIT: I think this example also does not solve it. You would actually have to create separate import and export sensors based on time of day. Iā€™ll think about it a bit more and post something if I come up with a solution.

I have searched around a bit and this should do the trick:

      - name: "Solar Accounting Cost Rate Day"
        unique_id: solar_accounting_cost_rate_day
        icon: mdi:cash-plus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.305

      - name: "Solar Accounting Cost Rate Night"
        unique_id: solar_accounting_cost_rate_night
        icon: mdi:cash-plus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.10
          
      - name: "Solar Accounting Compensation Rate"
        unique_id: solar_accounting_compensation_rate
        icon: mdi:cash-minus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.0864

      - name: "Solar Accounting Total Daily"
        unique_id: solar_accounting_total_daily
        icon: mdi:currency-eur
        unit_of_measurement: "ā‚¬"
        state: >
          {% if (now() >= today_at('07:00:00') and now() <= today_at('21:00:00')) %}
            {% set cost = (states('sensor.solar_imported_power_daily') | float(0)) * (states('sensor.solar_accounting_cost_rate_day') | float(0)) %}
          {% else %}
            {% set cost = (states('sensor.solar_imported_power_daily') | float(0)) * (states('sensor.solar_accounting_cost_rate_night') | float(0)) %}
          {% endif %}          
          {% set compensation = (states('sensor.solar_exported_power_daily') | float(0)) * (states('sensor.solar_accounting_compensation_rate') | float(0)) %}
          {{ (cost - compensation) | round(2) }}

I have made the modifications for the daily cost calculation and set the times between 7 am and 9 pm. You have to adjust this based on your situation, as well as the actual rates you have.
If you also have different export rates, you would have to modify that in a similar way as well.

For ā€œweeklyā€, ā€œmonthlyā€ and ā€œyearlyā€, it is a bit more work; for those cases you would have to create separate utility meters for low and high tarif import and export. Or alternatively create another counter adding the daily cost values, but I am not quite sure how that could be accomplished.

Hope this helps.

Thank you very much! Its more than enough. I dont need yearly calculations just how its going now :slight_smile: Actually the real tariff is more complex in my country but i dont need such precision:
Night: between 23:00 and 7:00 during the summer time period (last sunday of march) and from 22:00 to 6:00 during the winter time period (last sunday of october).
And the price difference is huge for the tariffs - 0,066 ā‚¬/kWh day, 0.015 ā‚¬/kWh Night including 20% VAT

OK, I think I have it worked out, or at least got something to get you started:

      - name: "Solar Imported Power W"
        unique_id: solar_imported_power_w
        unit_of_measurement: "W"
        icon: mdi:transmission-tower-export
        state: >
          {% solar_imported_power_day_w + solar_imported_power_night_w %}

      - name: "Solar Imported Power Day W"
        unique_id: solar_imported_power_day_w
        unit_of_measurement: "W"
        icon: mdi:transmission-tower-export
        state: >
          {% set m1_ac_power = states('sensor.solaredge_m1_ac_power') | float(0) %}
          {% if (now() >= today_at('07:00:00') and now() <= today_at('23:00:00')) %}
            {% if (m1_ac_power < 0) %}
              {{ (m1_ac_power * -1) }}
            {% else %}
              0
            {% endif %}
          {% endif %}            
        availability: >
          {{ states('sensor.solaredge_m1_ac_power') | is_number}}

      - name: "Solar Imported Power Night W"
        unique_id: solar_imported_power_night_w
        unit_of_measurement: "W"
        icon: mdi:transmission-tower-export
        state: >
          {% set m1_ac_power = states('sensor.solaredge_m1_ac_power') | float(0) %}
          {% if (now() >= today_at('07:00:00') and now() <= today_at('23:00:00')) %}
          {% else %} 
            {% if (m1_ac_power < 0) %}
              {{ (m1_ac_power * -1) }}
            {% else %}
              0
            {% endif %}
          {% endif %}            
        availability: >
          {{ states('sensor.solaredge_m1_ac_power') | is_number}}
          
      - name: "Solar Accounting Cost Rate Day"
        unique_id: solar_accounting_cost_rate_day
        icon: mdi:cash-plus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.066

      - name: "Solar Accounting Cost Rate Night"
        unique_id: solar_accounting_cost_rate_night
        icon: mdi:cash-plus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.015
          
      - name: "Solar Accounting Compensation Rate"
        unique_id: solar_accounting_compensation_rate
        icon: mdi:cash-minus
        unit_of_measurement: "ā‚¬/kWh"
        state: >
          0.0864

      - name: "Solar Accounting Total Daily"
        unique_id: solar_accounting_total_daily
        icon: mdi:currency-eur
        unit_of_measurement: "ā‚¬"
        state: >
          {% set cost = ((states('sensor.solar_imported_power_day_daily') | float(0)) * (states('sensor.solar_accounting_cost_rate_day') | float(0))) + ((states('sensor.solar_imported_power_night_daily') | float(0)) * (states('sensor.solar_accounting_cost_rate_night'))) %}
          {% set compensation = (states('sensor.solar_exported_power_daily') | float(0)) * (states('sensor.solar_accounting_compensation_rate') | float(0)) %}
          {{ (cost - compensation) | round(2) }}
          
  - platform: integration
    source: sensor.solar_imported_power_day_w
    method: left
    unit_prefix: k
    name: solar_imported_power_day_kwh
    source: sensor.solar_imported_power_night_w
    method: left
    unit_prefix: k
    name: solar_imported_power_night_kwh

utility_meter:    
  solar_imported_power_day_daily:
    source: sensor.solar_imported_power_day_kwh
    name: Solar Imported Power Day Daily
    cycle: daily
  solar_imported_power_night_daily:
    source: sensor.solar_imported_power_night_kwh
    name: Solar Imported Power Night Daily
    cycle: daily

So I modified the cost calculation and the ā€œimported powerā€ and added sensor for daily and nighty calculations. Maybe you can use this as an example to get you started.

2 Likes

@Remko

Iā€™m not sure the car charging matters. The car charging should be no different than using a an electric stove or microwave. The car just uses more power. Here is what SolarEdge web reports after the car is done charging.
notice that ā€œSolar Imported Power Wā€ and ā€œSolar Grid To House Wā€ are positive numbers when the system has been producing ~8.5-9k in excess. It also looks like ā€œSolar House Consumption Wā€ is having ā€œSolar Panel Productionā€ added to it. Unless ā€œSolar House Consumption Wā€ doesnā€™t mean what the house is using. I have put what I believe each sensor is doing in parentheses. Please correct me if I am wrong about the information in the parentheses.

sensor.solaredge_m1_ac_power = 1.2k (power the house is using?)
Solar Panel Production = 10.8k (solar the panels are making)
Solar Panel To House W = 10.6k (should this be 1.2k?)
**Solar Panel To Grid W = 0 (this should be a positive number like ~8k)
**Solar Grid To House W = 1.2k (this should be zero)
**Solar House Consumption W = 11.9k (this should equal 1.2k or equal to sensor.solaredge_m1_ac_power)
**Solar Imported Power W 1.3k (this should be zero)
**Solar Exported Power W 0 (this should be a positive number like ~8k or same as Solar Panel To Grid W)
1
2

I think I see where the main issue is, but cannot explain it properly. But some feedback:

sensor.solaredge_m1_ac_power = 1.2k (power the house is using?)

  • this sensor, in my case, is the meter in the breaker box and gives the values for import and export. In your case the value does not make sense. According to the monitoring portal, you are exporting 9,4k, but the meter only shows 1.2k.
  • This I donā€™t understand. I do think this is the reason for the calculations being wrong, since I use this sensor to do most of the calculations. So if this value is off by that much the rest is wrong as well. So much makes senseā€¦

Solar Panel Production = 10.8k (solar the panels are making)

  • Correct
    Solar Panel To House W = 10.6k (should this be 1.2k?)
  • Here we see the difference of around 8kā€¦
    **Solar Panel To Grid W = 0 (this should be a positive number like ~8k)
  • Again the same difference shows hereā€¦
    **Solar Grid To House W = 1.2k (this should be zero)
  • Correct, it should be zeroā€¦I guess this also caused by this strange offset
    **Solar House Consumption W = 11.9k (this should equal 1.2k or equal to sensor.solaredge_m1_ac_power)
  • Normally this should not be m1_ac_power, since this sensor should give you the import/export values.
    **Solar Imported Power W 1.3k (this should be zero)
  • Correct
    **Solar Exported Power W 0 (this should be a positive number like ~8k or same as Solar Panel To Grid W)
  • Correct

Soā€¦the main question is; why is m1_ac_power wrongā€¦this is a value coming directly from Solaredge, so it must have something to do with how your installation is set up. Maybe you have multiple meters and we are using the ā€œwrongā€ one here or maybe it does have something to do with how the car charger is integrated in the system; normally you would install a car charger on the DC side of the installation and maybe this has an influence on how everything is reported. Butā€¦that is a bit difficult to diagnose for meā€¦

@Remko
sensor.solaredge_m1_ac_power seams to be the same as my power usage but it is a negative number for me. So this afternoon my house is using 1.7k and pushing 4k back into the grid out of 5.5k. and sensor.solaredge_m1_ac_power = -1.7k. When the sun is down, right now my sensor.solaredge_m1_ac_power = -1.7k

Is sensor.solaredge_m1_ac_power a negative or positive number for you? If it is positive maybe something is different with my installation. I just assumed that sensor.solaredge_m1_ac_power was negative because thatā€™s the amount of power the house is using and it will always be negative unless the house is powered off. But again I am just speculating.

As for the car charger, it is no different than any other circuit on my house. It is on a 240v AC breaker. The car charger isnā€™t a solaredge vehicle charger. I know they have one that can use DC but this is a Tesla HPWC that uses AC.

@WillCodeForCats I just did a fresh install of your integration without using energy.yaml and sensor.solaredge_m1_ac_power = a negative number. Is that normal? I assume sensor.solaredge_m1_ac_power_a and sensor.solaredge_m1_ac_power_b are my CT clamps on my electric panel and are added together to equal sensor.solaredge_m1_ac_power. I am in the US on split phase if that matters. I do not use the third CT input. I see that you had someone else with the same problem The power shows with a downside Ā· Discussion #70 Ā· WillCodeForCats/solaredge-modbus-multi Ā· GitHub

Does anyone know how their multiple inverters are set up and connected to their meter?

Mine goes from the meter (WNC-3D-240-200) RS-485 ports to inverter 1 on its RS485-E card port. It does not go to the RS485-1 port.

Inverter 1 then has a 3-wire that daisy chains from it RS485 port to my other two inverters.

2

Maybe this is why I am seeing the negative numbers? Is anyone else running a setup similar to mine with success?

Negative numbers on E+I meters mean import from grid.

An E+I meter will have both negative and positive values depending on PV production and how much is imported or exported.

Hereā€™s a combo graph of PV production and a consumption meter:

The sensor does go positive and negative for me too. Butā€¦for me it is the value I export or import to the grid. I have a 3 phase inverter, so the meter has 3 clamps mounted right at the point where I am connected to the grid. This means that the meter is giving me exactly those values. In your setup that seems different, so I am wondering if you have some other sensor in your setup actually giving you the import and export valuesā€¦
At least we know this is the reason you are seeing wrong values with my configuration, since I use that value to do most calculationsā€¦

I understand the car charger has no impact on this, so that is good. Now we need to understand if we can get the exact import and export values from somewhereā€¦

I was trying diffrent modbus integration but still without positive results for getting data from meter.

All modbus integrations can show only ā€œgeneralā€ inverter data. Nothing can show meter data like import, export etc. I have installed meter and it works fine in official public cloud API integration.

It cannot work via modbud - I donā€™t know why and what I can do. All values are 0 or -0,1 or empty for installed meter from SolarEdge. In case of this integration (multi fork) - the meter is not visible in HA. In case others ā†’ values are like above (0, empty etc.)

I have seen that someone has similar issue in this topic but I donā€™t see any solution.

i have this meter ā†’ SOLAREDGE SE MTR-240-3PC1-D-A-MW

Hey, I also have a solaredge (SE12,5K) with a 3 phase meter.
The cloud api works as expected.
Iā€™m trying to configuring the multi device modbus integration but canā€™t get it communicate with the inverter.
I activated the tcp modbus in the inverter. Itā€™s connected via wifi.
The last firmware is supposed to allow tcp modbus with wifi but Iā€™m not able to make that happen.
Also, itā€™s such a pain in the ass to find the inverter IP when itā€™s connected via wifi. Itā€™s not shown anywhere in the monitoring app and no hostname is configured in the networkā€¦