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

Exceptions since HA 2023.9.0 #158

Closed ndurchx closed 9 months ago

ndurchx commented 10 months ago

Since HA 2023.9.0 I get exceptions:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 591, in state
    numerical_value = float(value)  # type:ignore[arg-type]
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unavailable'
...
ValueError: Sensor sensor.monthly_pv_generation_current has device class 'energy', state class 'total_increasing' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unavailable' (<class 'str'>)

Afterwards I have to reload the yaml to bring the sensor values back. Perhaps this is caused by an unstable lan connection. Would be a solution to check every value for the string "unavailable" before using it as sensor value?

mkaiser commented 10 months ago

yes, you are right.

When the yaml is loaded, some modbus values are still not present. The template sensors should check this before.

mjunker61 commented 10 months ago

The same here, I have no sensors. Is it the same bug, as to update 2023.8.3 ? What is the crew from homeassistant doing ?

mkaiser commented 10 months ago

well its more broken in my code :)

But I don't know yet, why it is triggering now

Louisbertelsmann commented 10 months ago

an "availability" option in the templates could solve it, I can add those if you want. Of course only if you aren't working on the code a lot, so I don't trigger too many conflicts merging.

mkaiser commented 10 months ago

Already coded it..will check in tonight after some testing ;)

mjunker61 commented 10 months ago

Above I forgot to say, that I make a downgrade to core-2023.8.4 and now it works for now.

mkaiser commented 10 months ago

Can you double check, if it is fixed?

I am on 2023.09 and there are no more log entries after "full" restart and none after "yaml reload"

ndurchx commented 10 months ago

The error does not come up again. 2023.09 and 2023.09.01 The sensors do not work like before ha update, but i think it is more a problem of the modbus integration itself: https://github.com/home-assistant/core/issues/99784

HKUser1 commented 10 months ago

Hello Same here no Sensors again since 2323.09.01. If I do a restart it woks for e few seconds or some minutes.... then the Sensors are offline again...

The Solution seems to be this... https://github.com/home-assistant/core/pull/99988/files But i don't know how to do that.....

I have loaded the newest yaml , but the sensors are still unavailable

HKUser1 commented 10 months ago

Anything new about the Modbus Problem since 23.09.0 I can not use my surplus charging :)

mjunker61 commented 10 months ago

Can you double check, if it is fixed?

I am on 2023.09 and there are no more log entries after "full" restart and none after "yaml reload"

The modbus_sungrow.yaml last update: 2023-09-08 (2) doesn't work here.

I made for testing and logging a snapshot from my working ha-vm with ha core-2023-08.4. Than I updated the modbus_sungrow.yaml and after that I updated the ha core. After Update to ha core-2023-09.1 the sensors works for maybe 20 minutes, then sensores are not available. HA works completely a bit slower (not testing, only feeling by clicking ;))

Here is my abstracted Log with ha core-2023-09.1 and Sungrow Hybrid Inverter SH10RT:

auszug-log-nach-core-update-2023-09.1-home-assistant_2023-09-10T18-06-19.729Z.log

After the HA-VM-Rollback to ha core-2023-08.4 all works fine !!!

TheFreaker86 commented 10 months ago

The update 2023-09-08 (2) works well with the SH10RT. The previous version worked as well until something broke. So thank you very much for the quick fix!

storkio commented 10 months ago

Hello , same here since 2323.09.01. modbus_sungrow.yaml update 2023-09-08 (2) doesn't help. After restart or yaml reload it woks for a few minutes and goes offline again.

Update 2023.11.09 - since last reload of yaml - took time (don't know how long - over night :) ), to reload all sensors, but runs stable now

TheFreaker86 commented 10 months ago

I reverted to Home Assistant version 2023.8.4. The more recent HA release doesn't work

HKUser1 commented 10 months ago

i tried two times to resore 2023.08.4 but it doesn t work. What am i doing wrong. HA disappears and only a reboot after 30 min brings HA back with 2023.9.1

mkaiser commented 10 months ago

Who of you is using a modbus proxy?

I am using one and not experiencing all these issues.

Could you maybe try https://github.com/Akulatraxas/ha-modbusproxy/ ?

TheFreaker86 commented 10 months ago

Who of you is using a modbus proxy?

I am using one and not experiencing all these issues.

Could you maybe try https://github.com/Akulatraxas/ha-modbusproxy/ ?

I don't. At least I did not configure one.

ndurchx commented 10 months ago

Who of you is using a modbus proxy?

I am using one and not experiencing all these issues.

Could you maybe try https://github.com/Akulatraxas/ha-modbusproxy/ ?

I changed to using a proxy. Now the connection seems stable. Even though I don't like the idea of another layer between, it is a working temporary fix, until the core integration is fixed.

BrettLynch123 commented 9 months ago

FYI seems to be fixed in HA 2023.9.2 and fixed by this PR https://github.com/home-assistant/core/pull/99988 Havent been able to test properly though. Edit: Seems to be working ok for 1.5 hours ok so far. but data looks weird. Seems to have breaks in the data so maybe not fixed but less bad.

What it should be image

What I'm getting image

HKUser1 commented 9 months ago

with HA 2023.9.2 everything is working fine since this morning.

mkaiser commented 9 months ago

FYI seems to be fixed in HA 2023.9.2 and fixed by this PR home-assistant/core#99988 ~Havent been able to test properly though.~ Edit: Seems to be working ok for 1.5 hours ok so far. but data looks weird. Seems to have breaks in the data so maybe not fixed but less bad.

What it should be image

What I'm getting image

sorry, I cannot derive anything from the plots. What is shown there? (Axis description is missing)

TheFreaker86 commented 9 months ago

works fine with the latest HA release. Thank you very much! 👍