WillCodeForCats / solaredge-modbus-multi

Home Assistant integration for SolarEdge inverters with Modbus/TCP. For single or multiple inverters, meters, and batteries.
Apache License 2.0
161 stars 16 forks source link

Battery export sensor incorrect #581

Closed jongbj1972 closed 2 months ago

jongbj1972 commented 3 months ago

Describe the bug

The battery export sensor indicates a battery discharge of only 3kWh/day while reality is approx. 12kWh/day

Expected behavior

correct data being read from the battery export sensor

Screenshots

320950105-25dd3bba-2f3f-4bff-8c60-e3ac552512e9 320950360-f461eb58-d148-4acb-93fa-920a5e45ea7c 320950603-17f70e14-72f5-4bd5-9e81-7217775654bd

Diagnostic File

config_entry-solaredge_modbus_multi-a150630511e990a73146f8eb62c16c53 (1).json

Debug logs

20 minute debug log was almost 4 million characters and messed up the form.

Home Assistant Version

2024.4.1

solaredge-modbus-multi Version

latest

Installation Type

HAOS

Read the Instructions

Additional Context

Up until recently, the battery export sensor functioned fine, although, due to a database change, I cannot dettermine when it started to go wrong, but it is clearly visible that the data is not correct.

WillCodeForCats commented 3 months ago

If you look in the debug file look for the battery_id_1 section towards the bottom.

The sensor values for battery energy are:

        "B_Export_Energy_WH": "0x40806d",
        "B_Import_Energy_WH": "0x409e8b",

These are hex integer values, so a value of 0x40806d is 4227181 watt-hours, or 4227.181 kilowatt-hours

The integration does not interpret these values, they are passed through as given by the inverter. You would need to either download diagnostic files or watch debug logs to check if that value is increasing or not.

The data in the SolarEdge online platform is separate from modbus.

jongbj1972 commented 3 months ago

So if I understand you correctly, the integration reads the values as presented by the inverter and only converts the HEX to numerical value. Then I appologize for sending in the bug report and will try to solve on the inverter side.

WillCodeForCats commented 3 months ago

Yes, that's correct. The value is displayed.

It checks other conditions but if it's showing a value that's the value it's getting from modbus. You can check the diagnostic files to see if the hex value is changing or not.

deqw commented 3 months ago

Concerning these two sensors (sensor.solaredge_b1_energy_import and sensor.solaredge_b1_energy_export) I see them unavailable (state = 'unknown') frequently. Reloading the integration kicks them again. Screenshot 2024-04-19 at 09 53 03

Edit: I checked the debug file. The file is showing correct data while the integration says Unknown. Then do a reload of the integration and the correct decimal data is showing.

Screenshots showing in the order they were made. Before: Screenshot 2024-04-20 at 10 36 10 Screenshot 2024-04-20 at 10 36 26

After reloading the integration: Screenshot 2024-04-20 at 10 37 28 Screenshot 2024-04-20 at 10 38 48

richardambridge commented 3 months ago

Did you find a solution for this? I see the same

image

I'm running off battery overnight, and the B1 Energy export level is not changing overnight

jongbj1972 commented 3 months ago

No, according to the developer it is not the integration, so no, there is no solution. I doubt it is the SolarEdge software as the web-application shows the correct information.

WillCodeForCats commented 2 months ago

Download diagnostic files or check debug logs to see if the value of B_Export_Energy_WH or B_Import_Energy_WH is changing.

MikeTango commented 2 months ago

Hi,

i am having the same issue and will monitor the logfiles after it freezes, then reload and check the logfiles again Next chance to do that is tonight at 2200ish local which is the usual time it kicks out. .

richardambridge commented 2 months ago

With debug on, the values are not changing overnight, but I see the data in the solaredge app is changing.

2024-04-21 04:00:47.479 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:01:02.329 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:01:17.428 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:01:32.341 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:01:47.365 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:02:02.363 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:02:17.402 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:02:32.371 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:02:47.339 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:03:02.491 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:03:17.446 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:03:32.369 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:03:47.416 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:04:02.290 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:04:17.387 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:04:32.411 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:04:47.391 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:05:02.461 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:05:17.399 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:05:32.420 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:05:47.374 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:06:02.391 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:06:17.387 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:06:32.360 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:06:47.388 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:07:02.390 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:07:17.406 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:07:32.359 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:07:47.405 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:08:02.512 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:08:17.315 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:08:32.362 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:08:47.376 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:09:02.359 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:09:17.411 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:09:32.528 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:09:47.356 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:10:02.540 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:10:17.367 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:10:32.340 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:10:47.418 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'> 2024-04-21 04:11:02.361 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0x14eaf0 <class 'int'>

image

although their website is showing 0W export for the time, but it does show battery dischange.

image

richardambridge commented 2 months ago

04.log

here is all the data for 04:xx hour: grep custom_components.solaredge_modbus_multi.hub home-assistant.log |grep " 04:..:.." > /tmp/04.log

MikeTango commented 2 months ago

Step 1: Screenshot, state unknown since yesterday 2200ish Screenshot 2024-04-21 at 11-33-21 Verlauf – Home Assistant

Step 2: Activate logging Step 3: Reset Integration Step 4: Screenshot, state OK Screenshot 2024-04-21 at 11-35-27 Übersicht – Home Assistant

Step 5: Download log Step 6: Deactivate logging

The first lines in the log :

2024-04-20 22:24:14.794 WARNING (MainThread) [pymodbus.logging] Failed to connect 2024-04-20 22:24:18.599 WARNING (MainThread) [pymodbus.logging] Failed to connect 2024-04-20 22:24:24.002 WARNING (MainThread) [pymodbus.logging] Failed to connect 2024-04-20 22:24:34.205 WARNING (MainThread) [pymodbus.logging] Failed to connect

Correspond well with the battery sensor death, although i don't know whether they are zulu time or local (+2). I might have screwed up the logging/resetting process since the log shows nothing about the integration restarting. It also starts timestamping after my screenshot. Do i need to download the log before restarting?

home-assistant_solaredge_modbus_multi_2024-04-21T09-35-53.544Z.log

024-04-21 11:33:46.248 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Export_Energy_WH 0xa6b <class 'int'> 2024-04-21 11:33:46.248 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Import_Energy_WH 0xe72 <class 'int'>

WillCodeForCats commented 2 months ago

So first off, all I'm really doing here is proving this is not a bug in the integration: the integration just takes values the inverter gives, does some validation and checks for obviously wrong or invalid states that would mess up graphs/statistics, and passes them into Home Assistant.

The SolarEdge app and monitoring platform is completely separate from modbus. If one of those works and the other doesn't, that's a bug in the inverter firmware that SolarEdge would need to fix. This integration can only use the data the inverter gives it over modbus. If the inverter keeps returning the same data every time it asks without increasing the values, that's an inverter bug and unfortunately there's nothing I can do about it except show you how it's not my problem to fix.

You could try power cycling your entire system to cold boot it (turn off all AC and DC safety switches) to see if that re-syncs everything. That's been reported as a solution in the past and is mentioned in known issues.

Battery energy sensors going unavailable can be several things which are already documented in known issues:

https://github.com/WillCodeForCats/solaredge-modbus-multi/wiki/Known-Issues

If you have battery energy going unavailable you probably have the "backwards" data issue and need to turn on some of the options that are designed to allow that. Home Assistant expects that energy meters should not go backwards, so if they do the sensors will go into unavailable state.

MikeTango commented 2 months ago

hi,i am running an original SolarEdge battery so it seems to be either something different or they have this problem with their own batteries now.

WillCodeForCats commented 2 months ago

Correspond well with the battery sensor death, although i don't know whether they are zulu time or local (+2). I might have screwed up the logging/resetting process since the log shows nothing about the integration restarting. It also starts timestamping after my screenshot. Do i need to download the log before restarting?

Yes because logs are cleared when Home Assistant restarts.

MikeTango commented 2 months ago

I restarted the integration only, there was no new boot info in the log.

WillCodeForCats commented 2 months ago

I'm not really seeing anything here that suggests a problem with the integration.

I don't have batteries on my system, so I can't give any advice on them.