mirror of
https://github.com/home-assistant/core.git
synced 2026-07-14 10:03:52 +01:00
0e1c190eec
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
26 lines
878 B
Python
26 lines
878 B
Python
"""Exceptions for the Modbus Connection integration."""
|
|
|
|
from modbus_connection import ModbusError
|
|
|
|
from homeassistant.exceptions import ConfigEntryNotReady
|
|
|
|
from .const import DOMAIN
|
|
|
|
|
|
class ConnectionNotReady(ConfigEntryNotReady, ModbusError):
|
|
"""The shared Modbus connection is missing or not loaded.
|
|
|
|
Raised by ``async_get_unit``. It is a ``ConfigEntryNotReady`` so a consumer
|
|
integration can let it propagate from its own ``async_setup_entry`` to get
|
|
Home Assistant's setup-retry behaviour, and a ``ModbusError`` so it is also
|
|
catchable with the library's error type.
|
|
"""
|
|
|
|
def __init__(self, connection_entry_id: str) -> None:
|
|
"""Initialize the error."""
|
|
super().__init__(
|
|
translation_domain=DOMAIN,
|
|
translation_key="connection_not_ready",
|
|
)
|
|
self.connection_entry_id = connection_entry_id
|