Skip to content

Commit 91b7120

Browse files
Merge pull request #838 from WillCodeForCats/830-improve-timeout-detection-for-grid-onoff-status
Fix ModbusIOException not iterable error
2 parents 275db2c + 4cb2c2c commit 91b7120

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

custom_components/solaredge_modbus_multi/hub.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,28 +1700,20 @@ async def read_modbus_data(self) -> None:
17001700
)
17011701
self._grid_status = True
17021702

1703-
except (ModbusIllegalAddress, ModbusIOException) as e:
1704-
1705-
if (
1706-
type(e) is ModbusIOException
1707-
and "No response recieved after" not in e
1708-
):
1709-
raise
1710-
1711-
try:
1712-
del self.decoded_model["I_Grid_Status"]
1713-
except KeyError:
1714-
pass
1715-
1703+
except ModbusIllegalAddress:
17161704
self._grid_status = False
1717-
1718-
_LOGGER.debug(
1719-
(f"I{self.inverter_unit_id}: Grid On/Off NOT available: {e}")
1720-
)
1705+
_LOGGER.debug((f"I{self.inverter_unit_id}: Grid On/Off NOT available"))
17211706

17221707
if not self.hub.is_connected:
17231708
await self.hub.connect()
17241709

1710+
except ModbusIOException as e:
1711+
_LOGGER.debug(
1712+
f"I{self.inverter_unit_id}: A modbus I/O exception occurred "
1713+
"while reading data for Grid On/Off Status. This entity "
1714+
f"will be unavailable: {e}"
1715+
)
1716+
17251717
except ModbusIOError:
17261718
raise ModbusReadError(
17271719
f"No response from inverter ID {self.inverter_unit_id}"

custom_components/solaredge_modbus_multi/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"issue_tracker": "https://github.com/WillCodeForCats/solaredge-modbus-multi/issues",
1111
"loggers": ["custom_components.solaredge_modbus_multi"],
1212
"requirements": ["pymodbus>=3.8.3"],
13-
"version": "3.1.3"
13+
"version": "3.1.4-pre.1"
1414
}

0 commit comments

Comments
 (0)