File tree 2 files changed +9
-5
lines changed
custom_components/solaredge_modbus_multi
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ async def async_refresh_modbus_data(self) -> bool:
385
385
raise DataUpdateFailed (f"Modbus error: { e } " )
386
386
387
387
except TimeoutError as e :
388
- self .disconnect ()
388
+ self .disconnect (clear_client = True )
389
389
self ._timeout_counter += 1
390
390
391
391
_LOGGER .debug (
@@ -413,6 +413,7 @@ async def connect(self) -> None:
413
413
"""Connect to inverter."""
414
414
415
415
if self ._client is None :
416
+ _LOGGER .debug (f"New client object for { self ._host } :{ self ._port } " )
416
417
self ._client = AsyncModbusTcpClient (
417
418
host = self ._host ,
418
419
port = self ._port ,
@@ -424,18 +425,21 @@ async def connect(self) -> None:
424
425
425
426
await self ._client .connect ()
426
427
427
- def disconnect (self ) -> None :
428
+ def disconnect (self , clear_client : bool = False ) -> None :
428
429
"""Disconnect from inverter."""
429
430
430
431
if self ._client is not None :
431
432
self ._client .close ()
432
433
434
+ if clear_client :
435
+ self ._client = None
436
+
433
437
async def shutdown (self ) -> None :
434
438
"""Shut down the hub and disconnect."""
439
+
435
440
async with self ._lock :
436
441
self .online = False
437
- self .disconnect ()
438
- self ._client = None
442
+ self .disconnect (clear_client = True )
439
443
440
444
async def modbus_read_holding_registers (self , unit , address , rcount ):
441
445
"""Read modbus registers from inverter."""
Original file line number Diff line number Diff line change 10
10
"issue_tracker" : " https://github.com/WillCodeForCats/solaredge-modbus-multi/issues" ,
11
11
"loggers" : [" custom_components.solaredge_modbus_multi" ],
12
12
"requirements" : [" pymodbus>=3.5.4" ],
13
- "version" : " 2.4.11 -pre.1"
13
+ "version" : " 2.4.12 -pre.1"
14
14
}
You can’t perform that action at this time.
0 commit comments