mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Translate UpdateFailed error in AVM Fritz/BOX Tools (#131466)
translate UpdateFailed error
This commit is contained in:
parent
d790a2d74c
commit
b7e960f0bc
@ -326,7 +326,11 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
|||||||
"call_deflections"
|
"call_deflections"
|
||||||
] = await self.async_update_call_deflections()
|
] = await self.async_update_call_deflections()
|
||||||
except FRITZ_EXCEPTIONS as ex:
|
except FRITZ_EXCEPTIONS as ex:
|
||||||
raise UpdateFailed(ex) from ex
|
raise UpdateFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="update_failed",
|
||||||
|
translation_placeholders={"error": str(ex)},
|
||||||
|
) from ex
|
||||||
|
|
||||||
_LOGGER.debug("enity_data: %s", entity_data)
|
_LOGGER.debug("enity_data: %s", entity_data)
|
||||||
return entity_data
|
return entity_data
|
||||||
|
@ -176,6 +176,9 @@
|
|||||||
},
|
},
|
||||||
"unable_to_connect": {
|
"unable_to_connect": {
|
||||||
"message": "Unable to establish a connection"
|
"message": "Unable to establish a connection"
|
||||||
|
},
|
||||||
|
"update_failed": {
|
||||||
|
"message": "Error while uptaing the data: {error}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ async def test_sensor_setup(
|
|||||||
|
|
||||||
|
|
||||||
async def test_sensor_update_fail(
|
async def test_sensor_update_fail(
|
||||||
hass: HomeAssistant, fc_class_mock, fh_class_mock
|
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, fc_class_mock, fh_class_mock
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test failed update of Fritz!Tools sensors."""
|
"""Test failed update of Fritz!Tools sensors."""
|
||||||
|
|
||||||
@ -53,10 +53,12 @@ async def test_sensor_update_fail(
|
|||||||
await hass.config_entries.async_setup(entry.entry_id)
|
await hass.config_entries.async_setup(entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
fc_class_mock().call_action_side_effect(FritzConnectionException)
|
fc_class_mock().call_action_side_effect(FritzConnectionException("Boom"))
|
||||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=300))
|
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=300))
|
||||||
await hass.async_block_till_done(wait_background_tasks=True)
|
await hass.async_block_till_done(wait_background_tasks=True)
|
||||||
|
|
||||||
|
assert "Error while uptaing the data: Boom" in caplog.text
|
||||||
|
|
||||||
sensors = hass.states.async_all(SENSOR_DOMAIN)
|
sensors = hass.states.async_all(SENSOR_DOMAIN)
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
assert sensor.state == STATE_UNAVAILABLE
|
assert sensor.state == STATE_UNAVAILABLE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user