String formatting and max line length - Part 1 (#84390)

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Franck Nijhof 2022-12-22 10:12:50 +01:00 committed by GitHub
parent 41341c76cf
commit b0cee0bc46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
98 changed files with 532 additions and 237 deletions

View file

@ -534,7 +534,8 @@ class AuthManager:
)
if provider is None:
raise InvalidProvider(
f"Auth provider {refresh_token.credential.auth_provider_type}, {refresh_token.credential.auth_provider_id} not available"
f"Auth provider {refresh_token.credential.auth_provider_type},"
f" {refresh_token.credential.auth_provider_id} not available"
)
return provider

View file

@ -449,8 +449,10 @@ class AuthStore:
created_at = dt_util.parse_datetime(rt_dict["created_at"])
if created_at is None:
getLogger(__name__).error(
(
"Ignoring refresh token %(id)s with invalid created_at "
"%(created_at)s for user_id %(user_id)s",
"%(created_at)s for user_id %(user_id)s"
),
rt_dict,
)
continue

View file

@ -47,8 +47,10 @@ def _generate_qr_code(data: str) -> str:
.decode("ascii")
.replace("\n", "")
.replace(
(
'<?xml version="1.0" encoding="UTF-8"?>'
'<svg xmlns="http://www.w3.org/2000/svg"',
'<svg xmlns="http://www.w3.org/2000/svg"'
),
"<svg",
)
)

View file

@ -93,9 +93,11 @@ class Data:
self.is_legacy = True
logging.getLogger(__name__).warning(
(
"Home Assistant auth provider is running in legacy mode "
"because we detected usernames that are case-insensitive"
"equivalent. Please change the username: '%s'.",
"equivalent. Please change the username: '%s'."
),
username,
)
@ -108,9 +110,11 @@ class Data:
self.is_legacy = True
logging.getLogger(__name__).warning(
(
"Home Assistant auth provider is running in legacy mode "
"because we detected usernames that start or end in a "
"space. Please change the username: '%s'.",
"space. Please change the username: '%s'."
),
username,
)

View file

@ -284,8 +284,7 @@ async def async_from_config_dict(
return None
except HomeAssistantError:
_LOGGER.error(
"Home Assistant core failed to initialize. "
"Further initialization aborted"
"Home Assistant core failed to initialize. Further initialization aborted"
)
return None

View file

@ -75,7 +75,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
else:
# Create Entry
return self.async_create_entry(
title=f"AirNow Sensor at {user_input[CONF_LATITUDE]}, {user_input[CONF_LONGITUDE]}",
title=(
f"AirNow Sensor at {user_input[CONF_LATITUDE]},"
f" {user_input[CONF_LONGITUDE]}"
),
data=user_input,
)

View file

@ -55,8 +55,11 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
await airq.validate()
except ClientConnectionError:
_LOGGER.debug(
"Failed to connect to device %s. Check the IP address / device ID "
"as well as whether the device is connected to power and the WiFi",
(
"Failed to connect to device %s. Check the IP address / device"
" ID as well as whether the device is connected to power and"
" the WiFi"
),
user_input[CONF_IP_ADDRESS],
)
errors["base"] = "cannot_connect"

View file

@ -37,7 +37,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
step_id="user",
data_schema=STEP_USER_DATA_SCHEMA,
description_placeholders={
"url": "https://dashboard.airthings.com/integrations/api-integration",
"url": (
"https://dashboard.airthings.com/integrations/api-integration"
),
},
)

View file

@ -47,8 +47,8 @@ async def async_setup_platform(
) -> None:
"""Set up Aladdin Connect devices yaml depreciated."""
_LOGGER.warning(
"Configuring Aladdin Connect through yaml is deprecated"
"Please remove it from your configuration as it has already been imported to a config entry"
"Configuring Aladdin Connect through yaml is deprecated. Please remove it from"
" your configuration as it has already been imported to a config entry"
)
await hass.async_create_task(
hass.config_entries.flow.async_init(

View file

@ -475,7 +475,10 @@ async def async_api_unlock(
) -> AlexaResponse:
"""Process an unlock request."""
if config.locale not in {"de-DE", "en-US", "ja-JP"}:
msg = f"The unlock directive is not supported for the following locales: {config.locale}"
msg = (
"The unlock directive is not supported for the following locales:"
f" {config.locale}"
)
raise AlexaInvalidDirectiveError(msg)
entity = directive.entity

View file

@ -21,7 +21,10 @@ def async_describe_events(hass, async_describe_event):
if entity_id := data["request"].get("entity_id"):
state = hass.states.get(entity_id)
name = state.name if state else entity_id
message = f"sent command {data['request']['namespace']}/{data['request']['name']} for {name}"
message = (
"sent command"
f" {data['request']['namespace']}/{data['request']['name']} for {name}"
)
else:
message = (
f"sent command {data['request']['namespace']}/{data['request']['name']}"

View file

@ -273,7 +273,10 @@ class AlmondAgent(conversation.AbstractConversationAgent):
if self.entry.data.get("is_hassio"):
host = "/core_almond"
return {
"text": "Would you like to opt-in to share your anonymized commands with Stanford to improve Almond's responses?",
"text": (
"Would you like to opt-in to share your anonymized commands with"
" Stanford to improve Almond's responses?"
),
"url": f"{host}/conversation",
}

View file

@ -227,7 +227,10 @@ async def async_setup_entry(
for channel_type in current:
description = SensorEntityDescription(
key="descriptors",
name=f"{entry.title} - {friendly_channel_type(channel_type)} Price Descriptor",
name=(
f"{entry.title} - {friendly_channel_type(channel_type)} Price"
" Descriptor"
),
icon=ICONS[channel_type],
)
entities.append(

View file

@ -213,7 +213,9 @@ class AmbientWeatherEntity(Entity):
public_device_id = get_public_device_id(mac_address)
self._attr_device_info = DeviceInfo(
configuration_url=f"https://ambientweather.net/dashboard/{public_device_id}",
configuration_url=(
f"https://ambientweather.net/dashboard/{public_device_id}"
),
identifiers={(DOMAIN, mac_address)},
manufacturer="Ambient Weather",
name=station_name.capitalize(),

View file

@ -79,7 +79,10 @@ def _setup_androidtv(
else:
# Use "pure-python-adb" (communicate with ADB server)
signer = None
adb_log = f"using ADB server at {config[CONF_ADB_SERVER_IP]}:{config[CONF_ADB_SERVER_PORT]}"
adb_log = (
"using ADB server at"
f" {config[CONF_ADB_SERVER_IP]}:{config[CONF_ADB_SERVER_PORT]}"
)
return adbkey, signer, adb_log

View file

@ -179,13 +179,16 @@ def adb_decorator(
except LockNotAcquiredException:
# If the ADB lock could not be acquired, skip this command
_LOGGER.info(
"ADB command not executed because the connection is currently in use"
"ADB command not executed because the connection is currently"
" in use"
)
return None
except self.exceptions as err:
_LOGGER.error(
(
"Failed to execute an ADB command. ADB connection re-"
"establishing attempt in the next update. Error: %s",
"establishing attempt in the next update. Error: %s"
),
err,
)
await self.aftv.adb_close()
@ -427,7 +430,10 @@ class ADBDevice(MediaPlayerEntity):
self._attr_extra_state_attributes[ATTR_ADB_RESPONSE] = output
self.async_write_ha_state()
msg = f"Output from service '{SERVICE_LEARN_SENDEVENT}' from {self.entity_id}: '{output}'"
msg = (
f"Output from service '{SERVICE_LEARN_SENDEVENT}' from"
f" {self.entity_id}: '{output}'"
)
persistent_notification.async_create(
self.hass,
msg,

View file

@ -309,7 +309,8 @@ class AppleTVManager:
missing_protocols_str = ", ".join(missing_protocols)
if raise_missing_credentials:
raise ConfigEntryNotReady(
f"Protocol(s) {missing_protocols_str} not yet found for {name}, waiting for discovery."
f"Protocol(s) {missing_protocols_str} not yet found for {name},"
" waiting for discovery."
)
_LOGGER.info(
"Protocol(s) %s not yet found for %s, trying later",

View file

@ -302,8 +302,8 @@ async def _get_platform(
platform, "async_get_auth_implementation"
):
raise ValueError(
f"Integration '{integration_domain}' platform {DOMAIN} did not "
f"implement 'async_get_authorization_server' or 'async_get_auth_implementation'"
f"Integration '{integration_domain}' platform {DOMAIN} did not implement"
" 'async_get_authorization_server' or 'async_get_auth_implementation'"
)
return platform

View file

@ -402,7 +402,10 @@ class AsusWrtRouter:
]
except Exception as exc: # pylint: disable=broad-except
_LOGGER.debug(
"Failed checking temperature sensor availability for ASUS router %s. Exception: %s",
(
"Failed checking temperature sensor availability for ASUS router"
" %s. Exception: %s"
),
self._host,
exc,
)

View file

@ -400,7 +400,10 @@ class AugustData(AugustSubscriberMixin):
if self._device_detail_by_id.get(device_id):
continue
_LOGGER.info(
"The doorbell %s could not be setup because the system could not fetch details about the doorbell",
(
"The doorbell %s could not be setup because the system could not"
" fetch details about the doorbell"
),
doorbell.device_name,
)
del self._doorbells_by_id[device_id]
@ -414,12 +417,18 @@ class AugustData(AugustSubscriberMixin):
lock_detail = self._device_detail_by_id.get(device_id)
if lock_detail is None:
_LOGGER.info(
"The lock %s could not be setup because the system could not fetch details about the lock",
(
"The lock %s could not be setup because the system could not"
" fetch details about the lock"
),
lock.device_name,
)
elif lock_detail.bridge is None:
_LOGGER.info(
"The lock %s could not be setup because it does not have a bridge (Connect)",
(
"The lock %s could not be setup because it does not have a"
" bridge (Connect)"
),
lock.device_name,
)
del self._device_detail_by_id[device_id]

View file

@ -167,7 +167,10 @@ async def async_setup_entry(
detail = data.get_device_detail(door.device_id)
if not detail.doorsense:
_LOGGER.debug(
"Not adding sensor class door for lock %s because it does not have doorsense",
(
"Not adding sensor class door for lock %s because it does not have"
" doorsense"
),
door.device_name,
)
continue

View file

@ -131,7 +131,10 @@ class AugustGateway:
await self.authenticator.async_refresh_access_token(force=False)
)
_LOGGER.info(
"Refreshed august access token. The old token expired at %s, and the new token expires at %s",
(
"Refreshed august access token. The old token expired at %s, and"
" the new token expires at %s"
),
self.authentication.access_token_expires,
refreshed_authentication.access_token_expires,
)

View file

@ -45,7 +45,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
return await client.get_usage(service_id)
except UnrecognisedServiceType as err:
raise UpdateFailed(
f"Service {service_id} of type '{services[service_id]['type']}' was unrecognised"
f"Service {service_id} of type '{services[service_id]['type']}' was"
" unrecognised"
) from err
return async_update_data

View file

@ -122,7 +122,9 @@ class WellKnownOAuthInfoView(HomeAssistantView):
"token_endpoint": "/auth/token",
"revocation_endpoint": "/auth/revoke",
"response_types_supported": ["code"],
"service_documentation": "https://developers.home-assistant.io/docs/auth_api",
"service_documentation": (
"https://developers.home-assistant.io/docs/auth_api"
),
}
)

View file

@ -418,8 +418,7 @@ class AutomationEntity(ToggleEntity, RestoreEntity):
if last_triggered is not None:
self.action_script.last_triggered = parse_datetime(last_triggered)
self._logger.debug(
"Loaded automation %s with state %s from state "
" storage last state %s",
"Loaded automation %s with state %s from state storage last state %s",
self.entity_id,
enable_automation,
state,
@ -435,8 +434,7 @@ class AutomationEntity(ToggleEntity, RestoreEntity):
if self._initial_state is not None:
enable_automation = self._initial_state
self._logger.debug(
"Automation %s initial state %s overridden from "
"config initial_state",
"Automation %s initial state %s overridden from config initial_state",
self.entity_id,
enable_automation,
)

View file

@ -48,7 +48,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await client.authorize(entry.data[CONF_PAT], entry.data[CONF_ORG])
if not client.authorized:
raise ConfigEntryAuthFailed(
"Could not authorize with Azure DevOps. You will need to update your token"
"Could not authorize with Azure DevOps. You will need to update your"
" token"
)
project = await client.get_project(

View file

@ -64,7 +64,9 @@ class AzureEventHubClientSAS(AzureEventHubClient):
def client(self) -> EventHubProducerClient:
"""Get a Event Producer Client."""
return EventHubProducerClient(
fully_qualified_namespace=f"{self.event_hub_namespace}.servicebus.windows.net",
fully_qualified_namespace=(
f"{self.event_hub_namespace}.servicebus.windows.net"
),
eventhub_name=self.event_hub_instance_name,
credential=EventHubSharedKeyCredential( # type: ignore[arg-type]
policy=self.event_hub_sas_policy, key=self.event_hub_sas_key

View file

@ -129,7 +129,10 @@ class BackupManager:
if not backup.path.exists():
LOGGER.debug(
"Removing tracked backup (%s) that does not exists on the expected path %s",
(
"Removing tracked backup (%s) that does not exists on the expected"
" path %s"
),
backup.slug,
backup.path,
)

View file

@ -266,9 +266,7 @@ class BayesianBinarySensor(BinarySensorEntity):
)
if isinstance(result, TemplateError):
_LOGGER.error(
"TemplateError('%s') "
"while processing template '%s' "
"in entity '%s'",
"TemplateError('%s') while processing template '%s' in entity '%s'",
result,
template,
self.entity_id,
@ -369,12 +367,18 @@ class BayesianBinarySensor(BinarySensorEntity):
# observation.observed is None
if observation.entity_id is not None:
_LOGGER.debug(
"Observation for entity '%s' returned None, it will not be used for Bayesian updating",
(
"Observation for entity '%s' returned None, it will not be used"
" for Bayesian updating"
),
observation.entity_id,
)
continue
_LOGGER.debug(
"Observation for template entity returned None rather than a valid boolean, it will not be used for Bayesian updating",
(
"Observation for template entity returned None rather than a valid"
" boolean, it will not be used for Bayesian updating"
),
)
# the prior has been updated and is now the posterior
return prior

View file

@ -177,7 +177,8 @@ class BleBoxLightEntity(BleBoxEntity[blebox_uniapi.light.Light], LightEntity):
await self._feature.async_api_command("effect", effect_value)
except ValueError as exc:
raise ValueError(
f"Turning on with effect '{self.name}' failed: {effect} not in effect list."
f"Turning on with effect '{self.name}' failed: {effect} not in"
" effect list."
) from exc
async def async_turn_off(self, **kwargs: Any) -> None:

View file

@ -55,7 +55,10 @@ def _reauth_flow_wrapper(hass, data):
)
persistent_notification.async_create(
hass,
"Blink configuration migrated to a new version. Please go to the integrations page to re-configure (such as sending a new 2FA key).",
(
"Blink configuration migrated to a new version. Please go to the"
" integrations page to re-configure (such as sending a new 2FA key)."
),
"Blink Migration",
)

View file

@ -125,7 +125,8 @@ def _extract_blueprint_from_community_topic(
if blueprint is None:
raise HomeAssistantError(
"No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax."
"No valid blueprint found in the topic. Blueprint syntax blocks need to be"
" marked as YAML or no syntax."
)
return ImportedBlueprint(
@ -209,7 +210,8 @@ async def fetch_blueprint_from_github_gist_url(
if blueprint is None:
raise HomeAssistantError(
"No valid blueprint found in the gist. The blueprint file needs to end with '.yaml'"
"No valid blueprint found in the gist. The blueprint file needs to end with"
" '.yaml'"
)
return ImportedBlueprint(

View file

@ -69,7 +69,10 @@ class Blueprint:
expected_domain,
path or self.name,
data,
f"Found incorrect blueprint type {data_domain}, expected {expected_domain}",
(
f"Found incorrect blueprint type {data_domain}, expected"
f" {expected_domain}"
),
)
self.domain = data_domain

View file

@ -108,7 +108,10 @@ class BaseHaScanner(ABC):
"""
if self._async_watchdog_triggered():
_LOGGER.info(
"%s: Bluetooth scanner has gone quiet for %ss, check logs on the scanner device for more information",
(
"%s: Bluetooth scanner has gone quiet for %ss, check logs on the"
" scanner device for more information"
),
self.name,
SCANNER_WATCHDOG_TIMEOUT,
)

View file

@ -318,7 +318,10 @@ class BluetoothManager:
# If the old advertisement is stale, any new advertisement is preferred
if debug:
_LOGGER.debug(
"%s (%s): Switching from %s to %s (time elapsed:%s > stale seconds:%s)",
(
"%s (%s): Switching from %s to %s (time elapsed:%s > stale"
" seconds:%s)"
),
new.name,
new.address,
self._async_describe_source(old),
@ -333,7 +336,10 @@ class BluetoothManager:
# If new advertisement is RSSI_SWITCH_THRESHOLD more, the new one is preferred
if debug:
_LOGGER.debug(
"%s (%s): Switching from %s to %s (new rssi:%s - threshold:%s > old rssi:%s)",
(
"%s (%s): Switching from %s to %s (new rssi:%s - threshold:%s >"
" old rssi:%s)"
),
new.name,
new.address,
self._async_describe_source(old),

View file

@ -286,7 +286,8 @@ class PassiveBluetoothDataProcessor(Generic[_T]):
if not isinstance(new_data, PassiveBluetoothDataUpdate):
self.last_update_success = False # type: ignore[unreachable]
raise ValueError(
f"The update_method for {self.coordinator.name} returned {new_data} instead of a PassiveBluetoothDataUpdate"
f"The update_method for {self.coordinator.name} returned"
f" {new_data} instead of a PassiveBluetoothDataUpdate"
)
if not self.last_update_success:

View file

@ -263,7 +263,8 @@ class HaScanner(BaseHaScanner):
await self._async_reset_adapter()
continue
raise ScannerStartError(
f"{self.name}: Timed out starting Bluetooth after {START_TIMEOUT} seconds"
f"{self.name}: Timed out starting Bluetooth after"
f" {START_TIMEOUT} seconds"
) from ex
except BleakError as ex:
error_str = str(ex)

View file

@ -258,7 +258,8 @@ class HaBleakClientWrapper(BleakClient):
return backend
raise BleakError(
f"No backend with an available connection slot that can reach address {address} was found"
"No backend with an available connection slot that can reach address"
f" {address} was found"
)
async def disconnect(self) -> bool:

View file

@ -187,7 +187,10 @@ async def async_setup_scanner(
# If an update is in progress, we don't do anything
if update_bluetooth_lock.locked():
_LOGGER.debug(
"Previous execution of update_bluetooth is taking longer than the scheduled update of interval %s",
(
"Previous execution of update_bluetooth is taking longer than the"
" scheduled update of interval %s"
),
interval,
)
return

View file

@ -120,9 +120,11 @@ class BMWButton(BMWBaseEntity, ButtonEntity):
await self.entity_description.remote_function(self.vehicle)
elif self.entity_description.account_function:
_LOGGER.warning(
"The 'Refresh from cloud' button is deprecated. Use the 'homeassistant.update_entity' "
"service with any BMW entity for a full reload. See https://www.home-assistant.io/"
"integrations/bmw_connected_drive/#update-the-state--refresh-from-api for details"
"The 'Refresh from cloud' button is deprecated. Use the"
" 'homeassistant.update_entity' service with any BMW entity for a full"
" reload. See"
" https://www.home-assistant.io/integrations/bmw_connected_drive/#update-the-state--refresh-from-api"
" for details"
)
await self.entity_description.account_function(self.coordinator)

View file

@ -31,7 +31,10 @@ async def async_setup_entry(
entities.append(BMWDeviceTracker(coordinator, vehicle))
if not vehicle.is_vehicle_tracking_enabled:
_LOGGER.info(
"Tracking is (currently) disabled for vehicle %s (%s), defaulting to unknown",
(
"Tracking is (currently) disabled for vehicle %s (%s), defaulting"
" to unknown"
),
vehicle.name,
vehicle.vin,
)

View file

@ -151,7 +151,8 @@ class BondFan(BondEntity, FanEntity):
)
except ClientResponseError as ex:
raise HomeAssistantError(
f"The bond API returned an error calling set_power_state_belief for {self.entity_id}. Code: {ex.code} Message: {ex.message}"
"The bond API returned an error calling set_power_state_belief for"
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
) from ex
async def async_set_speed_belief(self, speed: int) -> None:
@ -175,7 +176,8 @@ class BondFan(BondEntity, FanEntity):
)
except ClientResponseError as ex:
raise HomeAssistantError(
f"The bond API returned an error calling set_speed_belief for {self.entity_id}. Code: {ex.code} Message: {ex.message}"
"The bond API returned an error calling set_speed_belief for"
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
) from ex
async def async_turn_on(

View file

@ -137,7 +137,8 @@ class BondBaseLight(BondEntity, LightEntity):
)
except ClientResponseError as ex:
raise HomeAssistantError(
f"The bond API returned an error calling set_brightness_belief for {self.entity_id}. Code: {ex.code} Message: {ex.message}"
"The bond API returned an error calling set_brightness_belief for"
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
) from ex
async def async_set_power_belief(self, power_state: bool) -> None:
@ -148,7 +149,8 @@ class BondBaseLight(BondEntity, LightEntity):
)
except ClientResponseError as ex:
raise HomeAssistantError(
f"The bond API returned an error calling set_light_state_belief for {self.entity_id}. Code: {ex.code} Message: {ex.message}"
"The bond API returned an error calling set_light_state_belief for"
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
) from ex
@ -197,7 +199,8 @@ class BondLight(BondBaseLight, BondEntity, LightEntity):
async def async_start_increasing_brightness(self) -> None:
"""Start increasing the light brightness."""
_LOGGER.warning(
"The bond.start_increasing_brightness service is deprecated and has been replaced with a button; Call the button.press service instead"
"The bond.start_increasing_brightness service is deprecated and has been"
" replaced with a button; Call the button.press service instead"
)
self._async_has_action_or_raise(Action.START_INCREASING_BRIGHTNESS)
await self._hub.bond.action(
@ -207,7 +210,8 @@ class BondLight(BondBaseLight, BondEntity, LightEntity):
async def async_start_decreasing_brightness(self) -> None:
"""Start decreasing the light brightness."""
_LOGGER.warning(
"The bond.start_decreasing_brightness service is deprecated and has been replaced with a button; Call the button.press service instead"
"The bond.start_decreasing_brightness service is deprecated and has been"
" replaced with a button; Call the button.press service instead"
)
self._async_has_action_or_raise(Action.START_DECREASING_BRIGHTNESS)
await self._hub.bond.action(
@ -217,7 +221,8 @@ class BondLight(BondBaseLight, BondEntity, LightEntity):
async def async_stop(self) -> None:
"""Stop all actions and clear the queue."""
_LOGGER.warning(
"The bond.stop service is deprecated and has been replaced with a button; Call the button.press service instead"
"The bond.stop service is deprecated and has been replaced with a button;"
" Call the button.press service instead"
)
self._async_has_action_or_raise(Action.STOP)
await self._hub.bond.action(self._device.device_id, Action(Action.STOP))
@ -307,7 +312,8 @@ class BondFireplace(BondEntity, LightEntity):
)
except ClientResponseError as ex:
raise HomeAssistantError(
f"The bond API returned an error calling set_brightness_belief for {self.entity_id}. Code: {ex.code} Message: {ex.message}"
"The bond API returned an error calling set_brightness_belief for"
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
) from ex
async def async_set_power_belief(self, power_state: bool) -> None:
@ -318,5 +324,6 @@ class BondFireplace(BondEntity, LightEntity):
)
except ClientResponseError as ex:
raise HomeAssistantError(
f"The bond API returned an error calling set_power_state_belief for {self.entity_id}. Code: {ex.code} Message: {ex.message}"
"The bond API returned an error calling set_power_state_belief for"
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
) from ex

View file

@ -64,5 +64,6 @@ class BondSwitch(BondEntity, SwitchEntity):
)
except ClientResponseError as ex:
raise HomeAssistantError(
f"The bond API returned an error calling set_power_state_belief for {self.entity_id}. Code: {ex.code} Message: {ex.message}"
"The bond API returned an error calling set_power_state_belief for"
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
) from ex

View file

@ -39,8 +39,10 @@ class BroadlinkFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Define a device for the config flow."""
if device.type not in DEVICE_TYPES:
_LOGGER.error(
(
"Unsupported device: %s. If it worked before, please open "
"an issue at https://github.com/home-assistant/core/issues",
"an issue at https://github.com/home-assistant/core/issues"
),
hex(device.devtype),
)
raise AbortFlow("not_supported")
@ -175,9 +177,11 @@ class BroadlinkFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(device.mac.hex())
if self.source == config_entries.SOURCE_IMPORT:
_LOGGER.warning(
(
"%s (%s at %s) is ready to be configured. Click "
"Configuration in the sidebar, click Integrations and "
"click Configure on the device to complete the setup",
"click Configure on the device to complete the setup"
),
device.name,
device.model,
device.host[0],

View file

@ -175,9 +175,11 @@ class BroadlinkDevice:
self.authorized = False
_LOGGER.error(
(
"%s (%s at %s) is locked. Click Configuration in the sidebar, "
"click Integrations, click Configure on the device and follow "
"the instructions to unlock it",
"the instructions to unlock it"
),
self.name,
self.api.model,
self.api.host[0],

View file

@ -836,7 +836,10 @@ async def ws_camera_web_rtc_offer(
connection.send_error(
msg["id"],
"web_rtc_offer_failed",
f"Camera does not support WebRTC, frontend_stream_type={camera.frontend_stream_type}",
(
"Camera does not support WebRTC,"
f" frontend_stream_type={camera.frontend_stream_type}"
),
)
return
try:

View file

@ -73,7 +73,8 @@ class CameraPreferences:
)
else:
raise HomeAssistantError(
"Orientation is only supported on entities set up through config flows"
"Orientation is only supported on entities set up through config"
" flows"
)
if dynamic_stream_settings:
dynamic_stream_settings.orientation = orientation

View file

@ -76,7 +76,10 @@ class ChromecastInfo:
)
_LOGGER.info(
"Fetched cast details for unknown model '%s' manufacturer: '%s', type: '%s'. Please %s",
(
"Fetched cast details for unknown model '%s' manufacturer:"
" '%s', type: '%s'. Please %s"
),
cast_info.model_name,
cast_info.manufacturer,
cast_info.cast_type,

View file

@ -16,7 +16,10 @@ from .const import DOMAIN, SIGNAL_HASS_CAST_SHOW_VIEW
SERVICE_SHOW_VIEW = "show_lovelace_view"
ATTR_VIEW_PATH = "view_path"
ATTR_URL_PATH = "dashboard_path"
NO_URL_AVAILABLE_ERROR = "Home Assistant Cast requires your instance to be reachable via HTTPS. Enable Home Assistant Cloud or set up an external URL with valid SSL certificates"
NO_URL_AVAILABLE_ERROR = (
"Home Assistant Cast requires your instance to be reachable via HTTPS. Enable Home"
" Assistant Cloud or set up an external URL with valid SSL certificates"
)
async def async_setup_ha_cast(

View file

@ -396,9 +396,11 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
url_description = f" from internal_url ({internal_url})"
_LOGGER.error(
(
"Failed to cast media %s%s. Please make sure the URL is: "
"Reachable from the cast device and either a publicly resolvable "
"hostname or an IP address",
"hostname or an IP address"
),
media_status.content_id,
url_description,
)

View file

@ -178,9 +178,11 @@ class CloudAlexaConfig(alexa_config.AbstractConfig):
if self.should_report_state:
persistent_notification.async_create(
self.hass,
f"There was an error reporting state to Alexa ({body['reason']}). "
"Please re-link your Alexa skill via the Alexa app to "
"continue using it.",
(
"There was an error reporting state to Alexa"
f" ({body['reason']}). Please re-link your Alexa skill via"
" the Alexa app to continue using it."
),
"Alexa state reporting disabled",
"cloud_alexa_report",
)

View file

@ -142,7 +142,10 @@ class CloudClient(Interface):
except aiohttp.ClientError as err: # If no internet available yet
if self._hass.is_running:
logging.getLogger(__package__).warning(
"Unable to activate Alexa Report State: %s. Retrying in 30 seconds",
(
"Unable to activate Alexa Report State: %s. Retrying in 30"
" seconds"
),
err,
)
async_call_later(self._hass, 30, enable_alexa)

View file

@ -386,8 +386,10 @@ async def websocket_update_prefs(
connection.send_error(
msg["id"],
"alexa_relink",
(
"Please go to the Alexa app and re-link the Home Assistant "
"skill and then try to enable state reporting.",
"skill and then try to enable state reporting."
),
)
await alexa_config.set_authorized(False)
return

View file

@ -91,7 +91,10 @@ class CloudProvider(Provider):
self, metadata: SpeechMetadata, stream: StreamReader
) -> SpeechResult:
"""Process an audio stream to STT service."""
content = f"audio/{metadata.format!s}; codecs=audio/{metadata.codec!s}; samplerate=16000"
content = (
f"audio/{metadata.format!s}; codecs=audio/{metadata.codec!s};"
" samplerate=16000"
)
# Process STT
try:

View file

@ -21,7 +21,10 @@ async def async_subscription_info(cloud: Cloud) -> dict[str, Any] | None:
return await cloud_api.async_subscription_info(cloud)
except asyncio.TimeoutError:
_LOGGER.error(
"A timeout of %s was reached while trying to fetch subscription information",
(
"A timeout of %s was reached while trying to fetch subscription"
" information"
),
REQUEST_TIMEOUT,
)
except ClientError:

View file

@ -75,8 +75,10 @@ async def async_setup_entry(
for currency in desired_currencies:
if currency not in provided_currencies:
_LOGGER.warning(
"The currency %s is no longer provided by your account, please check "
"your settings in Coinbase's developer tools",
(
"The currency %s is no longer provided by your account, please"
" check your settings in Coinbase's developer tools"
),
currency,
)
continue

View file

@ -104,7 +104,10 @@ async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
"""Handle call for URL based image."""
if not hass.config.is_allowed_external_url(url):
_LOGGER.error(
"External URL '%s' is not allowed, please add to 'allowlist_external_urls'",
(
"External URL '%s' is not allowed, please add to"
" 'allowlist_external_urls'"
),
url,
)
return None
@ -134,7 +137,10 @@ async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
"""Handle call for local file based image."""
if not hass.config.is_allowed_path(file_path):
_LOGGER.error(
"File path '%s' is not allowed, please add to 'allowlist_external_dirs'",
(
"File path '%s' is not allowed, please add to"
" 'allowlist_external_dirs'"
),
file_path,
)
return None

View file

@ -35,7 +35,8 @@ def datapoints_greater_than_degree(value: dict) -> dict:
"""Validate data point list is greater than polynomial degrees."""
if len(value[CONF_DATAPOINTS]) <= value[CONF_DEGREE]:
raise vol.Invalid(
f"{CONF_DATAPOINTS} must have at least {value[CONF_DEGREE]+1} {CONF_DATAPOINTS}"
f"{CONF_DATAPOINTS} must have at least"
f" {value[CONF_DEGREE]+1} {CONF_DATAPOINTS}"
)
return value

View file

@ -60,7 +60,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
raise ConfigEntryNotReady from exception
except BadCredentials as exception:
_LOGGER.error(
"Error authenticating with Control4 account API, incorrect username or password: %s",
(
"Error authenticating with Control4 account API, incorrect username or"
" password: %s"
),
exception,
)
return False

View file

@ -115,7 +115,10 @@ async def async_setup_entry(
director = entry_data[CONF_DIRECTOR]
item_variables = await director.getItemVariables(item_id)
_LOGGER.warning(
"Couldn't get light state data for %s, skipping setup. Available variables from Control4: %s",
(
"Couldn't get light state data for %s, skipping setup. Available"
" variables from Control4: %s"
),
item_name,
item_variables,
)

View file

@ -134,8 +134,10 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
devices = Discovery().poll(ip=discovery_info.host)
if not devices:
_LOGGER.debug(
"Could not find MAC-address for %s,"
" make sure the required UDP ports are open (see integration documentation)",
(
"Could not find MAC-address for %s, make sure the required UDP"
" ports are open (see integration documentation)"
),
discovery_info.host,
)
return self.async_abort(reason="cannot_connect")

View file

@ -185,7 +185,9 @@ def async_describe_events(
return {
LOGBOOK_ENTRY_NAME: name,
LOGBOOK_ENTRY_MESSAGE: f"'{ACTIONS[action]}' event for '{INTERFACES[interface]}' was fired",
LOGBOOK_ENTRY_MESSAGE: (
f"'{ACTIONS[action]}' event for '{INTERFACES[interface]}' was fired"
),
}
async_describe_event(

View file

@ -80,7 +80,9 @@ class DelugeEntity(CoordinatorEntity[DelugeDataUpdateCoordinator]):
super().__init__(coordinator)
self._server_unique_id = coordinator.config_entry.entry_id
self._attr_device_info = DeviceInfo(
configuration_url=f"http://{coordinator.api.host}:{coordinator.api.web_port}",
configuration_url=(
f"http://{coordinator.api.host}:{coordinator.api.web_port}"
),
entry_type=DeviceEntryType.SERVICE,
identifiers={(DOMAIN, coordinator.config_entry.entry_id)},
manufacturer=DEFAULT_NAME,

View file

@ -199,8 +199,10 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self._abort_if_unique_id_configured()
else:
_LOGGER.error(
(
"Could not get serial number of host %s, "
"unique_id's will not be available",
"unique_id's will not be available"
),
self.host,
)
self._async_abort_entries_match({CONF_HOST: self.host})

View file

@ -159,8 +159,10 @@ def async_log_errors(
available = False
if self.available:
_LOGGER.warning(
(
"Timeout connecting to Denon AVR receiver at host %s. "
"Device is unavailable",
"Device is unavailable"
),
self._receiver.host,
)
self._attr_available = False
@ -168,8 +170,10 @@ def async_log_errors(
available = False
if self.available:
_LOGGER.warning(
(
"Network error connecting to Denon AVR receiver at host %s. "
"Device is unavailable",
"Device is unavailable"
),
self._receiver.host,
)
self._attr_available = False
@ -177,9 +181,11 @@ def async_log_errors(
available = False
if self.available:
_LOGGER.warning(
(
"Denon AVR receiver at host %s responded with HTTP 403 error. "
"Device is unavailable. Please consider power cycling your "
"receiver",
"receiver"
),
self._receiver.host,
)
self._attr_available = False

View file

@ -51,7 +51,10 @@ class ConnectDenonAVR:
or self._receiver.receiver_type is None
):
_LOGGER.error(
"Missing receiver information: manufacturer '%s', name '%s', model '%s', type '%s'",
(
"Missing receiver information: manufacturer '%s', name '%s', model"
" '%s', type '%s'"
),
self._receiver.manufacturer,
self._receiver.name,
self._receiver.model_name,

View file

@ -379,8 +379,10 @@ def async_setup_scanner_platform(
"""Handle interval matches."""
if update_lock.locked():
LOGGER.warning(
(
"Updating device list from %s took longer than the scheduled "
"scan interval %s",
"scan interval %s"
),
platform,
interval,
)
@ -954,6 +956,6 @@ def get_gravatar_for_email(email: str) -> str:
"""
return (
f"https://www.gravatar.com/avatar/"
"https://www.gravatar.com/avatar/"
f"{hashlib.md5(email.encode('utf-8').lower()).hexdigest()}.jpg?s=80&d=wavatar"
)

View file

@ -106,7 +106,8 @@ async def async_handle_message(hass, message):
_api_version = get_api_version(message)
if _api_version is V1:
_LOGGER.warning(
"Dialogflow V1 API will be removed on October 23, 2019. Please change your DialogFlow settings to use the V2 api"
"Dialogflow V1 API will be removed on October 23, 2019. Please change your"
" DialogFlow settings to use the V2 api"
)
req = message.get("result")
if req.get("actionIncomplete", True):

View file

@ -127,7 +127,9 @@ class DiscogsSensor(SensorEntity):
return {
"cat_no": self._attrs["labels"][0]["catno"],
"cover_image": self._attrs["cover_image"],
"format": f"{self._attrs['formats'][0]['name']} ({self._attrs['formats'][0]['descriptions'][0]})",
"format": (
f"{self._attrs['formats'][0]['name']} ({self._attrs['formats'][0]['descriptions'][0]})"
),
"label": self._attrs["labels"][0]["name"],
"released": self._attrs["year"],
ATTR_IDENTITY: self._discogs_data["user"],
@ -146,7 +148,10 @@ class DiscogsSensor(SensorEntity):
random_record = collection.releases[random_index].release
self._attrs = random_record.data
return f"{random_record.data['artists'][0]['name']} - {random_record.data['title']}"
return (
f"{random_record.data['artists'][0]['name']} -"
f" {random_record.data['title']}"
)
return None

View file

@ -87,7 +87,10 @@ class DiscordNotificationService(BaseNotificationService):
if content_length is not None and int(content_length) > max_file_size:
_LOGGER.error(
"Attachment too large (Content-Length reports %s). Max size: %s bytes",
(
"Attachment too large (Content-Length reports %s). Max size: %s"
" bytes"
),
int(content_length),
max_file_size,
)

View file

@ -146,8 +146,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
for platform in enabled_platforms:
if platform in DEFAULT_ENABLED:
logger.warning(
(
"Please remove %s from your discovery.enable configuration "
"as it is now enabled by default",
"as it is now enabled by default"
),
platform,
)

View file

@ -297,7 +297,10 @@ class Doods(ImageProcessingEntity):
if self._aspect and abs((img_width / img_height) - self._aspect) > 0.1:
_LOGGER.debug(
"The image aspect: %s and the detector aspect: %s differ by more than 0.1",
(
"The image aspect: %s and the detector aspect: %s differ by more"
" than 0.1"
),
(img_width / img_height),
self._aspect,
)

View file

@ -175,10 +175,12 @@ async def _async_register_events(
except requests.exceptions.HTTPError:
persistent_notification.async_create(
hass,
(
"Doorbird configuration failed. Please verify that API "
"Operator permission is enabled for the Doorbird user. "
"A restart will be required once permissions have been "
"verified.",
"verified."
),
title="Doorbird Configuration Failure",
notification_id="doorbird_schedule_error",
)

View file

@ -181,11 +181,13 @@ async def async_setup_entry(
thermostat = data.ecobee.get_thermostat(index)
if not thermostat["modelNumber"] in ECOBEE_MODEL_TO_NAME:
_LOGGER.error(
(
"Model number for ecobee thermostat %s not recognized. "
"Please visit this link to open a new issue: "
"https://github.com/home-assistant/core/issues "
"and include the following information: "
"Unrecognized model number: %s",
"Unrecognized model number: %s"
),
thermostat["name"],
thermostat["modelNumber"],
)
@ -794,8 +796,10 @@ class Thermostat(ClimateEntity):
}
_LOGGER.debug(
"Creating a vacation on thermostat %s with name %s, cool temp %s, heat temp %s, "
"and the following other parameters: %s",
(
"Creating a vacation on thermostat %s with name %s, cool temp %s, heat"
" temp %s, and the following other parameters: %s"
),
self.name,
vacation_name,
cool_temp,

View file

@ -94,7 +94,8 @@ class EcobeeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
}
except (HomeAssistantError, KeyError):
_LOGGER.debug(
"No valid ecobee.conf configuration found for import, delegating to user step"
"No valid ecobee.conf configuration found for import, delegating to"
" user step"
)
return await self.async_step_user(
user_input={
@ -106,7 +107,8 @@ class EcobeeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
if await self.hass.async_add_executor_job(ecobee.refresh_tokens):
# Credentials found and validated; create the entry.
_LOGGER.debug(
"Valid ecobee configuration found for import, creating configuration entry"
"Valid ecobee configuration found for import, creating configuration"
" entry"
)
return self.async_create_entry(
title=DOMAIN,

View file

@ -137,7 +137,8 @@ class EcobeeHumidifier(HumidifierEntity):
"""Set humidifier mode (auto, off, manual)."""
if mode.lower() not in (self.available_modes):
raise ValueError(
f"Invalid mode value: {mode} Valid values are {', '.join(self.available_modes)}."
f"Invalid mode value: {mode} Valid values are"
f" {', '.join(self.available_modes)}."
)
self.data.ecobee.set_humidifier_mode(self.thermostat_index, mode)

View file

@ -101,8 +101,10 @@ def get_from_conf(config: dict[str, str], config_key: str, length: int) -> str |
string = config[config_key]
if len(string) != length:
_LOGGER.error(
(
"Error in configuration parameter %s: Must be exactly %d "
"bytes. Device will not be added",
"bytes. Device will not be added"
),
config_key,
length / 2,
)

View file

@ -145,8 +145,7 @@ class EgardiaAlarm(alarm.AlarmControlPanelEntity):
self._egardiasystem.alarm_arm_home()
except requests.exceptions.RequestException as err:
_LOGGER.error(
"Egardia device exception occurred when "
"sending arm home command: %s",
"Egardia device exception occurred when sending arm home command: %s",
err,
)
@ -156,7 +155,6 @@ class EgardiaAlarm(alarm.AlarmControlPanelEntity):
self._egardiasystem.alarm_arm_away()
except requests.exceptions.RequestException as err:
_LOGGER.error(
"Egardia device exception occurred when "
"sending arm away command: %s",
"Egardia device exception occurred when sending arm away command: %s",
err,
)

View file

@ -96,7 +96,8 @@ class ElmaxCoordinator(DataUpdateCoordinator[PanelStatus]):
# reconfigure it in order to make it work again
if not panel:
raise ConfigEntryAuthFailed(
f"Panel ID {self._panel_id} is no more linked to this user account"
f"Panel ID {self._panel_id} is no more linked to this user"
" account"
)
self._panel_entry = panel

View file

@ -290,8 +290,10 @@ class EmonCmsData:
self.data = req.json()
else:
_LOGGER.error(
(
"Please verify if the specified configuration value "
"'%s' is correct! (HTTP Status_code = %d)",
"'%s' is correct! (HTTP Status_code = %d)"
),
CONF_URL,
req.status_code,
)

View file

@ -480,7 +480,10 @@ async def _register_service(
)
service_desc = {
"description": f"Calls the service {service.name} of the node {entry_data.device_info.name}",
"description": (
f"Calls the service {service.name} of the node"
f" {entry_data.device_info.name}"
),
"fields": fields,
}
@ -706,10 +709,7 @@ class EsphomeEntity(Entity, Generic[_InfoT, _StateT]):
self.async_on_remove(
async_dispatcher_connect(
self.hass,
(
f"esphome_{self._entry_id}_remove_"
f"{self._component_key}_{self._key}"
),
f"esphome_{self._entry_id}_remove_{self._component_key}_{self._key}",
functools.partial(self.async_remove, force_remove=True),
)
)

View file

@ -33,7 +33,10 @@ def _async_can_connect_factory(
"""Check if a given source can make another connection."""
can_connect = bool(entry_data.available and entry_data.ble_connections_free)
_LOGGER.debug(
"%s [%s]: Checking can connect, available=%s, ble_connections_free=%s result=%s",
(
"%s [%s]: Checking can connect, available=%s, ble_connections_free=%s"
" result=%s"
),
entry_data.name,
source,
entry_data.available,

View file

@ -168,7 +168,10 @@ class ESPHomeClient(BaseBleakClient):
self._cancel_connection_state()
except (AssertionError, ValueError) as ex:
_LOGGER.debug(
"%s: %s - %s: Failed to unsubscribe from connection state (likely connection dropped): %s",
(
"%s: %s - %s: Failed to unsubscribe from connection state (likely"
" connection dropped): %s"
),
self._source_name,
self._ble_device.name,
self._ble_device.address,
@ -278,7 +281,8 @@ class ESPHomeClient(BaseBleakClient):
)
connected_future.set_exception(
BleakError(
f"Error {ble_connection_error_name} while connecting: {human_error}"
f"Error {ble_connection_error_name} while connecting:"
f" {human_error}"
)
)
return
@ -587,7 +591,8 @@ class ESPHomeClient(BaseBleakClient):
and "indicate" not in characteristic.properties
):
raise BleakError(
f"Characteristic {characteristic.uuid} does not have notify or indicate property set."
f"Characteristic {characteristic.uuid} does not have notify or indicate"
" property set."
)
self._notify_cancels[
@ -614,7 +619,10 @@ class ESPHomeClient(BaseBleakClient):
)
_LOGGER.debug(
"%s: %s - %s: Writing to CCD descriptor %s for notifications with properties=%s",
(
"%s: %s - %s: Writing to CCD descriptor %s for notifications with"
" properties=%s"
),
self._source_name,
self._ble_device.name,
self._ble_device.address,
@ -652,7 +660,10 @@ class ESPHomeClient(BaseBleakClient):
"""Destructor to make sure the connection state is unsubscribed."""
if self._cancel_connection_state:
_LOGGER.warning(
"%s: %s - %s: ESPHomeClient bleak client was not properly disconnected before destruction",
(
"%s: %s - %s: ESPHomeClient bleak client was not properly"
" disconnected before destruction"
),
self._source_name,
self._ble_device.name,
self._ble_device.address,

View file

@ -146,19 +146,23 @@ def _handle_exception(err) -> None:
except evohomeasync2.AuthenticationError:
_LOGGER.error(
"Failed to authenticate with the vendor's server. "
"Check your username and password. NB: Some special password characters "
"that work correctly via the website will not work via the web API. "
"Message is: %s",
(
"Failed to authenticate with the vendor's server. Check your username"
" and password. NB: Some special password characters that work"
" correctly via the website will not work via the web API. Message"
" is: %s"
),
err,
)
except aiohttp.ClientConnectionError:
# this appears to be a common occurrence with the vendor's servers
_LOGGER.warning(
(
"Unable to connect with the vendor's server. "
"Check your network and the vendor's service status page. "
"Message is: %s",
"Message is: %s"
),
err,
)
@ -171,8 +175,10 @@ def _handle_exception(err) -> None:
elif err.status == HTTPStatus.TOO_MANY_REQUESTS:
_LOGGER.warning(
(
"The vendor's API rate limit has been exceeded. "
"If this message persists, consider increasing the %s",
"If this message persists, consider increasing the %s"
),
CONF_SCAN_INTERVAL,
)
@ -224,8 +230,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
loc_config = client_v2.installation_info[loc_idx]
except IndexError:
_LOGGER.error(
(
"Config error: '%s' = %s, but the valid range is 0-%s. "
"Unable to continue. Fix any configuration errors and restart HA",
"Unable to continue. Fix any configuration errors and restart HA"
),
CONF_LOCATION_IDX,
loc_idx,
len(client_v2.installation_info) - 1,
@ -469,10 +477,12 @@ class EvoBroker:
except aiohttp.ClientError as err:
_LOGGER.warning(
(
"Unable to obtain the latest high-precision temperatures. "
"Check your network and the vendor's service status page. "
"Proceeding with low-precision temperatures. "
"Message is: %s",
"Message is: %s"
),
err,
)
self.temps = None # these are now stale, will fall back to v2 temps

View file

@ -112,8 +112,10 @@ async def async_setup_platform(
else:
_LOGGER.warning(
(
"Ignoring: %s (%s), id=%s, name=%s: unknown/invalid zone type, "
"report as an issue if you feel this zone type should be supported",
"report as an issue if you feel this zone type should be supported"
),
zone.zoneType,
zone.modelType,
zone.zoneId,

View file

@ -108,7 +108,10 @@ async def async_setup_entry(
)
_LOGGER.warning(
"Found camera with serial %s without configuration. Please go to integration to complete setup",
(
"Found camera with serial %s without configuration. Please go to"
" integration to complete setup"
),
camera,
)

View file

@ -244,7 +244,8 @@ class FanEntity(ToggleEntity):
preset_modes = self.preset_modes
if not preset_modes or preset_mode not in preset_modes:
raise NotValidPresetModeError(
f"The preset_mode {preset_mode} is not a valid preset_mode: {preset_modes}"
f"The preset_mode {preset_mode} is not a valid preset_mode:"
f" {preset_modes}"
)
def set_direction(self, direction: str) -> None:

View file

@ -217,11 +217,13 @@ class FibaroThermostat(FibaroDevice, ClimateEntity):
async def async_added_to_hass(self) -> None:
"""Call when entity is added to hass."""
_LOGGER.debug(
(
"Climate %s\n"
"- _temp_sensor_device %s\n"
"- _target_temp_device %s\n"
"- _op_mode_device %s\n"
"- _fan_mode_device %s",
"- _fan_mode_device %s"
),
self.ha_id,
self._temp_sensor_device.ha_id if self._temp_sensor_device else "None",
self._target_temp_device.ha_id if self._target_temp_device else "None",

View file

@ -57,7 +57,10 @@ class FileNotificationService(BaseNotificationService):
filepath: str = os.path.join(self.hass.config.config_dir, self.filename)
with open(filepath, "a", encoding="utf8") as file:
if os.stat(filepath).st_size == 0:
title = f"{kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)} notifications (Log started: {dt_util.utcnow().isoformat()})\n{'-' * 80}\n"
title = (
f"{kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)} notifications (Log"
f" started: {dt_util.utcnow().isoformat()})\n{'-' * 80}\n"
)
file.write(title)
if self.add_timestamp:

View file

@ -92,8 +92,7 @@ class FirmataBoard:
)
except RuntimeError as err:
_LOGGER.error(
"Error setting sampling interval for PyMata \
board %s: %s",
"Error setting sampling interval for PyMata board %s: %s",
self.name,
err,
)

View file

@ -277,8 +277,10 @@ CORE_CONFIG_SCHEMA = vol.All(
{
CONF_TYPE: vol.NotIn(
["insecure_example"],
(
"The insecure_example auth provider"
" is for testing only.",
" is for testing only."
),
)
}
)
@ -900,7 +902,10 @@ async def async_process_component_config( # noqa: C901
continue
except Exception: # pylint: disable=broad-except
_LOGGER.exception(
"Unknown error validating %s platform config with %s component platform schema",
(
"Unknown error validating %s platform config with %s component"
" platform schema"
),
p_name,
domain,
)
@ -940,7 +945,10 @@ async def async_process_component_config( # noqa: C901
continue
except Exception: # pylint: disable=broad-except
_LOGGER.exception(
"Unknown error validating config for %s platform for %s component with PLATFORM_SCHEMA",
(
"Unknown error validating config for %s platform for %s"
" component with PLATFORM_SCHEMA"
),
p_name,
domain,
)

View file

@ -278,9 +278,11 @@ class ConfigEntry:
disabled_by, ConfigEntryDisabler
):
report( # type: ignore[unreachable]
(
"uses str for config entry disabled_by. This is deprecated and will"
"stop working in Home Assistant 2022.3, it should be updated to use "
"ConfigEntryDisabler instead",
" stop working in Home Assistant 2022.3, it should be updated to"
" use ConfigEntryDisabler instead"
),
error_if_core=False,
)
disabled_by = ConfigEntryDisabler(disabled_by)
@ -353,7 +355,10 @@ class ConfigEntry:
integration.get_platform("config_flow")
except ImportError as err:
_LOGGER.error(
"Error importing platform config_flow from integration %s to set up %s configuration entry: %s",
(
"Error importing platform config_flow from integration %s to"
" set up %s configuration entry: %s"
),
integration.domain,
self.domain,
err,
@ -410,14 +415,20 @@ class ConfigEntry:
ready_message = f"ready yet: {message}" if message else "ready yet"
if tries == 1:
_LOGGER.warning(
"Config entry '%s' for %s integration not %s; Retrying in background",
(
"Config entry '%s' for %s integration not %s; Retrying in"
" background"
),
self.title,
self.domain,
ready_message,
)
else:
_LOGGER.debug(
"Config entry '%s' for %s integration not %s; Retrying in %d seconds",
(
"Config entry '%s' for %s integration not %s; Retrying in %d"
" seconds"
),
self.title,
self.domain,
ready_message,
@ -1065,8 +1076,9 @@ class ConfigEntries:
if entry.state is not ConfigEntryState.NOT_LOADED:
raise OperationNotAllowed(
f"The config entry {entry.title} ({entry.domain}) with entry_id {entry.entry_id}"
f" cannot be setup because is already loaded in the {entry.state} state"
f"The config entry {entry.title} ({entry.domain}) with entry_id"
f" {entry.entry_id} cannot be setup because is already loaded in the"
f" {entry.state} state"
)
# Setup Component if not set up yet
@ -1091,7 +1103,8 @@ class ConfigEntries:
if not entry.state.recoverable:
raise OperationNotAllowed(
f"The config entry {entry.title} ({entry.domain}) with entry_id"
f"{entry.entry_id} cannot be unloaded because it is not in a recoverable state ({entry.state})"
f" {entry.entry_id} cannot be unloaded because it is not in a"
f" recoverable state ({entry.state})"
)
return await entry.async_unload(self.hass)
@ -1126,9 +1139,11 @@ class ConfigEntries:
disabled_by, ConfigEntryDisabler
):
report( # type: ignore[unreachable]
(
"uses str for config entry disabled_by. This is deprecated and will"
"stop working in Home Assistant 2022.3, it should be updated to use "
"ConfigEntryDisabler instead",
" stop working in Home Assistant 2022.3, it should be updated to"
" use ConfigEntryDisabler instead"
),
error_if_core=False,
)
disabled_by = ConfigEntryDisabler(disabled_by)
@ -1225,8 +1240,10 @@ class ConfigEntries:
) -> None:
"""Forward the setup of an entry to platforms."""
report(
"called async_setup_platforms instead of awaiting async_forward_entry_setups; "
"this will fail in version 2022.12",
(
"called async_setup_platforms instead of awaiting"
" async_forward_entry_setups; this will fail in version 2022.12"
),
# Raise this to warning once all core integrations have been migrated
level=logging.DEBUG,
error_if_core=False,
@ -1777,7 +1794,10 @@ class EntityRegistryDisabledHandler:
self.changed = set()
_LOGGER.info(
"Reloading configuration entries because disabled_by changed in entity registry: %s",
(
"Reloading configuration entries because disabled_by changed in entity"
" registry: %s"
),
", ".join(to_reload),
)

View file

@ -357,9 +357,12 @@ class HomeAssistant:
await self.async_block_till_done()
except asyncio.TimeoutError:
_LOGGER.warning(
"Something is blocking Home Assistant from wrapping up the "
"start up phase. We're going to continue anyway. Please "
"report the following info at https://github.com/home-assistant/core/issues: %s",
(
"Something is blocking Home Assistant from wrapping up the start up"
" phase. We're going to continue anyway. Please report the"
" following info at"
" https://github.com/home-assistant/core/issues: %s"
),
", ".join(self.config.components),
)
@ -705,7 +708,8 @@ class HomeAssistant:
await self.async_block_till_done()
except asyncio.TimeoutError:
_LOGGER.warning(
"Timed out waiting for shutdown stage 1 to complete, the shutdown will continue"
"Timed out waiting for shutdown stage 1 to complete, the shutdown will"
" continue"
)
# stage 2
@ -716,7 +720,8 @@ class HomeAssistant:
await self.async_block_till_done()
except asyncio.TimeoutError:
_LOGGER.warning(
"Timed out waiting for shutdown stage 2 to complete, the shutdown will continue"
"Timed out waiting for shutdown stage 2 to complete, the shutdown will"
" continue"
)
# stage 3
@ -735,7 +740,8 @@ class HomeAssistant:
await self.async_block_till_done()
except asyncio.TimeoutError:
_LOGGER.warning(
"Timed out waiting for shutdown stage 3 to complete, the shutdown will continue"
"Timed out waiting for shutdown stage 3 to complete, the shutdown will"
" continue"
)
self.exit_code = exit_code
@ -825,7 +831,10 @@ class Event:
def __repr__(self) -> str:
"""Return the representation."""
if self.data:
return f"<Event {self.event_type}[{str(self.origin)[0]}]: {util.repr_helper(self.data)}>"
return (
f"<Event {self.event_type}[{str(self.origin)[0]}]:"
f" {util.repr_helper(self.data)}>"
)
return f"<Event {self.event_type}[{str(self.origin)[0]}]>"
@ -1419,7 +1428,8 @@ class StateMachine:
entity_id = entity_id.lower()
if entity_id in self._states or entity_id in self._reservations:
raise HomeAssistantError(
"async_reserve must not be called once the state is in the state machine."
"async_reserve must not be called once the state is in the state"
" machine."
)
self._reservations.add(entity_id)

View file

@ -308,7 +308,8 @@ class FlowManager(abc.ABC):
FlowResultType.SHOW_PROGRESS_DONE,
):
raise ValueError(
"Show progress can only transition to show progress or show progress done."
"Show progress can only transition to show progress or show"
" progress done."
)
# If the result has changed from last result, fire event to update
@ -386,8 +387,10 @@ class FlowManager(abc.ABC):
if not isinstance(result["type"], FlowResultType):
result["type"] = FlowResultType(result["type"]) # type: ignore[unreachable]
report(
(
"does not use FlowResultType enum for data entry flow result type. "
"This is deprecated and will stop working in Home Assistant 2022.9",
"This is deprecated and will stop working in Home Assistant 2022.9"
),
error_if_core=False,
)

View file

@ -318,7 +318,11 @@ def async_process_zeroconf_match_dict(entry: dict[str, Any]) -> dict[str, Any]:
for moved_prop in MOVED_ZEROCONF_PROPS:
if value := entry_without_type.pop(moved_prop, None):
_LOGGER.warning(
'Matching the zeroconf property "%s" at top-level is deprecated and should be moved into a properties dict; Check the developer documentation',
(
'Matching the zeroconf property "%s" at top-level is deprecated and'
" should be moved into a properties dict; Check the developer"
" documentation"
),
moved_prop,
)
if "properties" not in entry_without_type:
@ -489,9 +493,12 @@ class Integration:
_LOGGER.warning(CUSTOM_WARNING, integration.domain)
if integration.version is None:
_LOGGER.error(
"The custom integration '%s' does not have a "
"version key in the manifest file and was blocked from loading. "
"See https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions for more details",
(
"The custom integration '%s' does not have a version key in the"
" manifest file and was blocked from loading. See"
" https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions"
" for more details"
),
integration.domain,
)
return None
@ -508,9 +515,12 @@ class Integration:
)
except AwesomeVersionException:
_LOGGER.error(
"The custom integration '%s' does not have a "
"valid version key (%s) in the manifest file and was blocked from loading. "
"See https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions for more details",
(
"The custom integration '%s' does not have a valid version key"
" (%s) in the manifest file and was blocked from loading. See"
" https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions"
" for more details"
),
integration.domain,
integration.version,
)
@ -683,14 +693,20 @@ class Integration:
self._all_dependencies_resolved = True
except IntegrationNotFound as err:
_LOGGER.error(
"Unable to resolve dependencies for %s: we are unable to resolve (sub)dependency %s",
(
"Unable to resolve dependencies for %s: we are unable to resolve"
" (sub)dependency %s"
),
self.domain,
err.domain,
)
self._all_dependencies_resolved = False
except CircularDependency as err:
_LOGGER.error(
"Unable to resolve dependencies for %s: it contains a circular dependency: %s -> %s",
(
"Unable to resolve dependencies for %s: it contains a circular"
" dependency: %s -> %s"
),
self.domain,
err.from_domain,
err.to_domain,
@ -919,7 +935,7 @@ def _load_file(
if str(err) not in white_listed_errors:
_LOGGER.exception(
("Error loading %s. Make sure all dependencies are installed"), path
"Error loading %s. Make sure all dependencies are installed", path
)
return None

View file

@ -261,7 +261,10 @@ class RequirementsManager:
for req in missing:
if req in self.install_failure_history:
_LOGGER.info(
"Multiple attempts to install %s failed, install will be retried after next configuration check or restart",
(
"Multiple attempts to install %s failed, install will be"
" retried after next configuration check or restart"
),
req,
)
raise RequirementsNotFound(integration, [req])

View file

@ -253,8 +253,10 @@ async def _async_setup_component(
result = await task
except asyncio.TimeoutError:
_LOGGER.error(
(
"Setup of %s is taking longer than %s seconds."
" Startup will proceed without waiting any longer",
" Startup will proceed without waiting any longer"
),
domain,
SLOW_SETUP_MAX_WAIT,
)