mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Remove duplicate error logs (batch 1) (#185443)
This commit is contained in:
@@ -53,8 +53,6 @@ async def async_fetch_airos_data(
|
||||
await airos_device.login()
|
||||
return await update_method()
|
||||
except AirOSConnectionAuthenticationError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.exception("Error authenticating with airOS device")
|
||||
raise ConfigEntryAuthFailed(
|
||||
translation_domain=DOMAIN, translation_key="invalid_auth"
|
||||
) from err
|
||||
@@ -63,15 +61,11 @@ async def async_fetch_airos_data(
|
||||
AirOSDeviceConnectionError,
|
||||
TimeoutError,
|
||||
) as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Error connecting to airOS device: %s", err)
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="cannot_connect",
|
||||
) from err
|
||||
except AirOSDataMissingError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Expected data not returned by airOS device: %s", err)
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="error_data_missing",
|
||||
|
||||
@@ -69,8 +69,6 @@ async def async_setup_entry(
|
||||
try:
|
||||
await ambient.ws_connect()
|
||||
except WebsocketError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
LOGGER.error("Config entry failed: %s", err)
|
||||
raise ConfigEntryNotReady from err
|
||||
|
||||
entry.runtime_data = ambient
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""The Aprilaire integration."""
|
||||
|
||||
import logging
|
||||
|
||||
from pyaprilaire.const import Attribute
|
||||
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP, Platform
|
||||
@@ -18,8 +16,6 @@ PLATFORMS: list[Platform] = [
|
||||
Platform.SENSOR,
|
||||
]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: AprilaireConfigEntry) -> bool:
|
||||
"""Set up a config entry for Aprilaire."""
|
||||
@@ -49,12 +45,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: AprilaireConfigEntry) ->
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_close)
|
||||
)
|
||||
else:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Failed to wait for ready")
|
||||
|
||||
coordinator.stop_listen()
|
||||
|
||||
raise ConfigEntryNotReady
|
||||
raise ConfigEntryNotReady("Failed to wait for ready")
|
||||
|
||||
await coordinator.wait_for_ready(ready_callback)
|
||||
|
||||
|
||||
@@ -128,7 +128,5 @@ class AwairLocalDataUpdateCoordinator(AwairDataUpdateCoordinator):
|
||||
self._device = devices[0]
|
||||
result = await self._fetch_air_data(self._device)
|
||||
except AwairError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
LOGGER.error("Unexpected API error: %s", err)
|
||||
raise UpdateFailed(err) from err
|
||||
return {result.device.uuid: result}
|
||||
|
||||
@@ -40,13 +40,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: BalboaConfigEntry) -> bo
|
||||
_LOGGER.debug("Attempting to connect to %s", host)
|
||||
spa = SpaClient(host)
|
||||
if not await spa.connect():
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Failed to connect to spa at %s", host)
|
||||
raise ConfigEntryNotReady("Unable to connect")
|
||||
raise ConfigEntryNotReady(f"Failed to connect to spa at {host}")
|
||||
if not await spa.async_configuration_loaded():
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Failed to get spa info at %s", host)
|
||||
raise ConfigEntryNotReady("Unable to configure")
|
||||
raise ConfigEntryNotReady(f"Failed to get spa info at {host}")
|
||||
|
||||
entry.runtime_data = spa
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Support for Canary devices."""
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Final
|
||||
|
||||
from canary.api import Api
|
||||
@@ -14,8 +13,6 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from .const import CONF_FFMPEG_ARGUMENTS, DEFAULT_FFMPEG_ARGUMENTS, DEFAULT_TIMEOUT
|
||||
from .coordinator import CanaryConfigEntry, CanaryDataUpdateCoordinator
|
||||
|
||||
_LOGGER: Final = logging.getLogger(__name__)
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES: Final = timedelta(seconds=30)
|
||||
|
||||
PLATFORMS: Final[list[Platform]] = [
|
||||
@@ -39,8 +36,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: CanaryConfigEntry) -> bo
|
||||
try:
|
||||
canary_api = await hass.async_add_executor_job(_get_canary_api_instance, entry)
|
||||
except (ConnectTimeout, HTTPError) as error:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Unable to connect to Canary service: %s", str(error))
|
||||
raise ConfigEntryNotReady from error
|
||||
|
||||
coordinator = CanaryDataUpdateCoordinator(hass, entry, api=canary_api)
|
||||
|
||||
@@ -75,12 +75,6 @@ def async_handle_api_call[_T: CieloDeviceEntity, **_P](
|
||||
)
|
||||
|
||||
if not isinstance(res, dict):
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
LOGGER.error(
|
||||
"API function did not return a dictionary for entity %s, got %s",
|
||||
entity.entity_id,
|
||||
type(res),
|
||||
)
|
||||
raise HomeAssistantError("Invalid API response format")
|
||||
|
||||
data: dict[str, Any] | None = res.get("data")
|
||||
|
||||
@@ -66,14 +66,9 @@ async def call_c4_api_retry(func, *func_args):
|
||||
)
|
||||
exc = exception
|
||||
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error(
|
||||
"Failed to connect to Control4 account API after %d attempts: %s",
|
||||
API_RETRY_TIMES,
|
||||
exc,
|
||||
)
|
||||
raise ConfigEntryNotReady(
|
||||
f"Failed to connect to Control4 account API after {API_RETRY_TIMES} attempts"
|
||||
"Failed to connect to Control4 account API after"
|
||||
f" {API_RETRY_TIMES} attempts: {exc}"
|
||||
) from exc
|
||||
|
||||
|
||||
@@ -86,10 +81,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: Control4ConfigEntry) ->
|
||||
try:
|
||||
await account.get_account_bearer_token()
|
||||
except client_exceptions.ClientError as exception:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Error connecting to Control4 account API: %s", exception)
|
||||
raise ConfigEntryNotReady(
|
||||
"Error connecting to Control4 account API to get bearer token"
|
||||
f"Error connecting to Control4 account API to get bearer token: {exception}"
|
||||
) from exception
|
||||
except BadCredentials as exception:
|
||||
raise ConfigEntryError(
|
||||
@@ -131,11 +124,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: Control4ConfigEntry) ->
|
||||
try:
|
||||
director_all_items: list[dict[str, Any]] = await director.get_all_item_info()
|
||||
except (TimeoutError, client_exceptions.ClientError) as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error(
|
||||
"Timeout connecting to Control4 controller at %s",
|
||||
config[CONF_HOST],
|
||||
)
|
||||
raise ConfigEntryNotReady(
|
||||
f"Timeout connecting to Control4 controller at {config[CONF_HOST]}"
|
||||
) from err
|
||||
@@ -146,11 +134,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: Control4ConfigEntry) ->
|
||||
try:
|
||||
ui_configuration = await director.get_ui_configuration()
|
||||
except (TimeoutError, client_exceptions.ClientError) as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error(
|
||||
"Timeout getting UI configuration from Control4 controller at %s",
|
||||
config[CONF_HOST],
|
||||
)
|
||||
raise ConfigEntryNotReady(
|
||||
"Timeout getting UI configuration from"
|
||||
f" Control4 controller at {config[CONF_HOST]}"
|
||||
|
||||
@@ -76,9 +76,9 @@ class CrownstoneEntryManager:
|
||||
)
|
||||
return False
|
||||
except CrownstoneUnknownError as unknown_err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Unknown error during login")
|
||||
raise ConfigEntryNotReady from unknown_err
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN, translation_key="unknown_login_error"
|
||||
) from unknown_err
|
||||
|
||||
# A new clientsession is created because the default
|
||||
# one does not cleanup on unload
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
"exceptions": {
|
||||
"authentication_failed": {
|
||||
"message": "Authentication with the Crownstone cloud failed"
|
||||
},
|
||||
"unknown_login_error": {
|
||||
"message": "Unknown error during login with the Crownstone cloud"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""The deako integration."""
|
||||
|
||||
import logging
|
||||
|
||||
from pydeako import Deako, DeakoDiscoverer, FindDevicesError
|
||||
|
||||
from homeassistant.components import zeroconf
|
||||
@@ -10,8 +8,6 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS: list[Platform] = [Platform.LIGHT]
|
||||
|
||||
type DeakoConfigEntry = ConfigEntry[Deako]
|
||||
@@ -28,8 +24,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: DeakoConfigEntry) -> boo
|
||||
try:
|
||||
await connection.find_devices()
|
||||
except FindDevicesError as exc:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.warning("Error finding devices: %s", exc)
|
||||
await connection.disconnect()
|
||||
raise ConfigEntryNotReady(exc) from exc
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from homeassistant.const import CONF_DEVICE, CONF_MODEL, Platform
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
||||
from .const import LOGGER, DenonRS232ConfigEntry
|
||||
from .const import DOMAIN, LOGGER, DenonRS232ConfigEntry
|
||||
|
||||
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||
|
||||
@@ -23,11 +23,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: DenonRS232ConfigEntry) -
|
||||
await receiver.connect()
|
||||
await receiver.query_state()
|
||||
except (ConnectionError, OSError, TimeoutError) as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
LOGGER.error("Error connecting to Denon receiver at %s: %s", port, err)
|
||||
if receiver.connected:
|
||||
await receiver.disconnect()
|
||||
raise ConfigEntryNotReady from err
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="cannot_connect",
|
||||
translation_placeholders={"port": port},
|
||||
) from err
|
||||
|
||||
entry.runtime_data = receiver
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
"cannot_connect": {
|
||||
"message": "Error connecting to Denon receiver at {port}"
|
||||
},
|
||||
"invalid_tuner_channel": {
|
||||
"message": "{media_id} is not a valid tuner preset (A1-G8) or FM frequency in hundredths of MHz (8750-10800; for example, 9930 for 99.30 MHz)."
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Fan platform for the Duco integration."""
|
||||
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from duco_connectivity.exceptions import DucoError, DucoRateLimitError
|
||||
@@ -16,8 +15,6 @@ from .const import BOX_NODE_ID, DOMAIN
|
||||
from .coordinator import DucoConfigEntry, DucoCoordinator
|
||||
from .entity import DucoEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
# Permanent speed states ordered low → high.
|
||||
@@ -132,8 +129,6 @@ class DucoVentilationFanEntity(DucoEntity, FanEntity):
|
||||
try:
|
||||
await self.coordinator.async_set_ventilation_state(self._node_id, state)
|
||||
except DucoRateLimitError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.warning("Duco write rate limit exceeded for node %s", self._node_id)
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="rate_limit_exceeded",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Number platform for the Duco integration."""
|
||||
|
||||
from dataclasses import replace
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from duco_connectivity import DucoError, DucoRateLimitError
|
||||
@@ -21,8 +20,6 @@ from .const import BOX_NODE_ID, DOMAIN
|
||||
from .coordinator import DucoConfigEntry, DucoCoordinator
|
||||
from .entity import DucoEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
|
||||
@@ -147,11 +144,6 @@ class DucoBypassSupplyTemperatureTargetNumber(DucoEntity, NumberEntity):
|
||||
},
|
||||
) from err
|
||||
except DucoRateLimitError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.warning(
|
||||
"Duco write rate limit exceeded for bypass target zone %s",
|
||||
self._zone_id,
|
||||
)
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="rate_limit_exceeded",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Select platform for the Duco integration."""
|
||||
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from duco_connectivity import (
|
||||
@@ -23,8 +22,6 @@ from .coordinator import DucoConfigEntry, DucoCoordinator
|
||||
from .entity import DucoEntity
|
||||
from .helpers import remove_stale_node_ids
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
|
||||
@@ -133,8 +130,6 @@ class DucoVentilationStateSelect(DucoEntity, SelectEntity):
|
||||
# through keeps newly added Duco states forward-compatible.
|
||||
await self.coordinator.async_set_ventilation_state(self._node_id, option)
|
||||
except DucoRateLimitError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.warning("Duco write rate limit exceeded for node %s", self._node_id)
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="rate_limit_exceeded",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Switch platform for the Duco integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
|
||||
from duco_connectivity import (
|
||||
@@ -23,8 +22,6 @@ from .coordinator import DucoConfigEntry, DucoCoordinator
|
||||
from .entity import DucoEntity
|
||||
from .helpers import remove_stale_node_ids
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
|
||||
@@ -103,8 +100,6 @@ class DucoIdentifySwitch(DucoEntity, SwitchEntity):
|
||||
try:
|
||||
await self.coordinator.async_set_node_identify(self._node_id, identify)
|
||||
except DucoRateLimitError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.warning("Duco write rate limit exceeded for node %s", self._node_id)
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="rate_limit_exceeded",
|
||||
|
||||
@@ -40,9 +40,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: DynaliteConfigEntry) ->
|
||||
bridge = DynaliteBridge(hass, convert_config(entry.data))
|
||||
|
||||
if not await bridge.async_setup():
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
LOGGER.error("Could not set up bridge for entry %s", entry.data)
|
||||
raise ConfigEntryNotReady
|
||||
raise ConfigEntryNotReady(f"Could not set up bridge at {bridge.host}")
|
||||
|
||||
entry.runtime_data = bridge
|
||||
entry.async_on_unload(entry.add_update_listener(async_entry_changed))
|
||||
|
||||
@@ -38,9 +38,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: EcoforestConfigEntry) ->
|
||||
translation_placeholders={"host": host},
|
||||
) from err
|
||||
except EcoforestConnectionError as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Error communicating with device %s", host)
|
||||
raise ConfigEntryNotReady from err
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="cannot_connect",
|
||||
translation_placeholders={"host": host},
|
||||
) from err
|
||||
|
||||
coordinator = EcoforestCoordinator(hass, entry, api)
|
||||
|
||||
|
||||
@@ -91,6 +91,9 @@
|
||||
"exceptions": {
|
||||
"authentication_failed": {
|
||||
"message": "Authentication on device {host} failed"
|
||||
},
|
||||
"cannot_connect": {
|
||||
"message": "Error communicating with device {host}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from aiohttp.client_exceptions import ClientError
|
||||
from pyeconet import EcoNetApiInterface
|
||||
@@ -23,8 +22,6 @@ from homeassistant.helpers.event import async_track_time_interval
|
||||
|
||||
from .const import DOMAIN, PUSH_UPDATE
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CLIMATE,
|
||||
@@ -56,8 +53,6 @@ async def async_setup_entry(
|
||||
translation_key="invalid_credentials",
|
||||
) from err
|
||||
except (ClientError, PyeconetError) as err:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.error("Config entry failed: %s", err)
|
||||
raise ConfigEntryNotReady from err
|
||||
|
||||
try:
|
||||
|
||||
@@ -158,10 +158,6 @@ class ElevenLabsTTSEntity(TextToSpeechEntity):
|
||||
bytes_combined = b"".join([byte_seg async for byte_seg in audio])
|
||||
|
||||
except ApiError as exc:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.warning(
|
||||
"Error during processing of TTS request %s", exc, exc_info=True
|
||||
)
|
||||
raise HomeAssistantError(exc) from exc
|
||||
return "mp3", bytes_combined
|
||||
|
||||
@@ -303,10 +299,6 @@ class ElevenLabsTTSEntity(TextToSpeechEntity):
|
||||
)
|
||||
previous_request_ids.clear()
|
||||
except ApiError as exc:
|
||||
# pylint: disable-next=home-assistant-log-and-raise
|
||||
_LOGGER.warning(
|
||||
"Error during processing of TTS request %s", exc, exc_info=True
|
||||
)
|
||||
_add_sentences_task.cancel()
|
||||
with contextlib.suppress(asyncio.CancelledError):
|
||||
await _add_sentences_task
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Tests for the Duco fan platform."""
|
||||
|
||||
import logging
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
from duco_connectivity import DucoConnectionError, DucoError, DucoRateLimitError
|
||||
@@ -108,31 +107,6 @@ async def test_fan_set_state_error(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("init_integration")
|
||||
async def test_fan_set_state_rate_limit_logs_warning(
|
||||
hass: HomeAssistant,
|
||||
mock_duco_client: AsyncMock,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test that a warning is logged when the write rate limit is exceeded."""
|
||||
mock_duco_client.async_set_ventilation_state = AsyncMock(
|
||||
side_effect=DucoRateLimitError()
|
||||
)
|
||||
|
||||
with (
|
||||
pytest.raises(HomeAssistantError),
|
||||
caplog.at_level(logging.WARNING, logger="homeassistant.components.duco.fan"),
|
||||
):
|
||||
await hass.services.async_call(
|
||||
FAN_DOMAIN,
|
||||
SERVICE_SET_PERCENTAGE,
|
||||
{ATTR_ENTITY_ID: _FAN_ENTITY, ATTR_PERCENTAGE: 100},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
assert "write rate limit exceeded" in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("init_integration")
|
||||
async def test_coordinator_update_marks_unavailable(
|
||||
hass: HomeAssistant,
|
||||
|
||||
Reference in New Issue
Block a user