Solaredge Modbus Configuration for Single Inverter and Battery

they all give me this:

What does your say here?

Okay when I say copy the entire code for a template sensor, this is what I mean:

      - 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 + 1) > panel_to_grid_w) %}  
            #added 1 to exported power for when exported power = panel to grid# 
             {{ exported_power_w - panel_to_grid_w }} 
           {% else %} 
             0 
           {% endif %}} 

This section of code generates the sensor called sensor.solar_battery_to_grid_w . It’s created using templates so is called a template sensor. If you copy this entire section of code into the editor what does it return?

Here’s mine, which is a good illustration as I’m currently exporting from the battery to the grid

of course… I tried a few ow them and they seem to be correct! :grinning:
I’m on max self consumption so I never export from my battery thereof 0W

So how does your power flow card look now?

the same… :face_with_raised_eyebrow:

Right. Perhaps it’s an availability issue then. If you put this into the template editor, what do you get?

This is the availability template for the sensor.solar_grid_to_house_w
As long as its true that sensor should be available.

The other thing you could do is to have a look at the history of the main sensor.solaredge_xx_xx_xxxx sensors to see what they’re tracking.

true

were do I do that? Thanks again for helping me out!

First entity in the flow card is: grid_to_house_entity: sensor.solar_grid_to_house_w
If I look at the state i see this:

and if I press the info button:

Are any of your sensor.solar_xxx_xxx entities showing a value, or are they all unavailable?

all of them are unavailable. Can I delete them?

I’m wondering if they think they’re still associated with the other energy packages you had running and now that you’ve removed that, these sensors are somehow “confused”.

Two options from here then.

  1. Delete all the unavailable entities and check to see if the power flow card picks them up from anywhere else. If it does, then my theory of duplicate entities would be proven. If it doesn’t, then restart HA and see if it recreates those template sensors and if they are still unavailable.

  2. If you took a backup from before you installed any of the energy dashboard stuff, I’d be inclined to roll back to that backup and start again from scratch. If it was my system I could sit and go through all the code to see where the issue was. That’s obviously not possible from where I’m sitting, so the simplest option might be to go back to a previous backup and start again.

The modbus multi integration is generating all the right entities, so the issue is clearly somewhere in the energy dashboard code from here.

Yes something is problematic with my entities. I will start over.

I had a similar problem; turns out the modbus was set to device ID 2, not 1 even though I only have 1 inverter. Drove me up the wall trying to figure that one out.

1 Like

Hi!
I’ve connected my SE10K RWS to home assistant via modbus tcp, and i’m trying to get the correct power readings. For now i’m using the stock HA Energy dashboard, plus a second power distribution dashboard based on the

card.
By now i’m stuck with the HA energy dashboard.
I’ve connecetd the grid import to the “(M1 IMPORTED KWH)” sensor
The grid export to the “(M1 EXPORTED KWH)” sensor
The solar production to the “Solar Panel Production Daily” sensor
The battery input to the “Solar Battery In Daily” sensor

The problem is on various sensors… For example sensor.solaredge_b1_dc_power in my setup is solaredge_battery1_power.
I think that the difference is that my inverter is three phase.
Another example is “sensor.solaredge_i1_ac_power”, that is “sensor.solaredge_ac_power” . sensor.solaredge_b1_maximum_energy seem to be sensor.solaredge_battery1_size_max, sensor.solaredge_battery1_size_available is sensor.solaredge_b1_state_of_energy… I’m trying to map all of them. Maybe this can be added to the github documentation.

Whoa, sorry, was using the wrong integration, noticed too late. Cleaned a lot of sensors leftovers (tried the solaredge api integration, the modbus and last one the modbus_multi, and had a mess in the sensors list), reinstalled the corrent integration, uploaded the packages folder files as-is, but now, i have a different problem.
The sensor “Solar battery out daily” is missing, as the solar_battery_out_kwh is in state “unavailable”. While the solar_battery_to_house_w seem ok (0w as now the battery isn’t working). I’ve set manually the state of solar_battery_out_kwh to ‘0’ and the Solar battery out daily sensor has become visible, but i not think that it work. I’ve checked the electricity.yaml, and to my eyes the solar_battery_out_kwh seem well defined (but i’m an HA newbie, so maybe i have other problems)

—EDIT—

Another strange thing is that the Solar Panel Production W seem a bit too high. If in the power card i set the “Solar Imported Power W” and “Solar Exported Power W” sensors on the grid block (directly measured by m1 meter) and leave the home consumption calculated by the difference, i gat a bit too high home seft consumption (50/100w more) from what i read from the solaredge app

Hi,
I have the energy dashboard running so far. Only the energy usage and solar production cards show nothing. Can anyone tell me which sensors to select in the energy dashboard under eletricity grid, solar panels and home battery storage.
Thanks Christoph

I run the stock energy dashboard using this sensors:
Grid import: Solaredge M1 Imported kWh
Grid export: Solaredge M1 Exported kWh
Solar panels: Solar Panel Production Daily
Battery input: solar_battery_in_kwh
Battery Output: solar_battery_out_kwh

And seem pretty accurate

Hey folks, I hope you can help me with this one:
Nearly every night, some of my sensors defined by this setup (nothing changed but the prices in the templates-directoy) become unavailable. After a reboot, everything is fine.
Setup: SolarEdge SE8KRWB with StorEdge 9,2kWh Battery connected. I poll the Modbus via Modbus-proxy (as Solaredge only allows one connection at a time and I have a wallbox which also need to poll the Modbus. No problems so far).

Well, it starts with this error:

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.solaredge_modbus_multi
Source: helpers/update_coordinator.py:229
Integration: SolarEdge Modbus Multi (documentation, issues)
First occurred: 9. August 2023 um 23:04:38 (1 occurrences)
Last logged: 9. August 2023 um 23:04:38

Error fetching SolarEdge Coordinator data: Modbus timeout:

which then is followed by

Logger: homeassistant.components.utility_meter.sensor
Source: components/utility_meter/sensor.py:473
Integration: Verbrauchszähler (documentation, issues)
First occurred: 9. August 2023 um 23:05:10 (4 occurrences)
Last logged: 9. August 2023 um 23:05:10


Solar Imported Power Daily Solar Edge received an invalid new state from sensor.solaredge_m1_imported_kwh : unknown
Solar Imported Power Weekly Solar Edge received an invalid new state from sensor.solaredge_m1_imported_kwh : unknown
Solar Imported Power Monthly Solar Edge peak received an invalid new state from sensor.solaredge_m1_imported_kwh : unknown
Solar Imported Power Yearly Solar Edge received an invalid new state from sensor.solaredge_m1_imported_kwh : unknown

So I understand why this error appears (well, no, as I dont know why the polling throws an error), but the next polling is successful again, so I guess the sensors should be available again, but they need a restart of HA.
I do a poll with SE Modbus Multi every 20 seconds. @WillCodeForCats should I file an issue? Hard to track as I do not have more that the logs above and the error appears sporadically…

Modbus timeouts and refused connections are things I don’t really have any control over. It could be network related, it could be the inverter just being weird, or it could be an issue with the pymodbus module, or something else. Of course I use my own integration and so I want it to work as perfectly as possible from my own observations on my own system. I run HAOS in a VM with a 30 second poll time. I don’t do anything special with my primary HA system that does the real work for my home. I installed and update my own integration through HACS just like a regular user would.

Both my HA host and inverter are connected with wired Ethernet. HA host being on wireless is proably file, but wireless connected inverter is not and it’s well documented wireless causes all sorts of problems. Since I don’t use wireless I don’t really have any interest in troubleshooting wireless problems. Maybe someday someone who is able to put work into figuring out if there’s a pymodbus setting or fine tuning some network related setting that makes connections reliable with wireless but that won’t be me.

I get at least one Failed to connect on my system every day and sometimes Modbus timeout. But for me the integration is working I’ve never had to restart or reload anything, the integration is programmed to be able to recover after a few retries however I am not using any proxies and I’m not using any custom templates so I can’t say how those interact. Ideally any custom templates should be aware of and handle unavailable entity states cleanly.

For anyone with multiple inverters I do have PR #378 in progress that better handles a single inverter going offline and recovery. I have this issue personally where my second follower inverter goes offline for a couple minutes every day around 22:00 hours local time. It’s just a thing that inverter does for reasons I’ll never know.

You can try turning on the keep modbus connection open configuration option (Modbus-Verbindung geöffnet lassen) to see if that makes a difference since you are using a proxy. I leave this option off on my system since I need to run multiple instances of my development virtual machines for testing over time and the way I have the integration working I can have multiple copies of HA polling the same inverter.