Rename incomfort exceptions classes to fix typo and assign correct translation domain (#136426)
parent
a3ba3bbb1d
commit
09559a43ad
|
@ -13,7 +13,7 @@ from homeassistant.helpers import device_registry as dr
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .coordinator import InComfortDataCoordinator, async_connect_gateway
|
from .coordinator import InComfortDataCoordinator, async_connect_gateway
|
||||||
from .errors import InConfortTimeout, InConfortUnknownError, NoHeaters, NotFound
|
from .errors import InComfortTimeout, InComfortUnknownError, NoHeaters, NotFound
|
||||||
|
|
||||||
PLATFORMS = (
|
PLATFORMS = (
|
||||||
Platform.WATER_HEATER,
|
Platform.WATER_HEATER,
|
||||||
|
@ -40,9 +40,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: InComfortConfigEntry) ->
|
||||||
except ClientResponseError as exc:
|
except ClientResponseError as exc:
|
||||||
if exc.status == 404:
|
if exc.status == 404:
|
||||||
raise NotFound from exc
|
raise NotFound from exc
|
||||||
raise InConfortUnknownError from exc
|
raise InComfortUnknownError from exc
|
||||||
except TimeoutError as exc:
|
except TimeoutError as exc:
|
||||||
raise InConfortTimeout from exc
|
raise InComfortTimeout from exc
|
||||||
|
|
||||||
# Register discovered gateway device
|
# Register discovered gateway device
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
|
|
|
@ -1,32 +1,33 @@
|
||||||
"""Exceptions raised by Intergas InComfort integration."""
|
"""Exceptions raised by Intergas InComfort integration."""
|
||||||
|
|
||||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN
|
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
||||||
|
|
||||||
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
class NotFound(HomeAssistantError):
|
class NotFound(HomeAssistantError):
|
||||||
"""Raise exception if no Lan2RF Gateway was found."""
|
"""Raise exception if no Lan2RF Gateway was found."""
|
||||||
|
|
||||||
translation_domain = HOMEASSISTANT_DOMAIN
|
translation_domain = DOMAIN
|
||||||
translation_key = "not_found"
|
translation_key = "not_found"
|
||||||
|
|
||||||
|
|
||||||
class NoHeaters(ConfigEntryNotReady):
|
class NoHeaters(ConfigEntryNotReady):
|
||||||
"""Raise exception if no heaters are found."""
|
"""Raise exception if no heaters are found."""
|
||||||
|
|
||||||
translation_domain = HOMEASSISTANT_DOMAIN
|
translation_domain = DOMAIN
|
||||||
translation_key = "no_heaters"
|
translation_key = "no_heaters"
|
||||||
|
|
||||||
|
|
||||||
class InConfortTimeout(ConfigEntryNotReady):
|
class InComfortTimeout(ConfigEntryNotReady):
|
||||||
"""Raise exception if no heaters are found."""
|
"""Raise exception if no heaters are found."""
|
||||||
|
|
||||||
translation_domain = HOMEASSISTANT_DOMAIN
|
translation_domain = DOMAIN
|
||||||
translation_key = "timeout_error"
|
translation_key = "timeout_error"
|
||||||
|
|
||||||
|
|
||||||
class InConfortUnknownError(ConfigEntryNotReady):
|
class InComfortUnknownError(ConfigEntryNotReady):
|
||||||
"""Raise exception if no heaters are found."""
|
"""Raise exception if no heaters are found."""
|
||||||
|
|
||||||
translation_domain = HOMEASSISTANT_DOMAIN
|
translation_domain = DOMAIN
|
||||||
translation_key = "unknown"
|
translation_key = "unknown"
|
||||||
|
|
|
@ -49,8 +49,22 @@
|
||||||
"auth_error": "Invalid credentials.",
|
"auth_error": "Invalid credentials.",
|
||||||
"no_heaters": "No heaters found.",
|
"no_heaters": "No heaters found.",
|
||||||
"not_found": "No Lan2RF gateway found.",
|
"not_found": "No Lan2RF gateway found.",
|
||||||
"timeout_error": "Time out when connection to Lan2RF gateway.",
|
"timeout_error": "Time out when connecting to Lan2RF gateway.",
|
||||||
"unknown": "Unknown error when connection to Lan2RF gateway."
|
"unknown": "Unknown error when connecting to Lan2RF gateway."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exceptions": {
|
||||||
|
"no_heaters": {
|
||||||
|
"message": "[%key:component::incomfort::config::error::no_heaters%]"
|
||||||
|
},
|
||||||
|
"not_found": {
|
||||||
|
"message": "[%key:component::incomfort::config::error::not_found%]"
|
||||||
|
},
|
||||||
|
"timeout_error": {
|
||||||
|
"message": "[%key:component::incomfort::config::error::timeout_error%]"
|
||||||
|
},
|
||||||
|
"unknown": {
|
||||||
|
"message": "[%key:component::incomfort::config::error::unknown%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
|
|
Loading…
Reference in New Issue