home-assistant-solaredge-modbus icon indicating copy to clipboard operation
home-assistant-solaredge-modbus copied to clipboard

Stuck reading M1 data / acenergy OverflowError

Open pewu78 opened this issue 2 years ago • 1 comments

Today I've noticed my data from SolarEdge inverter / M1 meter ceased to update. Looking at the logs I can see it began with some typical connection errors which are intermittent and do not cause any major issues (timed out/[Errno 111] Connection refused) but this time they got followed by :

2022-11-14 17:13:18.323 ERROR (MainThread) [custom_components.solaredge_modbus] Error reading modbus data
Traceback (most recent call last):
  File "/config/custom_components/solaredge_modbus/__init__.py", line 195, in async_refresh_modbus_data
    update_result = self.read_modbus_data()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 246, in read_modbus_data
    self.read_modbus_data_inverter()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 647, in read_modbus_data_inverter
    self.data["acenergy"] = round(acenergy * 0.001, 3)
OverflowError: int too large to convert to float

which also occurred before but did not block further reads and

2022-11-14 17:13:22.648 ERROR (MainThread) [custom_components.solaredge_modbus] Error reading modbus data
Traceback (most recent call last):
  File "/config/custom_components/solaredge_modbus/__init__.py", line 195, in async_refresh_modbus_data
    update_result = self.read_modbus_data()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 247, in read_modbus_data
    and self.read_modbus_data_meter1()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 259, in read_modbus_data_meter1
    return self.read_modbus_data_meter("m1_", 40190)
  File "/config/custom_components/solaredge_modbus/__init__.py", line 414, in read_modbus_data_meter
    exporteda = decoder.decode_32bit_uint()
  File "/usr/local/lib/python3.10/site-packages/pymodbus/payload.py", line 375, in decode_32bit_uint
    handle = self._unpack_words(fstring, handle)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/payload.py", line 325, in _unpack_words
    handle = unpack(up, handle)
struct.error: unpack requires a buffer of 4 bytes

which repeated constantly afterwards (along with the previous one, but less frequently). All metrics did not update since that time until I performed HA restart. I would be good to handle such case more gracefully.

pewu78 avatar Nov 14 '22 19:11 pewu78

File "/config/custom_components/solaredge_modbus/init.py", line 647, in read_modbus_data_inverter self.data["acenergy"] = round(acenergy * 0.001, 3) OverflowError: int too large to convert to float

I Just had the Same Error in my logs recently

It would be helpful, If we could See the actual value of acenergy at the time when the issue happened. At least, that would maybe give sind additional information what exactly the Integration received from the inverter

ChristophCaina avatar Dec 07 '22 00:12 ChristophCaina