diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py
index e43e1645c0f..5b4b3afb3d9 100644
--- a/homeassistant/components/recorder/migration.py
+++ b/homeassistant/components/recorder/migration.py
@@ -660,8 +660,8 @@ def _apply_update( # noqa: C901
# Using LOCK=EXCLUSIVE to prevent the database from corrupting
# https://github.com/home-assistant/core/issues/56104
text(
- f"ALTER TABLE {table} CONVERT TO "
- "CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, LOCK=EXCLUSIVE"
+ f"ALTER TABLE {table} CONVERT TO CHARACTER SET utf8mb4"
+ " COLLATE utf8mb4_unicode_ci, LOCK=EXCLUSIVE"
)
)
elif new_version == 22:
diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py
index f4738334745..32be8cbd935 100644
--- a/homeassistant/components/telegram_bot/__init__.py
+++ b/homeassistant/components/telegram_bot/__init__.py
@@ -1008,7 +1008,10 @@ class BaseTelegramBotEntity:
if from_user in self.allowed_chat_ids or from_chat in self.allowed_chat_ids:
return True
_LOGGER.error(
- "Unauthorized update - neither user id %s nor chat id %s is in allowed chats: %s",
+ (
+ "Unauthorized update - neither user id %s nor chat id %s is in allowed"
+ " chats: %s"
+ ),
from_user,
from_chat,
self.allowed_chat_ids,
diff --git a/homeassistant/components/template/config.py b/homeassistant/components/template/config.py
index 51755bfd0d3..77eaec13da5 100644
--- a/homeassistant/components/template/config.py
+++ b/homeassistant/components/template/config.py
@@ -92,7 +92,8 @@ async def async_validate_config(hass, config):
if not legacy_warn_printed:
legacy_warn_printed = True
logging.getLogger(__name__).warning(
- "The entity definition format under template: differs from the platform "
+ "The entity definition format under template: differs from the"
+ " platform "
"configuration format. See "
"https://www.home-assistant.io/integrations/template#configuration-for-trigger-based-template-sensors"
)
diff --git a/homeassistant/components/template/light.py b/homeassistant/components/template/light.py
index 27dcbf0e014..b403034208a 100644
--- a/homeassistant/components/template/light.py
+++ b/homeassistant/components/template/light.py
@@ -474,7 +474,10 @@ class LightTemplate(TemplateEntity, LightEntity):
if not isinstance(effect_list, list):
_LOGGER.error(
- "Received invalid effect list: %s for entity %s. Expected list of strings",
+ (
+ "Received invalid effect list: %s for entity %s. Expected list of"
+ " strings"
+ ),
effect_list,
self.entity_id,
)
@@ -545,7 +548,10 @@ class LightTemplate(TemplateEntity, LightEntity):
self._temperature = temperature
else:
_LOGGER.error(
- "Received invalid color temperature : %s for entity %s. Expected: %s-%s",
+ (
+ "Received invalid color temperature : %s for entity %s."
+ " Expected: %s-%s"
+ ),
temperature,
self.entity_id,
self.min_mireds,
@@ -554,7 +560,10 @@ class LightTemplate(TemplateEntity, LightEntity):
self._temperature = None
except ValueError:
_LOGGER.error(
- "Template must supply an integer temperature within the range for this light, or 'None'",
+ (
+ "Template must supply an integer temperature within the range for"
+ " this light, or 'None'"
+ ),
exc_info=True,
)
self._temperature = None
@@ -586,7 +595,10 @@ class LightTemplate(TemplateEntity, LightEntity):
self._color = (h_str, s_str)
elif h_str is not None and s_str is not None:
_LOGGER.error(
- "Received invalid hs_color : (%s, %s) for entity %s. Expected: (0-360, 0-100)",
+ (
+ "Received invalid hs_color : (%s, %s) for entity %s. Expected:"
+ " (0-360, 0-100)"
+ ),
h_str,
s_str,
self.entity_id,
@@ -609,7 +621,10 @@ class LightTemplate(TemplateEntity, LightEntity):
self._max_mireds = int(render)
except ValueError:
_LOGGER.error(
- "Template must supply an integer temperature within the range for this light, or 'None'",
+ (
+ "Template must supply an integer temperature within the range for"
+ " this light, or 'None'"
+ ),
exc_info=True,
)
self._max_mireds = None
@@ -624,7 +639,10 @@ class LightTemplate(TemplateEntity, LightEntity):
self._min_mireds = int(render)
except ValueError:
_LOGGER.error(
- "Template must supply an integer temperature within the range for this light, or 'None'",
+ (
+ "Template must supply an integer temperature within the range for"
+ " this light, or 'None'"
+ ),
exc_info=True,
)
self._min_mireds = None
diff --git a/homeassistant/components/template/sensor.py b/homeassistant/components/template/sensor.py
index b52953c1a8a..a7f78ad1804 100644
--- a/homeassistant/components/template/sensor.py
+++ b/homeassistant/components/template/sensor.py
@@ -99,8 +99,9 @@ def extra_validation_checks(val):
"""Run extra validation checks."""
if CONF_TRIGGER in val:
raise vol.Invalid(
- "You can only add triggers to template entities if they are defined under `template:`. "
- "See the template documentation for more information: https://www.home-assistant.io/integrations/template/"
+ "You can only add triggers to template entities if they are defined under"
+ " `template:`. See the template documentation for more information:"
+ " https://www.home-assistant.io/integrations/template/"
)
if CONF_SENSORS not in val and SENSOR_DOMAIN not in val:
diff --git a/homeassistant/components/tesla_wall_connector/__init__.py b/homeassistant/components/tesla_wall_connector/__init__.py
index b1d5811c610..179576334a9 100644
--- a/homeassistant/components/tesla_wall_connector/__init__.py
+++ b/homeassistant/components/tesla_wall_connector/__init__.py
@@ -62,7 +62,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
) from ex
except WallConnectorConnectionError as ex:
raise UpdateFailed(
- f"Could not fetch data from Tesla WallConnector at {hostname}: Cannot connect"
+ f"Could not fetch data from Tesla WallConnector at {hostname}: Cannot"
+ " connect"
) from ex
except WallConnectorError as ex:
raise UpdateFailed(
diff --git a/homeassistant/components/text/__init__.py b/homeassistant/components/text/__init__.py
index 32054734e8e..1cd980e71cc 100644
--- a/homeassistant/components/text/__init__.py
+++ b/homeassistant/components/text/__init__.py
@@ -65,7 +65,8 @@ async def _async_set_value(entity: TextEntity, service_call: ServiceCall) -> Non
value = service_call.data[ATTR_VALUE]
if len(value) < entity.min:
raise ValueError(
- f"Value {value} for {entity.name} is too short (minimum length {entity.min})"
+ f"Value {value} for {entity.name} is too short (minimum length"
+ f" {entity.min})"
)
if len(value) > entity.max:
raise ValueError(
diff --git a/homeassistant/components/tmb/sensor.py b/homeassistant/components/tmb/sensor.py
index 64505943f8d..dd94b4c11b7 100644
--- a/homeassistant/components/tmb/sensor.py
+++ b/homeassistant/components/tmb/sensor.py
@@ -124,5 +124,6 @@ class TMBSensor(SensorEntity):
self._state = self._ibus_client.get_stop_forecast(self._stop, self._line)
except HTTPError:
_LOGGER.error(
- "Unable to fetch data from TMB API. Please check your API keys are valid"
+ "Unable to fetch data from TMB API. Please check your API keys are"
+ " valid"
)
diff --git a/homeassistant/components/tplink/config_flow.py b/homeassistant/components/tplink/config_flow.py
index 8b05f90041a..a783c7b902f 100644
--- a/homeassistant/components/tplink/config_flow.py
+++ b/homeassistant/components/tplink/config_flow.py
@@ -115,7 +115,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
}
self._discovered_devices = await async_discover_devices(self.hass)
devices_name = {
- formatted_mac: f"{device.alias} {device.model} ({device.host}) {formatted_mac}"
+ formatted_mac: (
+ f"{device.alias} {device.model} ({device.host}) {formatted_mac}"
+ )
for formatted_mac, device in self._discovered_devices.items()
if formatted_mac not in configured_devices
}
diff --git a/homeassistant/components/tractive/__init__.py b/homeassistant/components/tractive/__init__.py
index cc0b2b2b6cb..96fc718c67d 100644
--- a/homeassistant/components/tractive/__init__.py
+++ b/homeassistant/components/tractive/__init__.py
@@ -226,7 +226,10 @@ class TractiveClient:
except aiotractive.exceptions.TractiveError:
_LOGGER.debug(
- "Tractive is not available. Internet connection is down? Sleeping %i seconds and retrying",
+ (
+ "Tractive is not available. Internet connection is down?"
+ " Sleeping %i seconds and retrying"
+ ),
RECONNECT_INTERVAL.total_seconds(),
)
self._last_hw_time = 0
diff --git a/homeassistant/components/trafikverket_train/__init__.py b/homeassistant/components/trafikverket_train/__init__.py
index c1c756be9ed..0bedb7141c6 100644
--- a/homeassistant/components/trafikverket_train/__init__.py
+++ b/homeassistant/components/trafikverket_train/__init__.py
@@ -25,7 +25,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if "Invalid authentication" in error.args[0]:
raise ConfigEntryAuthFailed from error
raise ConfigEntryNotReady(
- f"Problem when trying station {entry.data[CONF_FROM]} to {entry.data[CONF_TO]}. Error: {error} "
+ f"Problem when trying station {entry.data[CONF_FROM]} to"
+ f" {entry.data[CONF_TO]}. Error: {error} "
) from error
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {
diff --git a/homeassistant/components/travisci/sensor.py b/homeassistant/components/travisci/sensor.py
index f9060332837..b33f7315d17 100644
--- a/homeassistant/components/travisci/sensor.py
+++ b/homeassistant/components/travisci/sensor.py
@@ -106,9 +106,7 @@ def setup_platform(
_LOGGER.error("Unable to connect to Travis CI service: %s", str(ex))
persistent_notification.create(
hass,
- "Error: {}
"
- "You will need to restart hass after fixing."
- "".format(ex),
+ f"Error: {ex}
You will need to restart hass after fixing.",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
)
diff --git a/homeassistant/components/tts/__init__.py b/homeassistant/components/tts/__init__.py
index 5914512a315..c07df07ae4f 100644
--- a/homeassistant/components/tts/__init__.py
+++ b/homeassistant/components/tts/__init__.py
@@ -158,7 +158,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
base_url = conf.get(CONF_BASE_URL)
if base_url is not None:
_LOGGER.warning(
- "TTS base_url option is deprecated. Configure internal/external URL instead"
+ "TTS base_url option is deprecated. Configure internal/external URL"
+ " instead"
)
hass.data[BASE_URL_KEY] = base_url
@@ -241,7 +242,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
# Register the service description
service_desc = {
CONF_NAME: f"Say a TTS message with {p_type}",
- CONF_DESCRIPTION: f"Say something using text-to-speech on a media player with {p_type}.",
+ CONF_DESCRIPTION: (
+ f"Say something using text-to-speech on a media player with {p_type}."
+ ),
CONF_FIELDS: services_dict[SERVICE_SAY][CONF_FIELDS],
}
async_set_service_schema(hass, DOMAIN, service_name, service_desc)
diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py
index 1dce6ddad92..64151195b01 100644
--- a/homeassistant/components/tuya/climate.py
+++ b/homeassistant/components/tuya/climate.py
@@ -341,7 +341,8 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
"""Set new target temperature."""
if self._set_temperature is None:
raise RuntimeError(
- "Cannot set target temperature, device doesn't provide methods to set it"
+ "Cannot set target temperature, device doesn't provide methods to"
+ " set it"
)
self._send_command(
diff --git a/homeassistant/components/ubus/device_tracker.py b/homeassistant/components/ubus/device_tracker.py
index 10a8ad61621..3c4c9fe1b9c 100644
--- a/homeassistant/components/ubus/device_tracker.py
+++ b/homeassistant/components/ubus/device_tracker.py
@@ -58,8 +58,7 @@ def _refresh_on_access_denied(func):
return func(self, *args, **kwargs)
except PermissionError:
_LOGGER.warning(
- "Invalid session detected."
- " Trying to refresh session_id and re-run RPC"
+ "Invalid session detected. Trying to refresh session_id and re-run RPC"
)
self.ubus.connect()
diff --git a/homeassistant/components/unifiprotect/const.py b/homeassistant/components/unifiprotect/const.py
index de9911e7d7b..3bc689666c7 100644
--- a/homeassistant/components/unifiprotect/const.py
+++ b/homeassistant/components/unifiprotect/const.py
@@ -48,7 +48,10 @@ DEVICES_WITH_ENTITIES = DEVICES_THAT_ADOPT | {ModelType.NVR}
DEVICES_FOR_SUBSCRIBE = DEVICES_WITH_ENTITIES | {ModelType.EVENT}
MIN_REQUIRED_PROTECT_V = Version("1.20.0")
-OUTDATED_LOG_MESSAGE = "You are running v%s of UniFi Protect. Minimum required version is v%s. Please upgrade UniFi Protect and then retry"
+OUTDATED_LOG_MESSAGE = (
+ "You are running v%s of UniFi Protect. Minimum required version is v%s. Please"
+ " upgrade UniFi Protect and then retry"
+)
TYPE_EMPTY_VALUE = ""
diff --git a/homeassistant/components/unifiprotect/data.py b/homeassistant/components/unifiprotect/data.py
index 20b5747a342..5db0941549b 100644
--- a/homeassistant/components/unifiprotect/data.py
+++ b/homeassistant/components/unifiprotect/data.py
@@ -240,7 +240,8 @@ class ProtectData:
# alert user viewport needs restart so voice clients can get new options
elif len(self.api.bootstrap.viewers) > 0 and isinstance(obj, Liveview):
_LOGGER.warning(
- "Liveviews updated. Restart Home Assistant to update Viewport select options"
+ "Liveviews updated. Restart Home Assistant to update Viewport select"
+ " options"
)
@callback
diff --git a/homeassistant/components/unifiprotect/migrate.py b/homeassistant/components/unifiprotect/migrate.py
index 893ca3e458a..308e9903f89 100644
--- a/homeassistant/components/unifiprotect/migrate.py
+++ b/homeassistant/components/unifiprotect/migrate.py
@@ -146,7 +146,10 @@ async def async_migrate_device_ids(
registry.async_update_entity(entity.entity_id, new_unique_id=new_unique_id)
except ValueError as err:
_LOGGER.warning(
- "Could not migrate entity %s (old unique_id: %s, new unique_id: %s): %s",
+ (
+ "Could not migrate entity %s (old unique_id: %s, new unique_id:"
+ " %s): %s"
+ ),
entity.entity_id,
entity.unique_id,
new_unique_id,
diff --git a/homeassistant/components/upcloud/const.py b/homeassistant/components/upcloud/const.py
index 62aeb75d3dd..763462c37f4 100644
--- a/homeassistant/components/upcloud/const.py
+++ b/homeassistant/components/upcloud/const.py
@@ -4,4 +4,4 @@ from datetime import timedelta
DOMAIN = "upcloud"
DEFAULT_SCAN_INTERVAL = timedelta(seconds=60)
-CONFIG_ENTRY_UPDATE_SIGNAL_TEMPLATE = f"{DOMAIN}_config_entry_update:" "{}"
+CONFIG_ENTRY_UPDATE_SIGNAL_TEMPLATE = f"{DOMAIN}_config_entry_update:{{}}"
diff --git a/homeassistant/components/venstar/climate.py b/homeassistant/components/venstar/climate.py
index 1d310052327..b4d3b6c6837 100644
--- a/homeassistant/components/venstar/climate.py
+++ b/homeassistant/components/venstar/climate.py
@@ -291,8 +291,10 @@ class VenstarThermostat(VenstarEntity, ClimateEntity):
else:
success = False
_LOGGER.error(
- "The thermostat is currently not in a mode "
- "that supports target temperature: %s",
+ (
+ "The thermostat is currently not in a mode "
+ "that supports target temperature: %s"
+ ),
operation_mode,
)
diff --git a/homeassistant/components/vesync/light.py b/homeassistant/components/vesync/light.py
index 57329c0973e..3837ab1019c 100644
--- a/homeassistant/components/vesync/light.py
+++ b/homeassistant/components/vesync/light.py
@@ -156,7 +156,10 @@ class VeSyncTunableWhiteLightHA(VeSyncBaseLight, LightEntity):
except ValueError:
# deal if any unexpected/non numeric value
_LOGGER.debug(
- "VeSync - received unexpected 'color_temp_pct' value from pyvesync api: %s",
+ (
+ "VeSync - received unexpected 'color_temp_pct' value from pyvesync"
+ " api: %s"
+ ),
result,
)
return 0
diff --git a/homeassistant/components/vivotek/camera.py b/homeassistant/components/vivotek/camera.py
index 46cf2586c34..a61897f996e 100644
--- a/homeassistant/components/vivotek/camera.py
+++ b/homeassistant/components/vivotek/camera.py
@@ -68,7 +68,9 @@ def setup_platform(
digest_auth=config[CONF_AUTHENTICATION] == HTTP_DIGEST_AUTHENTICATION,
sec_lvl=config[CONF_SECURITY_LEVEL],
),
- "stream_source": f"rtsp://{creds}@{config[CONF_IP_ADDRESS]}:554/{config[CONF_STREAM_PATH]}",
+ "stream_source": (
+ f"rtsp://{creds}@{config[CONF_IP_ADDRESS]}:554/{config[CONF_STREAM_PATH]}"
+ ),
}
add_entities([VivotekCam(**args)], True)
diff --git a/homeassistant/components/vizio/__init__.py b/homeassistant/components/vizio/__init__.py
index 38cf916a5e6..0903189e3d4 100644
--- a/homeassistant/components/vizio/__init__.py
+++ b/homeassistant/components/vizio/__init__.py
@@ -30,7 +30,8 @@ def validate_apps(config: ConfigType) -> ConfigType:
and config[CONF_DEVICE_CLASS] != MediaPlayerDeviceClass.TV
):
raise vol.Invalid(
- f"'{CONF_APPS}' can only be used if {CONF_DEVICE_CLASS}' is '{MediaPlayerDeviceClass.TV}'"
+ f"'{CONF_APPS}' can only be used if {CONF_DEVICE_CLASS}' is"
+ f" '{MediaPlayerDeviceClass.TV}'"
)
return config
diff --git a/homeassistant/components/vizio/config_flow.py b/homeassistant/components/vizio/config_flow.py
index 54e4ef53fe1..4b49d7feed5 100644
--- a/homeassistant/components/vizio/config_flow.py
+++ b/homeassistant/components/vizio/config_flow.py
@@ -261,9 +261,11 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
# their configuration.yaml or to proceed with config flow pairing. We
# will also provide contextual message to user explaining why
_LOGGER.warning(
- "Couldn't complete configuration.yaml import: '%s' key is "
- "missing. Either provide '%s' key in configuration.yaml or "
- "finish setup by completing configuration via frontend",
+ (
+ "Couldn't complete configuration.yaml import: '%s' key is "
+ "missing. Either provide '%s' key in configuration.yaml or "
+ "finish setup by completing configuration via frontend"
+ ),
CONF_ACCESS_TOKEN,
CONF_ACCESS_TOKEN,
)
diff --git a/homeassistant/components/volvooncall/config_flow.py b/homeassistant/components/volvooncall/config_flow.py
index c04fe6b4c4c..c1b3ab3f66b 100644
--- a/homeassistant/components/volvooncall/config_flow.py
+++ b/homeassistant/components/volvooncall/config_flow.py
@@ -92,7 +92,9 @@ class VolvoOnCallConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
): vol.In(
{
UNIT_SYSTEM_METRIC: "Metric",
- UNIT_SYSTEM_SCANDINAVIAN_MILES: "Metric with Scandinavian Miles",
+ UNIT_SYSTEM_SCANDINAVIAN_MILES: (
+ "Metric with Scandinavian Miles"
+ ),
UNIT_SYSTEM_IMPERIAL: "Imperial",
}
),
diff --git a/homeassistant/components/vulcan/calendar.py b/homeassistant/components/vulcan/calendar.py
index cfa962e51a3..d9182bb9905 100644
--- a/homeassistant/components/vulcan/calendar.py
+++ b/homeassistant/components/vulcan/calendar.py
@@ -68,9 +68,14 @@ class VulcanCalendarEntity(CalendarEntity):
"identifiers": {(DOMAIN, f"calendar_{self.student_info['id']}")},
"entry_type": DeviceEntryType.SERVICE,
"name": f"{self.student_info['full_name']}: Calendar",
- "model": f"{self.student_info['full_name']} - {self.student_info['class']} {self.student_info['school']}",
+ "model": (
+ f"{self.student_info['full_name']} -"
+ f" {self.student_info['class']} {self.student_info['school']}"
+ ),
"manufacturer": "Uonet +",
- "configuration_url": f"https://uonetplus.vulcan.net.pl/{self.student_info['symbol']}",
+ "configuration_url": (
+ f"https://uonetplus.vulcan.net.pl/{self.student_info['symbol']}"
+ ),
}
@property
diff --git a/homeassistant/components/vulcan/config_flow.py b/homeassistant/components/vulcan/config_flow.py
index f1e1c13871c..6c873194124 100644
--- a/homeassistant/components/vulcan/config_flow.py
+++ b/homeassistant/components/vulcan/config_flow.py
@@ -218,7 +218,9 @@ class VulcanFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(str(new_students[0].pupil.id))
self._abort_if_unique_id_configured()
return self.async_create_entry(
- title=f"{new_students[0].pupil.first_name} {new_students[0].pupil.last_name}",
+ title=(
+ f"{new_students[0].pupil.first_name} {new_students[0].pupil.last_name}"
+ ),
data={
"student_id": str(new_students[0].pupil.id),
"keystore": keystore.as_dict,
@@ -282,7 +284,9 @@ class VulcanFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
if str(student.pupil.id) == str(entry.data["student_id"]):
self.hass.config_entries.async_update_entry(
entry,
- title=f"{student.pupil.first_name} {student.pupil.last_name}",
+ title=(
+ f"{student.pupil.first_name} {student.pupil.last_name}"
+ ),
data={
"student_id": str(student.pupil.id),
"keystore": keystore.as_dict,
diff --git a/homeassistant/components/vultr/__init__.py b/homeassistant/components/vultr/__init__.py
index 4e27e77ac86..7bf3b4b07f5 100644
--- a/homeassistant/components/vultr/__init__.py
+++ b/homeassistant/components/vultr/__init__.py
@@ -59,7 +59,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
_LOGGER.error("Failed to make update API request because: %s", ex)
persistent_notification.create(
hass,
- "Error: {}" "".format(ex),
+ f"Error: {ex}",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
)
diff --git a/homeassistant/components/waterfurnace/__init__.py b/homeassistant/components/waterfurnace/__init__.py
index 107ae7b9d67..50031216609 100644
--- a/homeassistant/components/waterfurnace/__init__.py
+++ b/homeassistant/components/waterfurnace/__init__.py
@@ -96,8 +96,10 @@ class WaterFurnaceData(threading.Thread):
_LOGGER.error("Failed to refresh login credentials. Thread stopped")
persistent_notification.create(
self.hass,
- "Error:
Connection to waterfurnace website failed "
- "the maximum number of times. Thread has stopped",
+ (
+ "Error:
Connection to waterfurnace website failed "
+ "the maximum number of times. Thread has stopped"
+ ),
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
)
diff --git a/homeassistant/components/weather/__init__.py b/homeassistant/components/weather/__init__.py
index 610b8f7c355..805139d134e 100644
--- a/homeassistant/components/weather/__init__.py
+++ b/homeassistant/components/weather/__init__.py
@@ -297,9 +297,11 @@ class WeatherEntity(Entity):
"https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue"
)
_LOGGER.warning(
- "%s::%s is overriding deprecated methods on an instance of "
- "WeatherEntity, this is not valid and will be unsupported "
- "from Home Assistant 2023.1. Please %s",
+ (
+ "%s::%s is overriding deprecated methods on an instance of "
+ "WeatherEntity, this is not valid and will be unsupported "
+ "from Home Assistant 2023.1. Please %s"
+ ),
cls.__module__,
cls.__name__,
report_issue,
diff --git a/homeassistant/components/webostv/media_player.py b/homeassistant/components/webostv/media_player.py
index dcbec24c665..339124142b1 100644
--- a/homeassistant/components/webostv/media_player.py
+++ b/homeassistant/components/webostv/media_player.py
@@ -100,7 +100,8 @@ def cmd(
except WEBOSTV_EXCEPTIONS as exc:
if self.state != MediaPlayerState.OFF:
raise HomeAssistantError(
- f"Error calling {func.__name__} on entity {self.entity_id}, state:{self.state}"
+ f"Error calling {func.__name__} on entity {self.entity_id},"
+ f" state:{self.state}"
) from exc
_LOGGER.warning(
"Error calling %s on entity %s, state:%s, error: %r",
diff --git a/homeassistant/components/websocket_api/http.py b/homeassistant/components/websocket_api/http.py
index acb5bf48131..7a08d19d857 100644
--- a/homeassistant/components/websocket_api/http.py
+++ b/homeassistant/components/websocket_api/http.py
@@ -155,8 +155,11 @@ class WebSocketHandler:
return
self._logger.error(
- "Client unable to keep up with pending messages. Stayed over %s for %s seconds. "
- "The system's load is too high or an integration is misbehaving",
+ (
+ "Client unable to keep up with pending messages. Stayed over %s for %s"
+ " seconds. The system's load is too high or an integration is"
+ " misbehaving"
+ ),
PENDING_MSG_PEAK,
PENDING_MSG_PEAK_TIME,
)
diff --git a/homeassistant/components/wirelesstag/__init__.py b/homeassistant/components/wirelesstag/__init__.py
index 4e0cae5bfe8..06fbfa3621e 100644
--- a/homeassistant/components/wirelesstag/__init__.py
+++ b/homeassistant/components/wirelesstag/__init__.py
@@ -118,8 +118,7 @@ class WirelessTagPlatform:
)
except Exception as ex: # pylint: disable=broad-except
_LOGGER.error(
- "Unable to handle tag update:\
- %s error: %s",
+ "Unable to handle tag update: %s error: %s",
str(tag),
str(ex),
)
@@ -213,8 +212,14 @@ class WirelessTagBaseSensor(Entity):
"""Return the state attributes."""
return {
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),
- ATTR_VOLTAGE: f"{self._tag.battery_volts:.2f}{UnitOfElectricPotential.VOLT}",
- ATTR_TAG_SIGNAL_STRENGTH: f"{self._tag.signal_strength}{SIGNAL_STRENGTH_DECIBELS_MILLIWATT}",
+ ATTR_VOLTAGE: (
+ f"{self._tag.battery_volts:.2f}{UnitOfElectricPotential.VOLT}"
+ ),
+ ATTR_TAG_SIGNAL_STRENGTH: (
+ f"{self._tag.signal_strength}{SIGNAL_STRENGTH_DECIBELS_MILLIWATT}"
+ ),
ATTR_TAG_OUT_OF_RANGE: not self._tag.is_in_range,
- ATTR_TAG_POWER_CONSUMPTION: f"{self._tag.power_consumption:.2f}{PERCENTAGE}",
+ ATTR_TAG_POWER_CONSUMPTION: (
+ f"{self._tag.power_consumption:.2f}{PERCENTAGE}"
+ ),
}
diff --git a/homeassistant/components/withings/__init__.py b/homeassistant/components/withings/__init__.py
index da2174c3822..8220bb547c9 100644
--- a/homeassistant/components/withings/__init__.py
+++ b/homeassistant/components/withings/__init__.py
@@ -205,7 +205,10 @@ async def async_webhook_handler(
data_manager = get_data_manager_by_webhook_id(hass, webhook_id)
if not data_manager:
_LOGGER.error(
- "Webhook id %s not handled by data manager. This is a bug and should be reported",
+ (
+ "Webhook id %s not handled by data manager. This is a bug and should be"
+ " reported"
+ ),
webhook_id,
)
return json_message_response("User not found", message_code=1)
diff --git a/homeassistant/components/wled/__init__.py b/homeassistant/components/wled/__init__.py
index 809afdfb3c7..fe6ac5a1fc1 100644
--- a/homeassistant/components/wled/__init__.py
+++ b/homeassistant/components/wled/__init__.py
@@ -27,8 +27,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if coordinator.data.info.leds.cct:
LOGGER.error(
- "WLED device '%s' has a CCT channel, which is not supported by "
- "this integration",
+ (
+ "WLED device '%s' has a CCT channel, which is not supported by "
+ "this integration"
+ ),
entry.title,
)
return False
diff --git a/homeassistant/components/xbox_live/sensor.py b/homeassistant/components/xbox_live/sensor.py
index f75dbe6ba4e..d95031a646e 100644
--- a/homeassistant/components/xbox_live/sensor.py
+++ b/homeassistant/components/xbox_live/sensor.py
@@ -57,8 +57,10 @@ def setup_platform(
response = api.api_get("profile")
if not response.ok:
_LOGGER.error(
- "Can't setup X API connection. Check your account or "
- "api key on xapi.us. Code: %s Description: %s ",
+ (
+ "Can't setup X API connection. Check your account or "
+ "api key on xapi.us. Code: %s Description: %s "
+ ),
response.status_code,
response.reason,
)
diff --git a/homeassistant/components/xiaomi_aqara/__init__.py b/homeassistant/components/xiaomi_aqara/__init__.py
index aba9da05611..be6eba6793e 100644
--- a/homeassistant/components/xiaomi_aqara/__init__.py
+++ b/homeassistant/components/xiaomi_aqara/__init__.py
@@ -105,8 +105,10 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
gateway.write_to_hub(gateway.sid, join_permission="yes")
persistent_notification.async_create(
hass,
- "Join permission enabled for 30 seconds! "
- "Please press the pairing button of the new device once.",
+ (
+ "Join permission enabled for 30 seconds! "
+ "Please press the pairing button of the new device once."
+ ),
title="Xiaomi Aqara Gateway",
)
diff --git a/homeassistant/components/xiaomi_aqara/config_flow.py b/homeassistant/components/xiaomi_aqara/config_flow.py
index cc86fda85f5..773e63d92bf 100644
--- a/homeassistant/components/xiaomi_aqara/config_flow.py
+++ b/homeassistant/components/xiaomi_aqara/config_flow.py
@@ -162,7 +162,10 @@ class XiaomiAqaraFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
name.startswith(ZEROCONF_GATEWAY) or name.startswith(ZEROCONF_ACPARTNER)
):
_LOGGER.debug(
- "Xiaomi device '%s' discovered with host %s, not identified as xiaomi aqara gateway",
+ (
+ "Xiaomi device '%s' discovered with host %s, not identified as"
+ " xiaomi aqara gateway"
+ ),
name,
self.host,
)
diff --git a/homeassistant/components/xiaomi_aqara/light.py b/homeassistant/components/xiaomi_aqara/light.py
index 173ffe564fc..822d4121c68 100644
--- a/homeassistant/components/xiaomi_aqara/light.py
+++ b/homeassistant/components/xiaomi_aqara/light.py
@@ -70,8 +70,7 @@ class XiaomiGatewayLight(XiaomiDevice, LightEntity):
rgbhexstr = f"{value:x}"
if len(rgbhexstr) > 8:
_LOGGER.error(
- "Light RGB data error."
- " Can't be more than 8 characters. Received: %s",
+ "Light RGB data error. Can't be more than 8 characters. Received: %s",
rgbhexstr,
)
return False
diff --git a/homeassistant/components/xiaomi_miio/__init__.py b/homeassistant/components/xiaomi_miio/__init__.py
index d3a407d529e..6e8d0831445 100644
--- a/homeassistant/components/xiaomi_miio/__init__.py
+++ b/homeassistant/components/xiaomi_miio/__init__.py
@@ -153,9 +153,11 @@ def get_platforms(config_entry):
if model.startswith(air_monitor_model):
return AIR_MONITOR_PLATFORMS
_LOGGER.error(
- "Unsupported device found! Please create an issue at "
- "https://github.com/syssi/xiaomi_airpurifier/issues "
- "and provide the following data: %s",
+ (
+ "Unsupported device found! Please create an issue at "
+ "https://github.com/syssi/xiaomi_airpurifier/issues "
+ "and provide the following data: %s"
+ ),
model,
)
return []
@@ -336,9 +338,11 @@ async def async_create_miio_device_and_coordinator(
device = Fan(host, token, model=model)
else:
_LOGGER.error(
- "Unsupported device found! Please create an issue at "
- "https://github.com/syssi/xiaomi_airpurifier/issues "
- "and provide the following data: %s",
+ (
+ "Unsupported device found! Please create an issue at "
+ "https://github.com/syssi/xiaomi_airpurifier/issues "
+ "and provide the following data: %s"
+ ),
model,
)
return
diff --git a/homeassistant/components/xiaomi_miio/gateway.py b/homeassistant/components/xiaomi_miio/gateway.py
index 6d0984a9aeb..655a04a4340 100644
--- a/homeassistant/components/xiaomi_miio/gateway.py
+++ b/homeassistant/components/xiaomi_miio/gateway.py
@@ -92,8 +92,10 @@ class ConnectXiaomiGateway:
self._gateway_device.discover_devices()
except DeviceException as error:
_LOGGER.info(
- "DeviceException during getting subdevices of xiaomi gateway"
- " with host %s, trying cloud to obtain subdevices: %s",
+ (
+ "DeviceException during getting subdevices of xiaomi gateway"
+ " with host %s, trying cloud to obtain subdevices: %s"
+ ),
self._host,
error,
)
@@ -114,8 +116,10 @@ class ConnectXiaomiGateway:
miio_cloud = MiCloud(self._cloud_username, self._cloud_password)
if not miio_cloud.login():
raise SetupException(
- "Failed to login to Xiaomi Miio Cloud during setup of Xiaomi"
- f" gateway with host {self._host}",
+ (
+ "Failed to login to Xiaomi Miio Cloud during setup of"
+ f" Xiaomi gateway with host {self._host}"
+ ),
)
devices_raw = miio_cloud.get_devices(self._cloud_country)
self._gateway_device.get_devices_from_dict(devices_raw)
@@ -125,7 +129,8 @@ class ConnectXiaomiGateway:
) from error
except DeviceException as error:
raise SetupException(
- f"DeviceException during setup of xiaomi gateway with host {self._host}"
+ "DeviceException during setup of xiaomi gateway with host"
+ f" {self._host}"
) from error
diff --git a/homeassistant/components/xiaomi_miio/light.py b/homeassistant/components/xiaomi_miio/light.py
index 49554311b91..d691c44a38a 100644
--- a/homeassistant/components/xiaomi_miio/light.py
+++ b/homeassistant/components/xiaomi_miio/light.py
@@ -198,9 +198,11 @@ async def async_setup_entry(
hass.data[DATA_KEY][host] = entity
else:
_LOGGER.error(
- "Unsupported device found! Please create an issue at "
- "https://github.com/syssi/philipslight/issues "
- "and provide the following data: %s",
+ (
+ "Unsupported device found! Please create an issue at "
+ "https://github.com/syssi/philipslight/issues "
+ "and provide the following data: %s"
+ ),
model,
)
return
@@ -445,8 +447,10 @@ class XiaomiPhilipsBulb(XiaomiPhilipsGenericLight):
if ATTR_BRIGHTNESS in kwargs and ATTR_COLOR_TEMP in kwargs:
_LOGGER.debug(
- "Setting brightness and color temperature: "
- "%s %s%%, %s mireds, %s%% cct",
+ (
+ "Setting brightness and color temperature: "
+ "%s %s%%, %s mireds, %s%% cct"
+ ),
brightness,
percent_brightness,
color_temp,
@@ -843,8 +847,10 @@ class XiaomiPhilipsMoonlightLamp(XiaomiPhilipsBulb):
elif ATTR_BRIGHTNESS in kwargs and ATTR_COLOR_TEMP in kwargs:
_LOGGER.debug(
- "Setting brightness and color temperature: "
- "%s %s%%, %s mireds, %s%% cct",
+ (
+ "Setting brightness and color temperature: "
+ "%s %s%%, %s mireds, %s%% cct"
+ ),
brightness,
percent_brightness,
color_temp,
diff --git a/homeassistant/components/xiaomi_miio/switch.py b/homeassistant/components/xiaomi_miio/switch.py
index f2b7b071923..98340087401 100644
--- a/homeassistant/components/xiaomi_miio/switch.py
+++ b/homeassistant/components/xiaomi_miio/switch.py
@@ -470,9 +470,11 @@ async def async_setup_other_entry(hass, config_entry, async_add_entities):
hass.data[DATA_KEY][host] = device
else:
_LOGGER.error(
- "Unsupported device found! Please create an issue at "
- "https://github.com/rytilahti/python-miio/issues "
- "and provide the following data: %s",
+ (
+ "Unsupported device found! Please create an issue at "
+ "https://github.com/rytilahti/python-miio/issues "
+ "and provide the following data: %s"
+ ),
model,
)
diff --git a/homeassistant/components/yale_smart_alarm/alarm_control_panel.py b/homeassistant/components/yale_smart_alarm/alarm_control_panel.py
index 8577a2a179f..799949a462a 100644
--- a/homeassistant/components/yale_smart_alarm/alarm_control_panel.py
+++ b/homeassistant/components/yale_smart_alarm/alarm_control_panel.py
@@ -81,7 +81,8 @@ class YaleAlarmDevice(YaleAlarmEntity, AlarmControlPanelEntity):
)
except YALE_ALL_ERRORS as error:
raise HomeAssistantError(
- f"Could not set alarm for {self.coordinator.entry.data[CONF_NAME]}: {error}"
+ f"Could not set alarm for {self.coordinator.entry.data[CONF_NAME]}:"
+ f" {error}"
) from error
if alarm_state:
diff --git a/homeassistant/components/yalexs_ble/config_flow.py b/homeassistant/components/yalexs_ble/config_flow.py
index 7845e8aa5e8..e6008526341 100644
--- a/homeassistant/components/yalexs_ble/config_flow.py
+++ b/homeassistant/components/yalexs_ble/config_flow.py
@@ -233,7 +233,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
{
vol.Required(CONF_ADDRESS): vol.In(
{
- service_info.address: f"{service_info.name} ({service_info.address})"
+ service_info.address: (
+ f"{service_info.name} ({service_info.address})"
+ )
for service_info in self._discovered_devices.values()
}
),
diff --git a/homeassistant/components/yamaha_musiccast/media_player.py b/homeassistant/components/yamaha_musiccast/media_player.py
index b09d6206d05..5c4b2ae5ae5 100644
--- a/homeassistant/components/yamaha_musiccast/media_player.py
+++ b/homeassistant/components/yamaha_musiccast/media_player.py
@@ -463,7 +463,8 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
await self.coordinator.musiccast.tuner_previous_station()
else:
raise HomeAssistantError(
- "Service previous track is not supported for non NetUSB or Tuner sources."
+ "Service previous track is not supported for non NetUSB or Tuner"
+ " sources."
)
async def async_media_next_track(self) -> None:
@@ -720,7 +721,10 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
network_join = await client.async_client_join(group, self)
except MusicCastGroupException:
_LOGGER.warning(
- "%s is struggling to update its group data. Will retry perform the update",
+ (
+ "%s is struggling to update its group data. Will retry"
+ " perform the update"
+ ),
client.entity_id,
)
network_join = await client.async_client_join(group, self)
@@ -786,8 +790,10 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
if self.musiccast_zone_entity.is_server:
# If one of the zones of the device is a server, we need to unjoin first.
_LOGGER.debug(
- "%s is a server of a group and has to stop distribution "
- "to use MusicCast for %s",
+ (
+ "%s is a server of a group and has to stop distribution "
+ "to use MusicCast for %s"
+ ),
self.musiccast_zone_entity.entity_id,
self.entity_id,
)
diff --git a/homeassistant/components/yandex_transport/sensor.py b/homeassistant/components/yandex_transport/sensor.py
index b7a846bbc67..fe27ddcdbbe 100644
--- a/homeassistant/components/yandex_transport/sensor.py
+++ b/homeassistant/components/yandex_transport/sensor.py
@@ -96,7 +96,10 @@ class DiscoverYandexTransport(SensorEntity):
data = yandex_reply["data"]
except KeyError as key_error:
_LOGGER.warning(
- "Exception KeyError was captured, missing key is %s. Yandex returned: %s",
+ (
+ "Exception KeyError was captured, missing key is %s. Yandex"
+ " returned: %s"
+ ),
key_error,
yandex_reply,
)
diff --git a/homeassistant/components/zamg/config_flow.py b/homeassistant/components/zamg/config_flow.py
index 8d971e2ed31..86584fd7f1c 100644
--- a/homeassistant/components/zamg/config_flow.py
+++ b/homeassistant/components/zamg/config_flow.py
@@ -96,7 +96,10 @@ class ZamgConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
try:
if station_id not in await self._client.zamg_stations():
LOGGER.warning(
- "Configured station_id %s could not be found at zamg, trying to add nearest weather station instead",
+ (
+ "Configured station_id %s could not be found at zamg, trying to"
+ " add nearest weather station instead"
+ ),
station_id,
)
latitude = config.get(CONF_LATITUDE) or self.hass.config.latitude
diff --git a/homeassistant/components/zeroconf/__init__.py b/homeassistant/components/zeroconf/__init__.py
index 82a9604a08c..a3865f5e168 100644
--- a/homeassistant/components/zeroconf/__init__.py
+++ b/homeassistant/components/zeroconf/__init__.py
@@ -579,7 +579,10 @@ def _suppress_invalid_properties(properties: dict) -> None:
if len(prop_value.encode("utf-8")) > MAX_PROPERTY_VALUE_LEN:
_LOGGER.error(
- "The property '%s' was suppressed because it is longer than the maximum length of %d bytes: %s",
+ (
+ "The property '%s' was suppressed because it is longer than the"
+ " maximum length of %d bytes: %s"
+ ),
prop,
MAX_PROPERTY_VALUE_LEN,
prop_value,
@@ -593,7 +596,10 @@ def _truncate_location_name_to_valid(location_name: str) -> str:
return location_name
_LOGGER.warning(
- "The location name was truncated because it is longer than the maximum length of %d bytes: %s",
+ (
+ "The location name was truncated because it is longer than the maximum"
+ " length of %d bytes: %s"
+ ),
MAX_NAME_LEN,
location_name,
)
diff --git a/homeassistant/components/zeroconf/usage.py b/homeassistant/components/zeroconf/usage.py
index 47798be3def..7cedb11a418 100644
--- a/homeassistant/components/zeroconf/usage.py
+++ b/homeassistant/components/zeroconf/usage.py
@@ -14,7 +14,11 @@ def install_multiple_zeroconf_catcher(hass_zc: HaZeroconf) -> None:
def new_zeroconf_new(self: zeroconf.Zeroconf, *k: Any, **kw: Any) -> HaZeroconf:
report(
- "attempted to create another Zeroconf instance. Please use the shared Zeroconf via await homeassistant.components.zeroconf.async_get_instance(hass)",
+ (
+ "attempted to create another Zeroconf instance. Please use the shared"
+ " Zeroconf via await"
+ " homeassistant.components.zeroconf.async_get_instance(hass)"
+ ),
exclude_integrations={"zeroconf"},
error_if_core=False,
)
diff --git a/homeassistant/components/zha/api.py b/homeassistant/components/zha/api.py
index eb5fc2e4343..59f2bfa331b 100644
--- a/homeassistant/components/zha/api.py
+++ b/homeassistant/components/zha/api.py
@@ -821,7 +821,10 @@ async def websocket_read_zigbee_cluster_attributes(
[attribute], allow_cache=False, only_cache=False, manufacturer=manufacturer
)
_LOGGER.debug(
- "Read attribute for: %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s],",
+ (
+ "Read attribute for: %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s]"
+ " %s: [%s],"
+ ),
ATTR_CLUSTER_ID,
cluster_id,
ATTR_CLUSTER_TYPE,
@@ -1286,7 +1289,10 @@ def async_load_api(hass: HomeAssistant) -> None:
manufacturer=manufacturer,
)
_LOGGER.debug(
- "Set attribute for: %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s]",
+ (
+ "Set attribute for: %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s:"
+ " [%s] %s: [%s]"
+ ),
ATTR_CLUSTER_ID,
cluster_id,
ATTR_CLUSTER_TYPE,
@@ -1338,7 +1344,10 @@ def async_load_api(hass: HomeAssistant) -> None:
manufacturer=manufacturer,
)
_LOGGER.debug(
- "Issued command for: %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s]",
+ (
+ "Issued command for: %s: [%s] %s: [%s] %s: [%s] %s: [%s] %s: [%s]"
+ " %s: [%s] %s: [%s] %s: [%s]"
+ ),
ATTR_CLUSTER_ID,
cluster_id,
ATTR_CLUSTER_TYPE,