Solaredge Modbus Configuration for Single Inverter and Battery

Sorry for my late reply…I actually forgot about it…

Question…do you have the sensors solaredge_m1_…? So basically…do you have an import/export meter installed? If not…that explains why these values stay 0 and unfortunately…without an import/export meter, my configuration will not work for you. Please see the few posts above this from @Ernie4President …he also does not have the meter, but has a different meter to measure import/export…

Yes, I think I have what you are talking about. I think I just use split phase instead of three phase like you.


Hmm…looks like it is available. Could you post a list of the sensors which the integration gives you? It might be just that the required sensors are named differently.

First two pics are the meter and the third one is inverter 3. let me know if you need the other two inverters.



Solar3

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.