mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Add exception translation in HomeWizard coordinator (#131404)
This commit is contained in:
parent
d4071e7123
commit
904c3291d9
@ -66,7 +66,9 @@ class HWEnergyDeviceUpdateCoordinator(DataUpdateCoordinator[DeviceResponseEntry]
|
||||
)
|
||||
|
||||
except RequestError as ex:
|
||||
raise UpdateFailed(ex) from ex
|
||||
raise UpdateFailed(
|
||||
ex, translation_domain=DOMAIN, translation_key="communication_error"
|
||||
) from ex
|
||||
|
||||
except DisabledError as ex:
|
||||
if not self.api_disabled:
|
||||
@ -79,7 +81,9 @@ class HWEnergyDeviceUpdateCoordinator(DataUpdateCoordinator[DeviceResponseEntry]
|
||||
self.config_entry.entry_id
|
||||
)
|
||||
|
||||
raise UpdateFailed(ex) from ex
|
||||
raise UpdateFailed(
|
||||
ex, translation_domain=DOMAIN, translation_key="api_disabled"
|
||||
) from ex
|
||||
|
||||
self.api_disabled = False
|
||||
|
||||
|
@ -67,12 +67,7 @@ rules:
|
||||
entity-device-class: done
|
||||
entity-disabled-by-default: done
|
||||
entity-translations: done
|
||||
exception-translations:
|
||||
status: todo
|
||||
comment: |
|
||||
While the integration provides some of the exception translations, the
|
||||
translation for the error raised in the update error of the coordinator
|
||||
is missing.
|
||||
exception-translations: done
|
||||
icon-translations: done
|
||||
reconfiguration-flow: todo
|
||||
repair-issues:
|
||||
|
@ -20,7 +20,7 @@
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"api_not_enabled": "The API is not enabled. Enable API in the HomeWizard Energy App under settings",
|
||||
"api_not_enabled": "The local API is disabled. Go to the HomeWizard Energy app and enable the API in the device settings.",
|
||||
"network_error": "Device unreachable, make sure that you have entered the correct IP address and that the device is available in your network"
|
||||
},
|
||||
"abort": {
|
||||
@ -123,7 +123,7 @@
|
||||
},
|
||||
"exceptions": {
|
||||
"api_disabled": {
|
||||
"message": "The local API of the HomeWizard device is disabled"
|
||||
"message": "The local API is disabled."
|
||||
},
|
||||
"communication_error": {
|
||||
"message": "An error occurred while communicating with HomeWizard device"
|
||||
|
@ -79,7 +79,7 @@ async def test_identify_button(
|
||||
|
||||
with pytest.raises(
|
||||
HomeAssistantError,
|
||||
match=r"^The local API of the HomeWizard device is disabled$",
|
||||
match=r"^The local API is disabled$",
|
||||
):
|
||||
await hass.services.async_call(
|
||||
button.DOMAIN,
|
||||
|
@ -85,7 +85,7 @@ async def test_number_entities(
|
||||
mock_homewizardenergy.state_set.side_effect = DisabledError
|
||||
with pytest.raises(
|
||||
HomeAssistantError,
|
||||
match=r"^The local API of the HomeWizard device is disabled$",
|
||||
match=r"^The local API is disabled$",
|
||||
):
|
||||
await hass.services.async_call(
|
||||
number.DOMAIN,
|
||||
|
@ -174,7 +174,7 @@ async def test_switch_entities(
|
||||
|
||||
with pytest.raises(
|
||||
HomeAssistantError,
|
||||
match=r"^The local API of the HomeWizard device is disabled$",
|
||||
match=r"^The local API is disabled$",
|
||||
):
|
||||
await hass.services.async_call(
|
||||
switch.DOMAIN,
|
||||
@ -185,7 +185,7 @@ async def test_switch_entities(
|
||||
|
||||
with pytest.raises(
|
||||
HomeAssistantError,
|
||||
match=r"^The local API of the HomeWizard device is disabled$",
|
||||
match=r"^The local API is disabled$",
|
||||
):
|
||||
await hass.services.async_call(
|
||||
switch.DOMAIN,
|
||||
|
Loading…
x
Reference in New Issue
Block a user