@@ -1343,6 +1343,10 @@ async def read_modbus_data(self) -> None:
1343
1343
f"No response from inverter ID { self .inverter_unit_id } "
1344
1344
)
1345
1345
1346
+ finally :
1347
+ if not self .hub .is_connected :
1348
+ await self .hub .connect ()
1349
+
1346
1350
""" Advanced Power Control """
1347
1351
""" Power Control Block """
1348
1352
if self .hub .option_detect_extras is True and (
@@ -1585,6 +1589,10 @@ async def read_modbus_data(self) -> None:
1585
1589
f"No response from inverter ID { self .inverter_unit_id } "
1586
1590
)
1587
1591
1592
+ finally :
1593
+ if not self .hub .is_connected :
1594
+ await self .hub .connect ()
1595
+
1588
1596
""" Power Control Options: Site Limit Control """
1589
1597
if (
1590
1598
self .hub .option_site_limit_control is True
@@ -1701,9 +1709,6 @@ async def read_modbus_data(self) -> None:
1701
1709
self ._grid_status = False
1702
1710
_LOGGER .debug ((f"I{ self .inverter_unit_id } : Grid On/Off NOT available" ))
1703
1711
1704
- if not self .hub .is_connected :
1705
- await self .hub .connect ()
1706
-
1707
1712
except ModbusIOException as e :
1708
1713
_LOGGER .debug (
1709
1714
f"I{ self .inverter_unit_id } : A modbus I/O exception occurred "
@@ -1716,6 +1721,10 @@ async def read_modbus_data(self) -> None:
1716
1721
f"No response from inverter ID { self .inverter_unit_id } "
1717
1722
)
1718
1723
1724
+ finally :
1725
+ if not self .hub .is_connected :
1726
+ await self .hub .connect ()
1727
+
1719
1728
for name , value in iter (self .decoded_model .items ()):
1720
1729
if isinstance (value , float ):
1721
1730
display_value = float_to_hex (value )
0 commit comments