From d911c83f431490cdfe3b90066ca795317b87cb91 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 22 Dec 2022 12:17:15 +0100 Subject: [PATCH] String formatting and max line length - Part 5 --- .../components/azure_event_hub/__init__.py | 7 +-- .../components/crownstone/entry_manager.py | 10 ++-- .../components/input_number/__init__.py | 3 +- .../components/input_select/__init__.py | 5 +- .../components/insteon/insteon_entity.py | 10 +++- homeassistant/components/ipma/weather.py | 5 +- homeassistant/components/ipp/config_flow.py | 6 ++- homeassistant/components/ipp/sensor.py | 4 +- .../islamic_prayer_times/__init__.py | 6 ++- homeassistant/components/isy994/__init__.py | 6 ++- .../components/isy994/binary_sensor.py | 6 ++- homeassistant/components/isy994/entity.py | 6 ++- homeassistant/components/isy994/helpers.py | 5 +- homeassistant/components/isy994/services.py | 6 ++- homeassistant/components/juicenet/entity.py | 4 +- homeassistant/components/keba/__init__.py | 6 ++- homeassistant/components/knx/__init__.py | 10 +++- homeassistant/components/knx/config_flow.py | 10 +++- homeassistant/components/knx/schema.py | 48 ++++++++++++++----- homeassistant/components/konnected/panel.py | 6 ++- homeassistant/components/kraken/__init__.py | 6 ++- .../components/lacrosse_view/sensor.py | 3 +- homeassistant/components/lcn/__init__.py | 11 +++-- homeassistant/components/lcn/config_flow.py | 6 ++- .../components/led_ble/config_flow.py | 4 +- .../components/life360/device_tracker.py | 12 +++-- homeassistant/components/lifx/__init__.py | 5 +- homeassistant/components/lifx/light.py | 5 +- homeassistant/components/lifx/util.py | 3 +- .../components/light/reproduce_state.py | 5 +- .../components/logi_circle/__init__.py | 15 +++--- homeassistant/components/lovelace/__init__.py | 6 ++- homeassistant/components/luftdaten/sensor.py | 4 +- .../components/lutron_caseta/logbook.py | 4 +- homeassistant/components/lyric/climate.py | 3 +- .../components/magicseaweed/sensor.py | 10 +++- .../components/mailgun/config_flow.py | 4 +- homeassistant/components/maxcube/__init__.py | 5 +- .../components/media_player/__init__.py | 6 ++- homeassistant/components/melcloud/climate.py | 6 ++- .../components/meteo_france/__init__.py | 15 ++++-- .../components/minecraft_server/__init__.py | 5 +- .../components/mobile_app/webhook.py | 6 ++- .../components/modbus/base_platform.py | 5 +- homeassistant/components/modbus/validators.py | 18 +++++-- .../components/modern_forms/__init__.py | 5 +- .../components/moehlenhoff_alpha2/sensor.py | 5 +- .../components/motion_blinds/__init__.py | 6 ++- .../components/motion_blinds/gateway.py | 5 +- homeassistant/components/motioneye/const.py | 4 +- homeassistant/components/mqtt/__init__.py | 30 ++++++++---- .../components/mqtt/binary_sensor.py | 20 ++++++-- 52 files changed, 299 insertions(+), 117 deletions(-) diff --git a/homeassistant/components/azure_event_hub/__init__.py b/homeassistant/components/azure_event_hub/__init__.py index 743463abda5..30417a7f94a 100644 --- a/homeassistant/components/azure_event_hub/__init__.py +++ b/homeassistant/components/azure_event_hub/__init__.py @@ -78,9 +78,10 @@ async def async_setup(hass: HomeAssistant, yaml_config: ConfigType) -> bool: if not yaml_config[DOMAIN]: return True _LOGGER.warning( - "Loading Azure Event Hub completely via yaml config is deprecated; Only the \ - Filter can be set in yaml, the rest is done through a config flow and has \ - been imported, all other keys but filter can be deleted from configuration.yaml" + "Loading Azure Event Hub completely via yaml config is deprecated; Only the" + " Filter can be set in yaml, the rest is done through a config flow and has" + " been imported, all other keys but filter can be deleted from" + " configuration.yaml" ) hass.async_create_task( hass.config_entries.flow.async_init( diff --git a/homeassistant/components/crownstone/entry_manager.py b/homeassistant/components/crownstone/entry_manager.py index 2f74daa8629..c527e3ba2b9 100644 --- a/homeassistant/components/crownstone/entry_manager.py +++ b/homeassistant/components/crownstone/entry_manager.py @@ -146,9 +146,13 @@ class CrownstoneEntryManager: # Show notification to ensure the user knows the cloud is now used persistent_notification.async_create( self.hass, - f"Setup of Crownstone USB dongle was unsuccessful on port {serial_port}.\n \ - Crownstone Cloud will be used to switch Crownstones.\n \ - Please check if your port is correct and set up the USB again from integration options.", + ( + "Setup of Crownstone USB dongle was unsuccessful on port" + f" {serial_port}.\n Crownstone Cloud will be used" + " to switch Crownstones.\n Please check if your" + " port is correct and set up the USB again from integration" + " options." + ), "Crownstone", "crownstone_usb_dongle_setup", ) diff --git a/homeassistant/components/input_number/__init__.py b/homeassistant/components/input_number/__init__.py index 99e54dc9baa..d81ec581bc8 100644 --- a/homeassistant/components/input_number/__init__.py +++ b/homeassistant/components/input_number/__init__.py @@ -307,7 +307,8 @@ class InputNumber(collection.CollectionEntity, RestoreEntity): if num_value < self._minimum or num_value > self._maximum: raise vol.Invalid( - f"Invalid value for {self.entity_id}: {value} (range {self._minimum} - {self._maximum})" + f"Invalid value for {self.entity_id}: {value} (range {self._minimum} -" + f" {self._maximum})" ) self._current_value = num_value diff --git a/homeassistant/components/input_select/__init__.py b/homeassistant/components/input_select/__init__.py index f30b2ca1e36..bd9c43e8538 100644 --- a/homeassistant/components/input_select/__init__.py +++ b/homeassistant/components/input_select/__init__.py @@ -73,7 +73,10 @@ def _remove_duplicates(options: list[str], name: str | None) -> list[str]: # Reject YAML configured input_select with duplicates from 2022.6 if len(unique_options) != len(options): _LOGGER.warning( - "Input select '%s' with options %s had duplicated options, the duplicates have been removed", + ( + "Input select '%s' with options %s had duplicated options, the" + " duplicates have been removed" + ), name or "", options, ) diff --git a/homeassistant/components/insteon/insteon_entity.py b/homeassistant/components/insteon/insteon_entity.py index d1ba7c5f829..dd7acc65458 100644 --- a/homeassistant/components/insteon/insteon_entity.py +++ b/homeassistant/components/insteon/insteon_entity.py @@ -83,9 +83,15 @@ class InsteonEntity(Entity): return DeviceInfo( identifiers={(DOMAIN, str(self._insteon_device.address))}, manufacturer="SmartLabs, Inc", - model=f"{self._insteon_device.model} ({self._insteon_device.cat!r}, 0x{self._insteon_device.subcat:02x})", + model=( + f"{self._insteon_device.model} ({self._insteon_device.cat!r}," + f" 0x{self._insteon_device.subcat:02x})" + ), name=f"{self._insteon_device.description} {self._insteon_device.address}", - sw_version=f"{self._insteon_device.firmware:02x} Engine Version: {self._insteon_device.engine_version}", + sw_version=( + f"{self._insteon_device.firmware:02x} Engine Version:" + f" {self._insteon_device.engine_version}" + ), via_device=(DOMAIN, str(devices.modem.address)), ) diff --git a/homeassistant/components/ipma/weather.py b/homeassistant/components/ipma/weather.py index 467523c5830..4387e2d8e1e 100644 --- a/homeassistant/components/ipma/weather.py +++ b/homeassistant/components/ipma/weather.py @@ -158,7 +158,10 @@ class IPMAWeather(WeatherEntity): @property def unique_id(self) -> str: """Return a unique id.""" - return f"{self._location.station_latitude}, {self._location.station_longitude}, {self._mode}" + return ( + f"{self._location.station_latitude}, {self._location.station_longitude}," + f" {self._mode}" + ) @property def name(self): diff --git a/homeassistant/components/ipp/config_flow.py b/homeassistant/components/ipp/config_flow.py index fa5e23063b4..a00190eebce 100644 --- a/homeassistant/components/ipp/config_flow.py +++ b/homeassistant/components/ipp/config_flow.py @@ -90,7 +90,8 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN): if not unique_id and info[CONF_SERIAL]: _LOGGER.debug( - "Printer UUID is missing from IPP response. Falling back to IPP serial number" + "Printer UUID is missing from IPP response. Falling back to IPP serial" + " number" ) unique_id = info[CONF_SERIAL] elif not unique_id: @@ -154,7 +155,8 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN): unique_id = self.discovery_info[CONF_UUID] = info[CONF_UUID] elif not unique_id and info[CONF_SERIAL]: _LOGGER.debug( - "Printer UUID is missing from discovery info and IPP response. Falling back to IPP serial number" + "Printer UUID is missing from discovery info and IPP response. Falling" + " back to IPP serial number" ) unique_id = info[CONF_SERIAL] elif not unique_id: diff --git a/homeassistant/components/ipp/sensor.py b/homeassistant/components/ipp/sensor.py index 718b35dbc6a..293a6378b78 100644 --- a/homeassistant/components/ipp/sensor.py +++ b/homeassistant/components/ipp/sensor.py @@ -101,7 +101,9 @@ class IPPMarkerSensor(IPPSensor): unique_id=unique_id, icon="mdi:water", key=f"marker_{marker_index}", - name=f"{coordinator.data.info.name} {coordinator.data.markers[marker_index].name}", + name=( + f"{coordinator.data.info.name} {coordinator.data.markers[marker_index].name}" + ), unit_of_measurement=PERCENTAGE, ) diff --git a/homeassistant/components/islamic_prayer_times/__init__.py b/homeassistant/components/islamic_prayer_times/__init__.py index 406eaf23670..55c27c4cc59 100644 --- a/homeassistant/components/islamic_prayer_times/__init__.py +++ b/homeassistant/components/islamic_prayer_times/__init__.py @@ -105,11 +105,13 @@ class IslamicPrayerClient: if now > dt_util.as_utc(midnight_dt): next_update_at = midnight_dt + timedelta(days=1, minutes=1) _LOGGER.debug( - "Midnight is after day the changes so schedule update for after Midnight the next day" + "Midnight is after day the changes so schedule update for after" + " Midnight the next day" ) else: _LOGGER.debug( - "Midnight is before the day changes so schedule update for the next start of day" + "Midnight is before the day changes so schedule update for the next" + " start of day" ) next_update_at = dt_util.start_of_local_day(now + timedelta(days=1)) diff --git a/homeassistant/components/isy994/__init__.py b/homeassistant/components/isy994/__init__.py index 1b689e563dc..4fabb120102 100644 --- a/homeassistant/components/isy994/__init__.py +++ b/homeassistant/components/isy994/__init__.py @@ -180,7 +180,8 @@ async def async_setup_entry( await isy.initialize() except asyncio.TimeoutError as err: raise ConfigEntryNotReady( - f"Timed out initializing the ISY; device may be busy, trying again later: {err}" + "Timed out initializing the ISY; device may be busy, trying again later:" + f" {err}" ) from err except ISYInvalidAuthError as err: raise ConfigEntryAuthFailed(f"Invalid credentials for the ISY: {err}") from err @@ -190,7 +191,8 @@ async def async_setup_entry( ) from err except ISYResponseParseError as err: raise ConfigEntryNotReady( - f"Invalid XML response from ISY; Ensure the ISY is running the latest firmware: {err}" + "Invalid XML response from ISY; Ensure the ISY is running the latest" + f" firmware: {err}" ) from err except TypeError as err: raise ConfigEntryNotReady( diff --git a/homeassistant/components/isy994/binary_sensor.py b/homeassistant/components/isy994/binary_sensor.py index 81efdb5922a..399d9953170 100644 --- a/homeassistant/components/isy994/binary_sensor.py +++ b/homeassistant/components/isy994/binary_sensor.py @@ -116,8 +116,10 @@ async def async_setup_entry( parent_entity = entities_by_address.get(node.parent_node.address) if not parent_entity: _LOGGER.error( - "Node %s has a parent node %s, but no device " - "was created for the parent. Skipping", + ( + "Node %s has a parent node %s, but no device " + "was created for the parent. Skipping" + ), node.address, node.parent_node, ) diff --git a/homeassistant/components/isy994/entity.py b/homeassistant/components/isy994/entity.py index 61f42a60a6e..a90701f3323 100644 --- a/homeassistant/components/isy994/entity.py +++ b/homeassistant/components/isy994/entity.py @@ -209,7 +209,8 @@ class ISYNodeEntity(ISYEntity): """Respond to an entity service command to request a Z-Wave device parameter from the ISY.""" if not hasattr(self._node, "protocol") or self._node.protocol != PROTO_ZWAVE: raise HomeAssistantError( - f"Invalid service call: cannot request Z-Wave Parameter for non-Z-Wave device {self.entity_id}" + "Invalid service call: cannot request Z-Wave Parameter for non-Z-Wave" + f" device {self.entity_id}" ) await self._node.get_zwave_parameter(parameter) @@ -219,7 +220,8 @@ class ISYNodeEntity(ISYEntity): """Respond to an entity service command to set a Z-Wave device parameter via the ISY.""" if not hasattr(self._node, "protocol") or self._node.protocol != PROTO_ZWAVE: raise HomeAssistantError( - f"Invalid service call: cannot set Z-Wave Parameter for non-Z-Wave device {self.entity_id}" + "Invalid service call: cannot set Z-Wave Parameter for non-Z-Wave" + f" device {self.entity_id}" ) await self._node.set_zwave_parameter(parameter, value, size) await self._node.get_zwave_parameter(parameter) diff --git a/homeassistant/components/isy994/helpers.py b/homeassistant/components/isy994/helpers.py index 736cd12b9ea..c4f0c2ea595 100644 --- a/homeassistant/components/isy994/helpers.py +++ b/homeassistant/components/isy994/helpers.py @@ -352,7 +352,10 @@ def _categorize_programs(hass_isy_data: dict, programs: Programs) -> None: actions = entity_folder.get_by_name(KEY_ACTIONS) if not actions or actions.protocol != PROTO_PROGRAM: _LOGGER.warning( - "Program %s entity '%s' not loaded, invalid/missing actions program", + ( + "Program %s entity '%s' not loaded, invalid/missing actions" + " program" + ), platform, entity_folder.name, ) diff --git a/homeassistant/components/isy994/services.py b/homeassistant/components/isy994/services.py index 30b5f121df3..18076e2da98 100644 --- a/homeassistant/components/isy994/services.py +++ b/homeassistant/components/isy994/services.py @@ -299,8 +299,10 @@ def async_setup_services(hass: HomeAssistant) -> None: # noqa: C901 entity_registry.async_remove(entity_id) _LOGGER.debug( - "Cleaning up ISY994 Entities and devices: Config Entries: %s, Current Entries: %s, " - "Extra Entries Removed: %s", + ( + "Cleaning up ISY994 Entities and devices: Config Entries: %s, Current" + " Entries: %s, Extra Entries Removed: %s" + ), len(config_ids), len(current_unique_ids), len(extra_entities), diff --git a/homeassistant/components/juicenet/entity.py b/homeassistant/components/juicenet/entity.py index c0151a0cd00..0f3811bef6f 100644 --- a/homeassistant/components/juicenet/entity.py +++ b/homeassistant/components/juicenet/entity.py @@ -31,7 +31,9 @@ class JuiceNetDevice(CoordinatorEntity): def device_info(self) -> DeviceInfo: """Return device information about this JuiceNet Device.""" return DeviceInfo( - configuration_url=f"https://home.juice.net/Portal/Details?unitID={self.device.id}", + configuration_url=( + f"https://home.juice.net/Portal/Details?unitID={self.device.id}" + ), identifiers={(DOMAIN, self.device.id)}, manufacturer="JuiceNet", name=self.device.name, diff --git a/homeassistant/components/keba/__init__.py b/homeassistant/components/keba/__init__.py index b957acd2a31..1c99a6500c5 100644 --- a/homeassistant/components/keba/__init__.py +++ b/homeassistant/components/keba/__init__.py @@ -235,7 +235,9 @@ class KebaHandler(KebaKeContact): self._set_fast_polling() except (KeyError, ValueError) as ex: _LOGGER.warning( - "Values are not correct for: failsafe_timeout, failsafe_fallback and/or " - "failsafe_persist: %s", + ( + "Values are not correct for: failsafe_timeout, failsafe_fallback" + " and/or failsafe_persist: %s" + ), ex, ) diff --git a/homeassistant/components/knx/__init__.py b/homeassistant/components/knx/__init__.py index 5d2ab031323..0159f6f1cac 100644 --- a/homeassistant/components/knx/__init__.py +++ b/homeassistant/components/knx/__init__.py @@ -495,7 +495,10 @@ class KNXModule: value = transcoder.from_knx(data) except ConversionError as err: _LOGGER.warning( - "Error in `knx_event` at decoding type '%s' from telegram %s\n%s", + ( + "Error in `knx_event` at decoding type '%s' from" + " telegram %s\n%s" + ), transcoder.__name__, telegram, err, @@ -584,7 +587,10 @@ class KNXModule: if group_address in self.service_exposures: replaced_exposure = self.service_exposures.pop(group_address) _LOGGER.warning( - "Service exposure_register replacing already registered exposure for '%s' - %s", + ( + "Service exposure_register replacing already registered exposure" + " for '%s' - %s" + ), group_address, replaced_exposure.device.name, ) diff --git a/homeassistant/components/knx/config_flow.py b/homeassistant/components/knx/config_flow.py index 6e0c357b5fa..c1e8c12dd01 100644 --- a/homeassistant/components/knx/config_flow.py +++ b/homeassistant/components/knx/config_flow.py @@ -399,7 +399,10 @@ class KNXCommonFlow(ABC, FlowHandler): ], ) return self.finish_flow( - title=f"Secure Routing as {self.new_entry_data[CONF_KNX_INDIVIDUAL_ADDRESS]}" + title=( + "Secure Routing as" + f" {self.new_entry_data[CONF_KNX_INDIVIDUAL_ADDRESS]}" + ) ) fields = { @@ -464,7 +467,10 @@ class KNXCommonFlow(ABC, FlowHandler): self.new_entry_data[CONF_KNX_CONNECTION_TYPE] == CONF_KNX_ROUTING_SECURE ): - title = f"Secure Routing as {self.new_entry_data[CONF_KNX_INDIVIDUAL_ADDRESS]}" + title = ( + "Secure Routing as" + f" {self.new_entry_data[CONF_KNX_INDIVIDUAL_ADDRESS]}" + ) else: title = f"Secure Tunneling @ {self.new_entry_data[CONF_HOST]}" return self.finish_flow(title=title) diff --git a/homeassistant/components/knx/schema.py b/homeassistant/components/knx/schema.py index 87a7b6fdab5..e756fc5e466 100644 --- a/homeassistant/components/knx/schema.py +++ b/homeassistant/components/knx/schema.py @@ -74,7 +74,8 @@ def dpt_subclass_validator(dpt_base_class: type[DPTBase]) -> Callable[[Any], str ): return value raise vol.Invalid( - f"type '{value}' is not a valid DPT identifier for {dpt_base_class.__name__}." + f"type '{value}' is not a valid DPT identifier for" + f" {dpt_base_class.__name__}." ) return dpt_value_validator @@ -94,8 +95,9 @@ def ga_validator(value: Any) -> str | int: except CouldNotParseAddress: pass raise vol.Invalid( - f"value '{value}' is not a valid KNX group address '
//', '
/' " - "or '' (eg.'1/2/3', '9/234', '123'), nor xknx internal address 'i-'." + f"value '{value}' is not a valid KNX group address '
//'," + " '
/' or '' (eg.'1/2/3', '9/234', '123'), nor xknx internal" + " address 'i-'." ) @@ -104,7 +106,10 @@ ga_list_validator = vol.All(cv.ensure_list, [ga_validator]) ia_validator = vol.Any( vol.All(str, str.strip, cv.matches_regex(IndividualAddress.ADDRESS_RE.pattern)), vol.All(vol.Coerce(int), vol.Range(min=1, max=65535)), - msg="value does not match pattern for KNX individual address '..' (eg.'1.1.100')", + msg=( + "value does not match pattern for KNX individual address" + " '..' (eg.'1.1.100')" + ), ) @@ -120,7 +125,8 @@ def ip_v4_validator(value: Any, multicast: bool | None = None) -> str: raise vol.Invalid(f"value '{value}' is not a valid IPv4 address: {ex}") from ex if multicast is not None and address.is_multicast != multicast: raise vol.Invalid( - f"value '{value}' is not a valid IPv4 {'multicast' if multicast else 'unicast'} address" + f"value '{value}' is not a valid IPv4" + f" {'multicast' if multicast else 'unicast'} address" ) return str(address) @@ -433,14 +439,18 @@ class ClimateSchema(KNXPlatformSchema): vol.Inclusive( CONF_SETPOINT_SHIFT_ADDRESS, "setpoint_shift", - msg="'setpoint_shift_address' and 'setpoint_shift_state_address' " - "are required for setpoint_shift configuration", + msg=( + "'setpoint_shift_address' and 'setpoint_shift_state_address' " + "are required for setpoint_shift configuration" + ), ): ga_list_validator, vol.Inclusive( CONF_SETPOINT_SHIFT_STATE_ADDRESS, "setpoint_shift", - msg="'setpoint_shift_address' and 'setpoint_shift_state_address' " - "are required for setpoint_shift configuration", + msg=( + "'setpoint_shift_address' and 'setpoint_shift_state_address' " + "are required for setpoint_shift configuration" + ), ): ga_list_validator, vol.Optional(CONF_SETPOINT_SHIFT_MODE): vol.Maybe( vol.All(vol.Upper, cv.enum(SetpointShiftMode)) @@ -509,7 +519,10 @@ class CoverSchema(KNXPlatformSchema): { vol.Required( vol.Any(CONF_MOVE_LONG_ADDRESS, CONF_POSITION_ADDRESS), - msg=f"At least one of '{CONF_MOVE_LONG_ADDRESS}' or '{CONF_POSITION_ADDRESS}' is required.", + msg=( + f"At least one of '{CONF_MOVE_LONG_ADDRESS}' or" + f" '{CONF_POSITION_ADDRESS}' is required." + ), ): object, }, extra=vol.ALLOW_EXTRA, @@ -669,17 +682,26 @@ class LightSchema(KNXPlatformSchema): vol.Inclusive( CONF_RED, "individual_colors", - msg="'red', 'green' and 'blue' are required for individual colors configuration", + msg=( + "'red', 'green' and 'blue' are required for individual" + " colors configuration" + ), ): INDIVIDUAL_COLOR_SCHEMA, vol.Inclusive( CONF_GREEN, "individual_colors", - msg="'red', 'green' and 'blue' are required for individual colors configuration", + msg=( + "'red', 'green' and 'blue' are required for individual" + " colors configuration" + ), ): INDIVIDUAL_COLOR_SCHEMA, vol.Inclusive( CONF_BLUE, "individual_colors", - msg="'red', 'green' and 'blue' are required for individual colors configuration", + msg=( + "'red', 'green' and 'blue' are required for individual" + " colors configuration" + ), ): INDIVIDUAL_COLOR_SCHEMA, vol.Optional(CONF_WHITE): INDIVIDUAL_COLOR_SCHEMA, }, diff --git a/homeassistant/components/konnected/panel.py b/homeassistant/components/konnected/panel.py index 2c7b57449b7..61c77f5a7de 100644 --- a/homeassistant/components/konnected/panel.py +++ b/homeassistant/components/konnected/panel.py @@ -145,8 +145,10 @@ class AlarmPanel: self.connect_attempts = 0 self.connected = True _LOGGER.info( - "Set up Konnected device %s. Open http://%s:%s in a " - "web browser to view device status", + ( + "Set up Konnected device %s. Open http://%s:%s in a " + "web browser to view device status" + ), self.device_id, self.host, self.port, diff --git a/homeassistant/components/kraken/__init__.py b/homeassistant/components/kraken/__init__.py index db2baf56f97..1cfade2a6b7 100644 --- a/homeassistant/components/kraken/__init__.py +++ b/homeassistant/components/kraken/__init__.py @@ -78,7 +78,8 @@ class KrakenData: except pykrakenapi.pykrakenapi.KrakenAPIError as error: if "Unknown asset pair" in str(error): _LOGGER.info( - "Kraken.com reported an unknown asset pair. Refreshing list of tradable asset pairs" + "Kraken.com reported an unknown asset pair. Refreshing list of" + " tradable asset pairs" ) await self._async_refresh_tradable_asset_pairs() else: @@ -87,7 +88,8 @@ class KrakenData: ) from error except pykrakenapi.pykrakenapi.CallRateLimitError: _LOGGER.warning( - "Exceeded the Kraken.com call rate limit. Increase the update interval to prevent this error" + "Exceeded the Kraken.com call rate limit. Increase the update interval" + " to prevent this error" ) return None diff --git a/homeassistant/components/lacrosse_view/sensor.py b/homeassistant/components/lacrosse_view/sensor.py index 52388ca6216..7ef154015cb 100644 --- a/homeassistant/components/lacrosse_view/sensor.py +++ b/homeassistant/components/lacrosse_view/sensor.py @@ -111,7 +111,8 @@ async def async_setup_entry( if description is None: message = ( f"Unsupported sensor field: {field}\nPlease create an issue on " - "GitHub. https://github.com/home-assistant/core/issues/new?assignees=&la" + "GitHub." + " https://github.com/home-assistant/core/issues/new?assignees=&la" "bels=&template=bug_report.yml&integration_name=LaCrosse%20View&integrat" "ion_link=https://www.home-assistant.io/integrations/lacrosse_view/&addi" f"tional_information=Field:%20{field}%0ASensor%20Model:%20{sensor.model}&" diff --git a/homeassistant/components/lcn/__init__.py b/homeassistant/components/lcn/__init__.py index d4a20c4d849..2e1185fd692 100644 --- a/homeassistant/components/lcn/__init__.py +++ b/homeassistant/components/lcn/__init__.py @@ -99,8 +99,10 @@ async def async_setup_entry( return False except pypck.connection.PchkLicenseError: _LOGGER.warning( - 'Maximum number of connections on PCHK "%s" was ' - "reached. An additional license key is required", + ( + 'Maximum number of connections on PCHK "%s" was ' + "reached. An additional license key is required" + ), config_entry.title, ) return False @@ -269,7 +271,10 @@ class LcnEntity(Entity): def device_info(self) -> DeviceInfo | None: """Return device specific attributes.""" address = f"{'g' if self.address[2] else 'm'}{self.address[0]:03d}{self.address[1]:03d}" - model = f"LCN resource ({get_device_model(self.config[CONF_DOMAIN], self.config[CONF_DOMAIN_DATA])})" + model = ( + "LCN resource" + f" ({get_device_model(self.config[CONF_DOMAIN], self.config[CONF_DOMAIN_DATA])})" + ) return { "identifiers": {(DOMAIN, self.unique_id)}, diff --git a/homeassistant/components/lcn/config_flow.py b/homeassistant/components/lcn/config_flow.py index a8c5a311971..09f588b6953 100644 --- a/homeassistant/components/lcn/config_flow.py +++ b/homeassistant/components/lcn/config_flow.py @@ -81,8 +81,10 @@ class LcnFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): return self.async_abort(reason="authentication_error") except pypck.connection.PchkLicenseError: _LOGGER.warning( - 'Maximum number of connections on PCHK "%s" was ' - "reached. An additional license key is required", + ( + 'Maximum number of connections on PCHK "%s" was ' + "reached. An additional license key is required" + ), host_name, ) return self.async_abort(reason="license_error") diff --git a/homeassistant/components/led_ble/config_flow.py b/homeassistant/components/led_ble/config_flow.py index d757b5021af..55b7ed45793 100644 --- a/homeassistant/components/led_ble/config_flow.py +++ b/homeassistant/components/led_ble/config_flow.py @@ -104,7 +104,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/life360/device_tracker.py b/homeassistant/components/life360/device_tracker.py index 74ab63f88a1..f16e7215a22 100644 --- a/homeassistant/components/life360/device_tracker.py +++ b/homeassistant/components/life360/device_tracker.py @@ -152,16 +152,20 @@ class Life360DeviceTracker( if bad_last_seen or bad_accuracy: if bad_last_seen: LOGGER.warning( - "%s: Ignoring location update because " - "last_seen (%s) < previous last_seen (%s)", + ( + "%s: Ignoring location update because " + "last_seen (%s) < previous last_seen (%s)" + ), self.entity_id, last_seen, prev_seen, ) if bad_accuracy: LOGGER.warning( - "%s: Ignoring location update because " - "expected GPS accuracy (%0.1f) is not met: %i", + ( + "%s: Ignoring location update because " + "expected GPS accuracy (%0.1f) is not met: %i" + ), self.entity_id, max_gps_acc, self.location_accuracy, diff --git a/homeassistant/components/lifx/__init__.py b/homeassistant/components/lifx/__init__.py index abe35c0a0d8..b2265d81da9 100644 --- a/homeassistant/components/lifx/__init__.py +++ b/homeassistant/components/lifx/__init__.py @@ -143,7 +143,10 @@ class LIFXDiscoveryManager: if migration_complete and migrating_was_in_progress: self.migrating = False _LOGGER.debug( - "LIFX migration complete, switching to normal discovery interval: %s", + ( + "LIFX migration complete, switching to normal discovery" + " interval: %s" + ), DISCOVERY_INTERVAL, ) self.async_setup_discovery_interval() diff --git a/homeassistant/components/lifx/light.py b/homeassistant/components/lifx/light.py index 7b23e1d34c4..eb62cb8016e 100644 --- a/homeassistant/components/lifx/light.py +++ b/homeassistant/components/lifx/light.py @@ -221,7 +221,10 @@ class LIFXLight(LIFXEntity, LightEntity): Platform.SELECT, INFRARED_BRIGHTNESS ) _LOGGER.warning( - "The 'infrared' attribute of 'lifx.set_state' is deprecated: call 'select.select_option' targeting '%s' instead", + ( + "The 'infrared' attribute of 'lifx.set_state' is deprecated:" + " call 'select.select_option' targeting '%s' instead" + ), infrared_entity_id, ) bulb.set_infrared(convert_8_to_16(kwargs[ATTR_INFRARED])) diff --git a/homeassistant/components/lifx/util.py b/homeassistant/components/lifx/util.py index fde36d714d5..67190aaa599 100644 --- a/homeassistant/components/lifx/util.py +++ b/homeassistant/components/lifx/util.py @@ -110,7 +110,8 @@ def find_hsbk(hass: HomeAssistant, **kwargs: Any) -> list[float | int | None] | if ATTR_KELVIN in kwargs: _LOGGER.warning( - "The 'kelvin' parameter is deprecated. Please use 'color_temp_kelvin' for all service calls" + "The 'kelvin' parameter is deprecated. Please use 'color_temp_kelvin' for" + " all service calls" ) kelvin = kwargs.pop(ATTR_KELVIN) saturation = 0 diff --git a/homeassistant/components/light/reproduce_state.py b/homeassistant/components/light/reproduce_state.py index 46adcc1fa2e..15141b6d428 100644 --- a/homeassistant/components/light/reproduce_state.py +++ b/homeassistant/components/light/reproduce_state.py @@ -89,8 +89,9 @@ DEPRECATED_GROUP = [ ] DEPRECATION_WARNING = ( - "The use of other attributes than device state attributes is deprecated and will be removed in a future release. " - "Invalid attributes are %s. Read the logs for further details: https://www.home-assistant.io/integrations/scene/" + "The use of other attributes than device state attributes is deprecated and will be" + " removed in a future release. Invalid attributes are %s. Read the logs for further" + " details: https://www.home-assistant.io/integrations/scene/" ) diff --git a/homeassistant/components/logi_circle/__init__.py b/homeassistant/components/logi_circle/__init__.py index cabf6342fac..7e5d0df0259 100644 --- a/homeassistant/components/logi_circle/__init__.py +++ b/homeassistant/components/logi_circle/__init__.py @@ -144,8 +144,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: persistent_notification.create( hass, ( - f"Error: The cached access tokens are missing from {DEFAULT_CACHEDB}.
" - f"Please unload then re-add the Logi Circle integration to resolve." + "Error: The cached access tokens are missing from" + f" {DEFAULT_CACHEDB}.
Please unload then re-add the Logi Circle" + " integration to resolve." ), title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID, @@ -160,10 +161,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: except AuthorizationFailed: persistent_notification.create( hass, - "Error: Failed to obtain an access token from the cached " - "refresh token.
" - "Token may have expired or been revoked.
" - "Please unload then re-add the Logi Circle integration to resolve", + ( + "Error: Failed to obtain an access token from the cached " + "refresh token.
" + "Token may have expired or been revoked.
" + "Please unload then re-add the Logi Circle integration to resolve" + ), title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID, ) diff --git a/homeassistant/components/lovelace/__init__.py b/homeassistant/components/lovelace/__init__.py index c2e709aeb40..485579087a1 100644 --- a/homeassistant/components/lovelace/__init__.py +++ b/homeassistant/components/lovelace/__init__.py @@ -113,7 +113,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: if yaml_resources is not None: _LOGGER.warning( - "Lovelace is running in storage mode. Define resources via user interface" + "Lovelace is running in storage mode. Define resources via user" + " interface" ) resource_collection = resources.ResourceStorageCollection(hass, default_config) @@ -220,7 +221,8 @@ async def create_yaml_resource_col(hass, yaml_resources): else: if CONF_RESOURCES in ll_conf: _LOGGER.warning( - "Resources need to be specified in your configuration.yaml. Please see the docs" + "Resources need to be specified in your configuration.yaml. Please" + " see the docs" ) yaml_resources = ll_conf[CONF_RESOURCES] diff --git a/homeassistant/components/luftdaten/sensor.py b/homeassistant/components/luftdaten/sensor.py index 0bd595493db..67672759706 100644 --- a/homeassistant/components/luftdaten/sensor.py +++ b/homeassistant/components/luftdaten/sensor.py @@ -116,7 +116,9 @@ class SensorCommunitySensor(CoordinatorEntity, SensorEntity): ATTR_SENSOR_ID: sensor_id, } self._attr_device_info = DeviceInfo( - configuration_url=f"https://devices.sensor.community/sensors/{sensor_id}/settings", + configuration_url=( + f"https://devices.sensor.community/sensors/{sensor_id}/settings" + ), identifiers={(DOMAIN, str(sensor_id))}, name=f"Sensor {sensor_id}", manufacturer="Sensor.Community", diff --git a/homeassistant/components/lutron_caseta/logbook.py b/homeassistant/components/lutron_caseta/logbook.py index ccefaff2a78..18c46405ed0 100644 --- a/homeassistant/components/lutron_caseta/logbook.py +++ b/homeassistant/components/lutron_caseta/logbook.py @@ -51,7 +51,9 @@ def async_describe_events( if rev_button_map is None: return { LOGBOOK_ENTRY_NAME: f"{data[ATTR_AREA_NAME]} {data[ATTR_DEVICE_NAME]}", - LOGBOOK_ENTRY_MESSAGE: f"{data[ATTR_ACTION]} Error retrieving button description", + LOGBOOK_ENTRY_MESSAGE: ( + f"{data[ATTR_ACTION]} Error retrieving button description" + ), } button_description = rev_button_map.get(leap_button_number) diff --git a/homeassistant/components/lyric/climate.py b/homeassistant/components/lyric/climate.py index 8339c4dad45..a8930a14848 100644 --- a/homeassistant/components/lyric/climate.py +++ b/homeassistant/components/lyric/climate.py @@ -277,7 +277,8 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity): if device.changeableValues.autoChangeoverActive: if target_temp_low is None or target_temp_high is None: raise HomeAssistantError( - "Could not find target_temp_low and/or target_temp_high in arguments" + "Could not find target_temp_low and/or target_temp_high in" + " arguments" ) _LOGGER.debug("Set temperature: %s - %s", target_temp_low, target_temp_high) try: diff --git a/homeassistant/components/magicseaweed/sensor.py b/homeassistant/components/magicseaweed/sensor.py index 79b77a362c4..0fb2df6aaca 100644 --- a/homeassistant/components/magicseaweed/sensor.py +++ b/homeassistant/components/magicseaweed/sensor.py @@ -168,12 +168,18 @@ class MagicSeaweedSensor(SensorEntity): elif sensor_type == "max_breaking_swell": self._attr_native_value = forecast.swell_maxBreakingHeight elif sensor_type == "swell_forecast": - summary = f"{forecast.swell_minBreakingHeight} - {forecast.swell_maxBreakingHeight}" + summary = ( + f"{forecast.swell_minBreakingHeight} -" + f" {forecast.swell_maxBreakingHeight}" + ) self._attr_native_value = summary if self.hour is None: for hour, data in self.data.hourly.items(): occurs = hour - hr_summary = f"{data.swell_minBreakingHeight} - {data.swell_maxBreakingHeight} {data.swell_unit}" + hr_summary = ( + f"{data.swell_minBreakingHeight} -" + f" {data.swell_maxBreakingHeight} {data.swell_unit}" + ) self._attr_extra_state_attributes[occurs] = hr_summary if sensor_type != "swell_forecast": diff --git a/homeassistant/components/mailgun/config_flow.py b/homeassistant/components/mailgun/config_flow.py index 6fe87e7cbf4..bfeaed5ae5b 100644 --- a/homeassistant/components/mailgun/config_flow.py +++ b/homeassistant/components/mailgun/config_flow.py @@ -7,7 +7,9 @@ config_entry_flow.register_webhook_flow( DOMAIN, "Mailgun Webhook", { - "mailgun_url": "https://documentation.mailgun.com/en/latest/user_manual.html#webhooks", + "mailgun_url": ( + "https://documentation.mailgun.com/en/latest/user_manual.html#webhooks" + ), "docs_url": "https://www.home-assistant.io/integrations/mailgun/", }, ) diff --git a/homeassistant/components/maxcube/__init__.py b/homeassistant/components/maxcube/__init__.py index 04a5ee97935..f8899ea082f 100644 --- a/homeassistant/components/maxcube/__init__.py +++ b/homeassistant/components/maxcube/__init__.py @@ -69,7 +69,10 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool: _LOGGER.error("Unable to connect to Max!Cube gateway: %s", str(ex)) persistent_notification.create( hass, - f"Error: {ex}
You will need to restart Home Assistant after fixing.", + ( + f"Error: {ex}
You will need to restart Home Assistant after" + " fixing." + ), title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID, ) diff --git a/homeassistant/components/media_player/__init__.py b/homeassistant/components/media_player/__init__.py index ffe0b4e2813..fa2c5465443 100644 --- a/homeassistant/components/media_player/__init__.py +++ b/homeassistant/components/media_player/__init__.py @@ -393,12 +393,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: elif value[ATTR_MEDIA_ENQUEUE] is True: value[ATTR_MEDIA_ENQUEUE] = MediaPlayerEnqueue.ADD _LOGGER.warning( - "Playing media with enqueue set to True is deprecated. Use 'add' instead" + "Playing media with enqueue set to True is deprecated. Use 'add'" + " instead" ) elif value[ATTR_MEDIA_ENQUEUE] is False: value[ATTR_MEDIA_ENQUEUE] = MediaPlayerEnqueue.PLAY _LOGGER.warning( - "Playing media with enqueue set to False is deprecated. Use 'play' instead" + "Playing media with enqueue set to False is deprecated. Use 'play'" + " instead" ) return value diff --git a/homeassistant/components/melcloud/climate.py b/homeassistant/components/melcloud/climate.py index 323108cd5c5..2cac1abcf88 100644 --- a/homeassistant/components/melcloud/climate.py +++ b/homeassistant/components/melcloud/climate.py @@ -240,7 +240,8 @@ class AtaDeviceClimate(MelCloudClimate): """Set horizontal vane position.""" if position not in self._device.vane_horizontal_positions: raise ValueError( - f"Invalid horizontal vane position {position}. Valid positions: [{self._device.vane_horizontal_positions}]." + f"Invalid horizontal vane position {position}. Valid positions:" + f" [{self._device.vane_horizontal_positions}]." ) await self._device.set({ata.PROPERTY_VANE_HORIZONTAL: position}) @@ -248,7 +249,8 @@ class AtaDeviceClimate(MelCloudClimate): """Set vertical vane position.""" if position not in self._device.vane_vertical_positions: raise ValueError( - f"Invalid vertical vane position {position}. Valid positions: [{self._device.vane_vertical_positions}]." + f"Invalid vertical vane position {position}. Valid positions:" + f" [{self._device.vane_vertical_positions}]." ) await self._device.set({ata.PROPERTY_VANE_VERTICAL: position}) diff --git a/homeassistant/components/meteo_france/__init__.py b/homeassistant/components/meteo_france/__init__.py index 1d36746413e..6c9af12a322 100644 --- a/homeassistant/components/meteo_france/__init__.py +++ b/homeassistant/components/meteo_france/__init__.py @@ -139,13 +139,19 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.data[DOMAIN][department] = True else: _LOGGER.warning( - "Weather alert for department %s won't be added with city %s, as it has already been added within another city", + ( + "Weather alert for department %s won't be added with city %s, as it" + " has already been added within another city" + ), department, entry.title, ) else: _LOGGER.warning( - "Weather alert not available: The city %s is not in metropolitan France or Andorre", + ( + "Weather alert not available: The city %s is not in metropolitan France" + " or Andorre" + ), entry.title, ) @@ -172,7 +178,10 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ].data.position.get("dept") hass.data[DOMAIN][department] = False _LOGGER.debug( - "Weather alert for depatment %s unloaded and released. It can be added now by another city", + ( + "Weather alert for depatment %s unloaded and released. It can be added" + " now by another city" + ), department, ) diff --git a/homeassistant/components/minecraft_server/__init__.py b/homeassistant/components/minecraft_server/__init__.py index b2f7698d969..dad8ebe7f11 100644 --- a/homeassistant/components/minecraft_server/__init__.py +++ b/homeassistant/components/minecraft_server/__init__.py @@ -143,7 +143,10 @@ class MinecraftServer: self.online = True except OSError as error: _LOGGER.debug( - "Error occurred while trying to check the connection to '%s:%s' - OSError: %s", + ( + "Error occurred while trying to check the connection to '%s:%s' -" + " OSError: %s" + ), self.host, self.port, error, diff --git a/homeassistant/components/mobile_app/webhook.py b/homeassistant/components/mobile_app/webhook.py index 2dd578a3fea..107058352c1 100644 --- a/homeassistant/components/mobile_app/webhook.py +++ b/homeassistant/components/mobile_app/webhook.py @@ -268,8 +268,10 @@ async def webhook_call_service( ) except (vol.Invalid, ServiceNotFound, Exception) as ex: _LOGGER.error( - "Error when calling service during mobile_app " - "webhook (device name: %s): %s", + ( + "Error when calling service during mobile_app " + "webhook (device name: %s): %s" + ), config_entry.data[ATTR_DEVICE_NAME], ex, ) diff --git a/homeassistant/components/modbus/base_platform.py b/homeassistant/components/modbus/base_platform.py index 0727fa81e44..9463847a4ee 100644 --- a/homeassistant/components/modbus/base_platform.py +++ b/homeassistant/components/modbus/base_platform.py @@ -322,7 +322,10 @@ class BaseSwitch(BasePlatform, ToggleEntity, RestoreEntity): self._attr_is_on = False elif value is not None: _LOGGER.error( - "Unexpected response from modbus device slave %s register %s, got 0x%2x", + ( + "Unexpected response from modbus device slave %s register %s," + " got 0x%2x" + ), self._slave, self._verify_address, value, diff --git a/homeassistant/components/modbus/validators.py b/homeassistant/components/modbus/validators.py index 315e138e130..84e2e6d06b5 100644 --- a/homeassistant/components/modbus/validators.py +++ b/homeassistant/components/modbus/validators.py @@ -111,7 +111,7 @@ def struct_validator(config: dict[str, Any]) -> dict[str, Any]: if count < regs_needed or (count % regs_needed) != 0: raise vol.Invalid( f"Error in sensor {name} swap({swap_type}) " - f"not possible due to the registers " + "not possible due to the registers " f"count: {count}, needed: {regs_needed}" ) @@ -153,8 +153,10 @@ def scan_interval_validator(config: dict) -> dict: continue if scan_interval < 5: _LOGGER.warning( - "%s %s scan_interval(%d) is lower than 5 seconds, " - "which may cause Home Assistant stability issues", + ( + "%s %s scan_interval(%d) is lower than 5 seconds, " + "which may cause Home Assistant stability issues" + ), component, entry.get(CONF_NAME), scan_interval, @@ -198,11 +200,17 @@ def duplicate_entity_validator(config: dict) -> dict: addr += "_" + str(entry[CONF_COMMAND_OFF]) addr += "_" + str(entry.get(CONF_SLAVE, 0)) if addr in addresses: - err = f"Modbus {component}/{name} address {addr} is duplicate, second entry not loaded!" + err = ( + f"Modbus {component}/{name} address {addr} is duplicate, second" + " entry not loaded!" + ) _LOGGER.warning(err) errors.append(index) elif name in names: - err = f"Modbus {component}/{name}  is duplicate, second entry not loaded!" + err = ( + f"Modbus {component}/{name}  is duplicate, second entry not" + " loaded!" + ) _LOGGER.warning(err) errors.append(index) else: diff --git a/homeassistant/components/modern_forms/__init__.py b/homeassistant/components/modern_forms/__init__.py index 9b425f61ad0..d00fe793bf8 100644 --- a/homeassistant/components/modern_forms/__init__.py +++ b/homeassistant/components/modern_forms/__init__.py @@ -145,5 +145,8 @@ class ModernFormsDeviceEntity(CoordinatorEntity[ModernFormsDataUpdateCoordinator name=self.coordinator.data.info.device_name, manufacturer="Modern Forms", model=self.coordinator.data.info.fan_type, - sw_version=f"{self.coordinator.data.info.firmware_version} / {self.coordinator.data.info.main_mcu_firmware_version}", + sw_version=( + f"{self.coordinator.data.info.firmware_version} /" + f" {self.coordinator.data.info.main_mcu_firmware_version}" + ), ) diff --git a/homeassistant/components/moehlenhoff_alpha2/sensor.py b/homeassistant/components/moehlenhoff_alpha2/sensor.py index d26786e1923..e41c6b041f6 100644 --- a/homeassistant/components/moehlenhoff_alpha2/sensor.py +++ b/homeassistant/components/moehlenhoff_alpha2/sensor.py @@ -46,7 +46,10 @@ class Alpha2HeatControlValveOpeningSensor( self._attr_unique_id = f"{heat_control_id}:valve_opening" heat_control = self.coordinator.data["heat_controls"][heat_control_id] heat_area = self.coordinator.data["heat_areas"][heat_control["_HEATAREA_ID"]] - self._attr_name = f"{heat_area['HEATAREA_NAME']} heat control {heat_control['NR']} valve opening" + self._attr_name = ( + f"{heat_area['HEATAREA_NAME']} heat control {heat_control['NR']} valve" + " opening" + ) @property def native_value(self) -> int: diff --git a/homeassistant/components/motion_blinds/__init__.py b/homeassistant/components/motion_blinds/__init__.py index a023fc05d14..378a2f1f03d 100644 --- a/homeassistant/components/motion_blinds/__init__.py +++ b/homeassistant/components/motion_blinds/__init__.py @@ -135,8 +135,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: data = {**entry.data, CONF_INTERFACE: working_interface} hass.config_entries.async_update_entry(entry, data=data) _LOGGER.debug( - "Motion Blinds interface updated from %s to %s, " - "this should only occur after a network change", + ( + "Motion Blinds interface updated from %s to %s, " + "this should only occur after a network change" + ), multicast_interface, working_interface, ) diff --git a/homeassistant/components/motion_blinds/gateway.py b/homeassistant/components/motion_blinds/gateway.py index 96a85246666..ac18840ddeb 100644 --- a/homeassistant/components/motion_blinds/gateway.py +++ b/homeassistant/components/motion_blinds/gateway.py @@ -133,7 +133,10 @@ class ConnectMotionGateway: return interface _LOGGER.error( - "Could not find working interface for Motion Blinds host %s, using interface '%s'", + ( + "Could not find working interface for Motion Blinds host %s, using" + " interface '%s'" + ), host, self._interface, ) diff --git a/homeassistant/components/motioneye/const.py b/homeassistant/components/motioneye/const.py index 37e751236da..ebe4e24d6cf 100644 --- a/homeassistant/components/motioneye/const.py +++ b/homeassistant/components/motioneye/const.py @@ -89,8 +89,8 @@ SERVICE_SET_TEXT_OVERLAY: Final = "set_text_overlay" SERVICE_ACTION: Final = "action" SERVICE_SNAPSHOT: Final = "snapshot" -SIGNAL_CAMERA_ADD: Final = f"{DOMAIN}_camera_add_signal." "{}" -SIGNAL_CAMERA_REMOVE: Final = f"{DOMAIN}_camera_remove_signal." "{}" +SIGNAL_CAMERA_ADD: Final = f"{DOMAIN}_camera_add_signal.{{}}" +SIGNAL_CAMERA_REMOVE: Final = f"{DOMAIN}_camera_remove_signal.{{}}" TYPE_MOTIONEYE_ACTION_SENSOR = f"{DOMAIN}_action_sensor" TYPE_MOTIONEYE_MJPEG_CAMERA: Final = "motioneye_mjpeg_camera" diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index bb4b3e09015..3f6f2122757 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -240,8 +240,10 @@ def _filter_entry_config(hass: HomeAssistant, entry: ConfigEntry) -> None: } if entry.data.keys() != filtered_data.keys(): _LOGGER.warning( - "The following unsupported configuration options were removed from the " - "MQTT config entry: %s", + ( + "The following unsupported configuration options were removed from the " + "MQTT config entry: %s" + ), entry.data.keys() - filtered_data.keys(), ) hass.config_entries.async_update_entry(entry, data=filtered_data) @@ -329,8 +331,10 @@ async def async_fetch_config( override[CONF_CLIENT_KEY] = "-----PRIVATE KEY-----" if override: _LOGGER.warning( - "Deprecated configuration settings found in configuration.yaml. " - "These settings from your configuration entry will override: %s", + ( + "Deprecated configuration settings found in configuration.yaml. " + "These settings from your configuration entry will override: %s" + ), override, ) # Register a repair issue @@ -389,16 +393,20 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: msg_topic = valid_publish_topic(rendered_topic) except (jinja2.TemplateError, TemplateError) as exc: _LOGGER.error( - "Unable to publish: rendering topic template of %s " - "failed because %s", + ( + "Unable to publish: rendering topic template of %s " + "failed because %s" + ), msg_topic_template, exc, ) return except vol.Invalid as err: _LOGGER.error( - "Unable to publish: topic template '%s' produced an " - "invalid topic '%s' after rendering (%s)", + ( + "Unable to publish: topic template '%s' produced an " + "invalid topic '%s' after rendering (%s)" + ), msg_topic_template, rendered_topic, err, @@ -412,8 +420,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ).async_render() except (jinja2.TemplateError, TemplateError) as exc: _LOGGER.error( - "Unable to publish to %s: rendering payload template of " - "%s failed because %s", + ( + "Unable to publish to %s: rendering payload template of " + "%s failed because %s" + ), msg_topic, payload_template, exc, diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index 85ff6e959b3..f604bbbdd64 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -145,7 +145,10 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity): self.hass, self._value_is_expired, expiration_at ) _LOGGER.debug( - "State recovered after reload for %s, remaining time before expiring %s", + ( + "State recovered after reload for %s, remaining time before" + " expiring %s" + ), self.entity_id, expiration_at - time_now, ) @@ -215,7 +218,10 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity): payload = self._value_template(msg.payload) if not payload.strip(): # No output from template, ignore _LOGGER.debug( - "Empty template output for entity: %s with state topic: %s. Payload: '%s', with value template '%s'", + ( + "Empty template output for entity: %s with state topic: %s." + " Payload: '%s', with value template '%s'" + ), self._config[CONF_NAME], self._config[CONF_STATE_TOPIC], msg.payload, @@ -232,9 +238,15 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity): else: # Payload is not for this entity template_info = "" if self._config.get(CONF_VALUE_TEMPLATE) is not None: - template_info = f", template output: '{str(payload)}', with value template '{str(self._config.get(CONF_VALUE_TEMPLATE))}'" + template_info = ( + f", template output: '{str(payload)}', with value template" + f" '{str(self._config.get(CONF_VALUE_TEMPLATE))}'" + ) _LOGGER.info( - "No matching payload found for entity: %s with state topic: %s. Payload: '%s'%s", + ( + "No matching payload found for entity: %s with state topic: %s." + " Payload: '%s'%s" + ), self._config[CONF_NAME], self._config[CONF_STATE_TOPIC], msg.payload,