Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions custom_components/protocol_wizard/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AsyncModbusTcpClient,
AsyncModbusUdpClient,
)
from pymodbus.exceptions import ModbusIOException

from .const import (
CONF_BAUDRATE,
Expand Down Expand Up @@ -318,7 +319,7 @@ async def async_step_modbus_device(self, user_input: dict[str, Any] | None = Non
},
)

except (OSError, ConnectionError, TimeoutError):
except (ModbusIOException, OSError, ConnectionError, TimeoutError):
_LOGGER.exception("Connection test failed")
errors["base"] = "cannot_connect"

Expand Down Expand Up @@ -435,7 +436,7 @@ async def _async_test_modbus_connection(self, data: dict[str, Any]) -> None:
if not result.isError() and hasattr(result, "registers") and len(result.registers) == count:
success = True
break
except (OSError, ConnectionError, TimeoutError) as inner_err:
except (ModbusIOException, OSError, ConnectionError, TimeoutError) as inner_err:
_LOGGER.debug("Test read failed for %s at addr %d: %s", name, address, inner_err)

if not success:
Expand Down
Loading