Skip to content

Commit 81508ee

Browse files
Fix ModbusIOException not iterable error
1 parent bbef1b1 commit 81508ee

File tree

1 file changed

+9
-17
lines changed
  • custom_components/solaredge_modbus_multi

1 file changed

+9
-17
lines changed

custom_components/solaredge_modbus_multi/hub.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,28 +1703,20 @@ async def read_modbus_data(self) -> None:
17031703
)
17041704
self._grid_status = True
17051705

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

17251710
if not self.hub.is_connected:
17261711
await self.hub.connect()
17271712

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

0 commit comments

Comments
 (0)