@@ -383,7 +383,7 @@ async def async_dhcp_check_device_types(self, host, port=DEFAULT_PORT, timeout=1
383383 client = AsyncModbusTcpClient (host = host , port = port , timeout = timeout )
384384
385385 try :
386- with _suppress_pymodbus_logging ():
386+ with _suppress_pymodbus_logging (really_suppress = False if _LOGGER . isEnabledFor ( logging . DEBUG ) else True ):
387387 if not await client .connect ():
388388 _LOGGER .debug ("Modbus connection failed to %s:%s" , host , port )
389389 return False
@@ -582,7 +582,7 @@ async def _async_try_read_register(self, client: AsyncModbusTcpClient, slave_id:
582582 host = client .comm_params .host
583583 port = client .comm_params .port
584584
585- with _suppress_pymodbus_logging ():
585+ with _suppress_pymodbus_logging (really_suppress = False if _LOGGER . isEnabledFor ( logging . DEBUG ) else True ):
586586 if not await client .connect ():
587587 err = ("Modbus connection failed to %s:%s" % (host , port ))
588588 _LOGGER .debug (err )
@@ -625,7 +625,7 @@ async def async_check_device_type(self, host, port, slave_id, timeout=1) -> str:
625625 client = AsyncModbusTcpClient (host = host , port = port , timeout = timeout )
626626
627627 try :
628- with _suppress_pymodbus_logging ():
628+ with _suppress_pymodbus_logging (really_suppress = False if _LOGGER . isEnabledFor ( logging . DEBUG ) else True ):
629629 if not await client .connect ():
630630 _LOGGER .debug ("Modbus connection failed to %s:%s" , host , port )
631631 return DEVICE_TYPE_UNKNOWN # Cannot determine type if connection fails
0 commit comments