mkaiser / Sungrow-SHx-Inverter-Modbus-Home-Assistant

Sungrow SH Integration for Home Assistant for SH3K6, SH4K6, SH5K-20, SH5K-V13, SH3K6-30, SH4K6-30, SH5K-30, SH3.RS, SH3.6RS, SH4.0RS, SH5.0RS, SH6.0RS, SH5.0RT, SH6.0RT, SH8.0RT, SH10RT, SH5.0RT-20, SH6.0RT-20, SH8.0RT-20, SH10RT-20, SH5.0RT-V112, SH6.0RT-V112, SH8.0RT-V112, SH10RT-V112, SH5.0RT-V122, SH6.0RT-V122, SH8.0RT-V122, SH10RT-V122, SH4.6R
305 stars 79 forks source link

NO VALUE after Home Assistant >= 2024.04 #274

Closed GolfOWL closed 2 months ago

GolfOWL commented 3 months ago

Before you create an issue, make sure to update to the current version of modbus_sungrow.yaml

Describe the bug:

After installing the new version of HA 2024.04 (yesterday) I miss the following values of the variables in the dashboard:

BATTERY sensor.battery_charge sensor.battery_charge_nominal sensor.daily_battery_charge sensor.daily_battery_discharge

sensor.battery_capacity sensor.battery_state_of_health sensor.daily_battery_charge_from_pv sensor.daily_battery_charge sensor.daily_battery_discharge sensor.total_battery_charge_from_pv sensor.total_battery_discharge sensor.total_battery_charge

ENERGY sensor.daily_pv_generation sensor.daily_consumed_energy sensor.daily_imported_energy sensor.daily_exported_energy sensor.total_consumed_energy

sensor.daily_pv_generation sensor.daily_direct_energy_consumption sensor.daily_exported_energy_from_pv sensor.daily_battery_charge_from_pv sensor.daily_battery_discharge sensor.daily_exported_energy sensor.daily_battery_charge sensor.daily_imported_energy sensor.total_pv_generation sensor.total_direct_energy_consumption sensor.total_exported_energy_from_pv sensor.total_battery_charge_from_pv sensor.total_battery_charge sensor.total_battery_discharge sensor.total_imported_energy sensor.total_exported_energy

Your Sungrow inverter:

Home Assistant version:

modbus_sungrow.yaml:

Inverter Firmware Status:

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior I would like to return to the previous state - the display of the values. :-)

Screenshots If applicable, add screenshots to help explain your problem. Screenshot 2024-04-05 094235

Screenshot 2024-04-05 094330

Additional context Thanks in advance

githublakeware commented 2 months ago

Updated to 2024.4.4 and get this error log:

Logger: homeassistant.components.modbus.modbus
Quelle: components/modbus/modbus.py:318
Integration: Modbus (Dokumentation, Probleme)
Erstmals aufgetreten: 08:21:38 (66 Vorkommnisse)
Zuletzt protokolliert: 09:22:45

Pymodbus: SungrowSH10RT: Error: device: 1 address: 12999 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 13058 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 13099 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 33148 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 13049 -> pymodbus returned isError True

Are these values that are not yet available or that your inverter does not supply? For example, if no battery is connected?

Uschinator commented 2 months ago

It is working now. After setting the Sync Intervall from 10 seconds down to 1 second no more errors and disconnects happened so far. Tried 5 Seconds but then disconnects happening. Seems like my SH10RT_V112 is bored by the long intervall of more than 1 second and is closing the connection.

AlexRitter commented 2 months ago

It is working now. After setting the Sync Intervall from 10 seconds down to 1 second no more errors and disconnects happened so far. Tried 5 Seconds but then disconnects happening. Seems like my SH10RT_V112 is bored by the long intervall of more than 1 second and is closing the connection.

Tried to update the Firmware on the Sungrow Device ? Are you using the internal LAN or the Dongle ?

I had a similar issue last year before i updated the Firmware on Inverter and Dongle...

Uschinator commented 2 months ago

Tried to update the Firmware on the Sungrow Device ? Are you using the internal LAN or the Dongle ?

I had a similar issue last year before i updated the Firmware on Inverter and Dongle...

I am using the internal LAN (modbus). The Firmware was updated last week during the installation. The installer did it.

AlexRitter commented 2 months ago

Tried to update the Firmware on the Sungrow Device ? Are you using the internal LAN or the Dongle ? I had a similar issue last year before i updated the Firmware on Inverter and Dongle...

I am using the internal LAN (modbus). The Firmware was updated last week during the installation. The installer did it.

Has the installer rebootet the entire device ? Sometimes they dont.... (Powering down entiry Power Plant, DC, AC, Battery) ? Just to shure it is not a local issue.

I´m running 2024.4.4 with latest Sungrow.yml and today i had zero issues (I was able to reproduce the issues with 2024.4.1 - 3) I´m using SH6.0RT-V112 - nearly the same device...

Uschinator commented 2 months ago

It is working now. Maybe on the weekend i will try to reboot the device. I would loose the Power to the Backup Circuits during reboot/shutdown so not on a workday.

AlexRitter commented 2 months ago

It is working now. Maybe on the weekend i will try to reboot the device. I would loose the Power to the Backup Circuits during reboot/shutdown so not on a workday.

Makes sense. Think about requesting your own Installer Account at Sungrow. Makes Live much easier for Updates und Troubleshooting ;-)

Uschinator commented 2 months ago

Thanks for the tip. I have already an installer account created. My installer is not that familiar and the setup was mainly done by me on his phone... But the system is not yet finished and therefore i do not mess with it until it is finished and the handover is done.

mastameista commented 2 months ago

I have updated to 2024.4.4 in the early morning today and it works like a charm. I have a SH10RT_V112 inverter and the latest modbus_sungrow.yaml. Also I am on the latest sungrow firmwares. So for me the issue seems to fixed. :)

InFlames82 commented 2 months ago

Updated to 2024.4.4 and get this error log:

Logger: homeassistant.components.modbus.modbus
Quelle: components/modbus/modbus.py:318
Integration: Modbus (Dokumentation, Probleme)
Erstmals aufgetreten: 08:21:38 (66 Vorkommnisse)
Zuletzt protokolliert: 09:22:45

Pymodbus: SungrowSH10RT: Error: device: 1 address: 12999 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 13058 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 13099 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 33148 -> pymodbus returned isError True
Pymodbus: SungrowSH10RT: Error: device: 1 address: 13049 -> pymodbus returned isError True

Are these values that are not yet available or that your inverter does not supply? For example, if no battery is connected?

All of these values are available before 2024.4.

playcom-de commented 2 months ago

I am using a USB2Serial (RS485) adapter to get data from an energy meter, what has worked well for months. After Updating HA-Core from 2024.3.3 to 2024.4.3, I can’t connect my USB2Serial-Adapter. Everything in HA looks fine, as far as I can see, but I get the following error:

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:318
integration: Modbus (documentation, issues)
First occurred: 15:16:56 (2 occurrences)
Last logged: 15:18:57

Pymodbus: EM_Heizung: Error: device: 0 address: 1024 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries
Pymodbus: EM_Heizung: Error: device: 0 address: 1056 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries

I have tried to change from USB0 to USB1, also different baudrates, nothing works.

Even 2024.4.4 did not fix the issue. Going back to 2024.3.3 fixes the issue.

tkahn commented 2 months ago

I'm running Home Assistant on this setup:

Core: 2024.5.1 Supervisor: 2024.04.4 Operating System: 12.2 Frontend: 20240501.0

Inverter: Sungrow SH10RT Connected via: LAN (internal port) modbus_sungrow.yam: 2024-04-05

I have been using this solution for getting data from my inverter for a couple of months now and everything has been working fine. I did have to change the IP in secrets.yaml a couple of times since my router decided to give it a new IP (DHCP) but other than that there have been no issues. Since then I've assigned it a static lease in the router.

A couple of weeks ago it stopped working though and I have spent several days looking over all settings in HA, integrations, router, inverter and network configuration but come up empty handed.

Using QModMaster I can contact the inverter on the IP-address and get data with the standard settings:

IP: 192.168.1.75 TCP port: 502 Slave address: 1

2024-05-05_14-19-16

As you can see I receive packets and there are no errors. I can also ping the inverter on the IP from the terminal in Home Assistant without any problems:

2024-05-06_07-35-08

I found this thread and decided it might be related to the problems I'm experiencing. I'm happy to assist if you want me to check anything in particular. As for now I'm stuck and don't know how to get things up and running again.

Thanks for an awesome integration by the way @mkaiser!

mkaiser commented 2 months ago

the original issue is fixed now, so I will close this thread.

@ tkahn I have no clue at the moment. I would (desperately) try a modbus proxy (see wiki).

Can you try the proxy and when it is not working open a new, separate issue?

playcom-de commented 2 months ago

Not at all! I have just upgraded to version 2024.5.1 and still get the following error message.

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:331
integration: Modbus ([documentation](https://www.home-assistant.io/integrations/modbus), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+modbus%22))
First occurred: 10:57:13 (1 occurrences)
Last logged: 10:57:13
Pymodbus: EM_Heizung: Error: device: 0 address: 1024 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries

Values are now delivered irregularly, but some entities change to "unavailable". I also have the following entry in the logs:


Logger: homeassistant.bootstrap
Source: bootstrap.py:1010
First occurred: 10:59:19 (1 occurrences)
Last logged: 10:59:19
Setup timed out for bootstrap waiting on {<Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>, <Task pending name='call_later 0.1' coro=<ModbusRegisterSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/modbus/sensor.py:113> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>} - moving forward

I think I'll go back to 2024.3.3 for the time being, since modbus is stable.

Gnarfoz commented 2 months ago

Your error message is referring to a heating entity, so it's probably out of scope for this Sungrow project.

That's something best tracked at the home assistant bug tracker.

Actually, even if it was referring to something this project provides, the actual Modbus communication is done by Home Assistant itself. This project is really only a sophisticated configuration file for the Home Assistant Modbus integration.

playcom-de commented 2 months ago

Your error message is referring to a heating entity, so it's probably out of scope for this Sungrow project.

You are right, my bug is not directly related to the Sungrow integration, but I think the problem is the same. The problem are changes to the Modbus integration that have been introduced with version 2024.4.x.

I am referring to an energy meter for a heating device. The energy meter is conected to HA by a USB2Serial (RS485) adapter to get data from the energy meter via modbus. In this respect, my problem has little to do with a heating entity.

My integration is very similar to Sungrow's, but uses rtu and not tcp.

´´´ modbus:

If the problems for the Sungrow integration have been fixed with the latest version, then I'm glad for everyone who uses it. I had thought or hoped that I had the same problem and didn't want to open a separate case. Maybe I'll have to do that now anyway.

Uschinator commented 2 months ago
  • scan_interval: 10

You can try to set the scan_interval to 1 That did the trick for me. No more errors after a restart of HA.

tkahn commented 2 months ago

the original issue is fixed now, so I will close this thread.

@ tkahn I have no clue at the moment. I would (desperately) try a modbus proxy (see wiki).

Can you try the proxy and when it is not working open a new, separate issue?

I solved the problem and it had nothing to do with this integration, which was working fine all along. Made a comment about it and the solution in this issue: https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/issues/291#issuecomment-2101134406

Sorry for the false alarm and thanks again for the work you've put into this integration.