mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Remove unnecessary string literal concatenations (#30360)
This commit is contained in:
parent
cac750066a
commit
e6388e186c
@ -78,11 +78,7 @@ def ensure_config_path(config_dir: str) -> None:
|
||||
try:
|
||||
os.mkdir(lib_dir)
|
||||
except OSError:
|
||||
print(
|
||||
("Fatal Error: Unable to create library " "directory {} ").format(
|
||||
lib_dir
|
||||
)
|
||||
)
|
||||
print("Fatal Error: Unable to create library directory {}".format(lib_dir))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@ -147,7 +143,7 @@ def get_arguments() -> argparse.Namespace:
|
||||
"--log-file",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Log file to write to. If not set, CONFIG/home-assistant.log " "is used",
|
||||
help="Log file to write to. If not set, CONFIG/home-assistant.log is used",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--log-no-color", action="store_true", help="Disable color logs"
|
||||
|
@ -76,7 +76,7 @@ class CommandLineAuthProvider(AuthProvider):
|
||||
|
||||
if process.returncode != 0:
|
||||
_LOGGER.error(
|
||||
"User %r failed to authenticate, command exited " "with code %d.",
|
||||
"User %r failed to authenticate, command exited with code %d.",
|
||||
username,
|
||||
process.returncode,
|
||||
)
|
||||
|
@ -66,7 +66,7 @@ async def async_from_config_dict(
|
||||
hass.config.skip_pip = skip_pip
|
||||
if skip_pip:
|
||||
_LOGGER.warning(
|
||||
"Skipping pip installation of required modules. " "This may cause issues"
|
||||
"Skipping pip installation of required modules. This may cause issues"
|
||||
)
|
||||
|
||||
core_config = config.get(core.DOMAIN, {})
|
||||
@ -168,7 +168,7 @@ def async_enable_logging(
|
||||
|
||||
This method must be run in the event loop.
|
||||
"""
|
||||
fmt = "%(asctime)s %(levelname)s (%(threadName)s) " "[%(name)s] %(message)s"
|
||||
fmt = "%(asctime)s %(levelname)s (%(threadName)s) [%(name)s] %(message)s"
|
||||
datefmt = "%Y-%m-%d %H:%M:%S"
|
||||
|
||||
if not log_no_color:
|
||||
|
@ -51,7 +51,7 @@ class Auth:
|
||||
"client_secret": self.client_secret,
|
||||
}
|
||||
_LOGGER.debug(
|
||||
"Calling LWA to get the access token (first time), " "with: %s",
|
||||
"Calling LWA to get the access token (first time), with: %s",
|
||||
json.dumps(lwa_params),
|
||||
)
|
||||
|
||||
|
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
response = requests.get(resource, timeout=10).json()
|
||||
except requests.exceptions.MissingSchema:
|
||||
_LOGGER.error(
|
||||
"Missing resource or schema in configuration. " "Add http:// to your URL"
|
||||
"Missing resource or schema in configuration. Add http:// to your URL"
|
||||
)
|
||||
return False
|
||||
except requests.exceptions.ConnectionError:
|
||||
|
@ -59,7 +59,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
response = requests.get(resource, timeout=10).json()
|
||||
except requests.exceptions.MissingSchema:
|
||||
_LOGGER.error(
|
||||
"Missing resource or schema in configuration. " "Add http:// to your URL"
|
||||
"Missing resource or schema in configuration. Add http:// to your URL"
|
||||
)
|
||||
return False
|
||||
except requests.exceptions.ConnectionError:
|
||||
|
@ -46,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
response = requests.get(resource, timeout=10)
|
||||
except requests.exceptions.MissingSchema:
|
||||
_LOGGER.error(
|
||||
"Missing resource or schema in configuration. " "Add http:// to your URL"
|
||||
"Missing resource or schema in configuration. Add http:// to your URL"
|
||||
)
|
||||
return False
|
||||
except requests.exceptions.ConnectionError:
|
||||
|
@ -254,7 +254,7 @@ class AugustData:
|
||||
)
|
||||
except RequestException as ex:
|
||||
_LOGGER.error(
|
||||
"Request error trying to retrieve doorbell" " status for %s. %s",
|
||||
"Request error trying to retrieve doorbell status for %s. %s",
|
||||
doorbell.device_name,
|
||||
ex,
|
||||
)
|
||||
@ -301,7 +301,7 @@ class AugustData:
|
||||
)
|
||||
except RequestException as ex:
|
||||
_LOGGER.error(
|
||||
"Request error trying to retrieve door" " status for %s. %s",
|
||||
"Request error trying to retrieve door status for %s. %s",
|
||||
lock.device_name,
|
||||
ex,
|
||||
)
|
||||
@ -327,7 +327,7 @@ class AugustData:
|
||||
)
|
||||
except RequestException as ex:
|
||||
_LOGGER.error(
|
||||
"Request error trying to retrieve door" " status for %s. %s",
|
||||
"Request error trying to retrieve door status for %s. %s",
|
||||
lock.device_name,
|
||||
ex,
|
||||
)
|
||||
@ -342,7 +342,7 @@ class AugustData:
|
||||
)
|
||||
except RequestException as ex:
|
||||
_LOGGER.error(
|
||||
"Request error trying to retrieve door" " details for %s. %s",
|
||||
"Request error trying to retrieve door details for %s. %s",
|
||||
lock.device_name,
|
||||
ex,
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTRIBUTION = "Data provided by the National Oceanic and Atmospheric " "Administration"
|
||||
ATTRIBUTION = "Data provided by the National Oceanic and Atmospheric Administration"
|
||||
CONF_THRESHOLD = "forecast_threshold"
|
||||
|
||||
DEFAULT_DEVICE_CLASS = "visible"
|
||||
|
@ -99,7 +99,7 @@ async def fetch_redirect_uris(hass, url):
|
||||
pass
|
||||
except aiohttp.client_exceptions.ClientConnectionError:
|
||||
_LOGGER.error(
|
||||
("Low level connection error while looking up " "redirect_uri %s"), url
|
||||
"Low level connection error while looking up redirect_uri %s", url
|
||||
)
|
||||
pass
|
||||
except aiohttp.client_exceptions.ClientError:
|
||||
|
@ -232,7 +232,7 @@ class AutomaticData:
|
||||
if event.created_at < self.vehicle_seen[event.vehicle.id]:
|
||||
# Skip events received out of order
|
||||
_LOGGER.debug(
|
||||
"Skipping out of order event. Event Created %s. " "Last seen event: %s",
|
||||
"Skipping out of order event. Event Created %s. Last seen event: %s",
|
||||
event.created_at,
|
||||
self.vehicle_seen[event.vehicle.id],
|
||||
)
|
||||
|
@ -275,7 +275,7 @@ class AutomationEntity(ToggleEntity, RestoreEntity):
|
||||
else:
|
||||
enable_automation = DEFAULT_INITIAL_STATE
|
||||
_LOGGER.debug(
|
||||
"Automation %s not in state storage, state %s from " "default is used.",
|
||||
"Automation %s not in state storage, state %s from default is used.",
|
||||
self.entity_id,
|
||||
enable_automation,
|
||||
)
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.util import dt as dt_util
|
||||
CONF_DIMENSION = "dimension"
|
||||
CONF_DELTA = "delta"
|
||||
|
||||
RADAR_MAP_URL_TEMPLATE = "https://api.buienradar.nl/image/1.0/" "RadarMapNL?w={w}&h={h}"
|
||||
RADAR_MAP_URL_TEMPLATE = "https://api.buienradar.nl/image/1.0/RadarMapNL?w={w}&h={h}"
|
||||
|
||||
_LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -115,7 +115,7 @@ class BrData:
|
||||
if raincontent.get(SUCCESS) is not True:
|
||||
# unable to get the data
|
||||
_LOGGER.warning(
|
||||
"Unable to retrieve raindata from Buienradar." "(Msg: %s, status: %s,)",
|
||||
"Unable to retrieve raindata from Buienradar. (Msg: %s, status: %s)",
|
||||
raincontent.get(MESSAGE),
|
||||
raincontent.get(STATUS_CODE),
|
||||
)
|
||||
@ -136,7 +136,7 @@ class BrData:
|
||||
if result.get(SUCCESS) is not True:
|
||||
if int(datetime.now().strftime("%H")) > 0:
|
||||
_LOGGER.warning(
|
||||
"Unable to parse data from Buienradar." "(Msg: %s)",
|
||||
"Unable to parse data from Buienradar. (Msg: %s)",
|
||||
result.get(MESSAGE),
|
||||
)
|
||||
await self.schedule_update(SCHEDULE_NOK)
|
||||
|
@ -168,7 +168,7 @@ async def async_get_still_stream(request, image_cb, content_type, interval):
|
||||
This method must be run in the event loop.
|
||||
"""
|
||||
response = web.StreamResponse()
|
||||
response.content_type = "multipart/x-mixed-replace; " "boundary=--frameboundary"
|
||||
response.content_type = "multipart/x-mixed-replace; boundary=--frameboundary"
|
||||
await response.prepare(request)
|
||||
|
||||
async def write_to_mjpeg_stream(img_bytes):
|
||||
|
@ -89,5 +89,5 @@ class CiscoMEDeviceScanner(DeviceScanner):
|
||||
"""Check the Cisco ME controller for devices."""
|
||||
self.last_results = self.controller.get_associated_devices()
|
||||
_LOGGER.debug(
|
||||
"Cisco Mobility Express controller returned:" " %s", self.last_results
|
||||
"Cisco Mobility Express controller returned: %s", self.last_results
|
||||
)
|
||||
|
@ -54,5 +54,5 @@ class CiscoWebexTeamsNotificationService(BaseNotificationService):
|
||||
self.client.messages.create(roomId=self.room, html=f"{title}{message}")
|
||||
except ApiError as api_error:
|
||||
_LOGGER.error(
|
||||
"Could not send CiscoWebexTeams notification. " "Error: %s", api_error
|
||||
"Could not send CiscoWebexTeams notification. Error: %s", api_error
|
||||
)
|
||||
|
@ -57,7 +57,7 @@ SCAN_INTERVAL = timedelta(minutes=5) # Timely, and doesn't suffocate the API
|
||||
STATIONS_URI = "v2/networks/{uid}?fields=network.stations"
|
||||
|
||||
CITYBIKES_ATTRIBUTION = (
|
||||
"Information provided by the CityBikes Project " "(https://citybik.es/#about)"
|
||||
"Information provided by the CityBikes Project (https://citybik.es/#about)"
|
||||
)
|
||||
|
||||
CITYBIKES_NETWORKS = "citybikes_networks"
|
||||
@ -143,9 +143,7 @@ async def async_citybikes_request(hass, uri, schema):
|
||||
except ValueError:
|
||||
_LOGGER.error("Received non-JSON data from CityBikes API endpoint")
|
||||
except vol.Invalid as err:
|
||||
_LOGGER.error(
|
||||
"Received unexpected JSON from CityBikes" " API endpoint: %s", err
|
||||
)
|
||||
_LOGGER.error("Received unexpected JSON from CityBikes API endpoint: %s", err)
|
||||
raise CityBikesRequestError
|
||||
|
||||
|
||||
|
@ -583,7 +583,7 @@ async def alexa_sync(hass, connection, msg):
|
||||
connection.send_error(
|
||||
msg["id"],
|
||||
"alexa_relink",
|
||||
"Please go to the Alexa app and re-link the Home Assistant " "skill.",
|
||||
"Please go to the Alexa app and re-link the Home Assistant skill.",
|
||||
)
|
||||
return
|
||||
|
||||
|
@ -94,5 +94,5 @@ class CoinbaseData:
|
||||
self.exchange_rates = self.client.get_exchange_rates()
|
||||
except AuthenticationError as coinbase_error:
|
||||
_LOGGER.error(
|
||||
"Authentication error connecting" " to coinbase: %s", coinbase_error
|
||||
"Authentication error connecting to coinbase: %s", coinbase_error
|
||||
)
|
||||
|
@ -62,8 +62,7 @@ def retry(method):
|
||||
return method(device, *args, **kwargs)
|
||||
except (decora.decoraException, AttributeError, BTLEException):
|
||||
_LOGGER.warning(
|
||||
"Decora connect error for device %s. " "Reconnecting...",
|
||||
device.name,
|
||||
"Decora connect error for device %s. Reconnecting...", device.name,
|
||||
)
|
||||
# pylint: disable=protected-access
|
||||
device._switch.connect()
|
||||
|
@ -340,7 +340,7 @@ class DemoMusicPlayer(AbstractDemoPlayer):
|
||||
@property
|
||||
def media_image_url(self):
|
||||
"""Return the image url of current playing media."""
|
||||
return "https://graph.facebook.com/v2.5/107771475912710/" "picture?type=large"
|
||||
return "https://graph.facebook.com/v2.5/107771475912710/picture?type=large"
|
||||
|
||||
@property
|
||||
def media_title(self):
|
||||
|
@ -129,7 +129,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
)
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
"Adding discovered device %s with" " client address %s",
|
||||
"Adding discovered device %s with client address %s",
|
||||
str.title(loc["locationName"]),
|
||||
loc["clientAddr"],
|
||||
)
|
||||
@ -214,7 +214,7 @@ class DirecTvDevice(MediaPlayerDevice):
|
||||
|
||||
except requests.RequestException as ex:
|
||||
_LOGGER.error(
|
||||
"%s: Request error trying to update current status: " "%s",
|
||||
"%s: Request error trying to update current status: %s",
|
||||
self.entity_id,
|
||||
ex,
|
||||
)
|
||||
|
@ -89,7 +89,7 @@ def setup(hass, config):
|
||||
# Not yet reliable
|
||||
for device in dyson_devices:
|
||||
_LOGGER.info(
|
||||
"Trying to connect to device %s with timeout=%i " "and retry=%i",
|
||||
"Trying to connect to device %s with timeout=%i and retry=%i",
|
||||
device,
|
||||
timeout,
|
||||
retry,
|
||||
|
@ -91,7 +91,7 @@ def setup(hass, hass_config):
|
||||
if ecoal_contr.version is None:
|
||||
# Wrong credentials nor network config
|
||||
_LOGGER.error(
|
||||
"Unable to read controller status from %s@%s" " (wrong host/credentials)",
|
||||
"Unable to read controller status from %s@%s (wrong host/credentials)",
|
||||
username,
|
||||
host,
|
||||
)
|
||||
|
@ -550,7 +550,7 @@ class Thermostat(ClimateDevice):
|
||||
self.hold_preference(),
|
||||
)
|
||||
_LOGGER.debug(
|
||||
"Setting ecobee hold_temp to: heat=%s, is=%s, " "cool=%s, is=%s",
|
||||
"Setting ecobee hold_temp to: heat=%s, is=%s, cool=%s, is=%s",
|
||||
heat_temp,
|
||||
isinstance(heat_temp, (int, float)),
|
||||
cool_temp,
|
||||
|
@ -139,7 +139,7 @@ class EgardiaAlarm(alarm.AlarmControlPanel):
|
||||
self._egardiasystem.alarm_disarm()
|
||||
except requests.exceptions.RequestException as err:
|
||||
_LOGGER.error(
|
||||
"Egardia device exception occurred when " "sending disarm command: %s",
|
||||
"Egardia device exception occurred when sending disarm command: %s",
|
||||
err,
|
||||
)
|
||||
|
||||
|
@ -130,7 +130,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
||||
# ESPHome uses servicecall packet for both events and service calls
|
||||
# Ensure the user can only send events of form 'esphome.xyz'
|
||||
if domain != "esphome":
|
||||
_LOGGER.error("Can only generate events under esphome " "domain!")
|
||||
_LOGGER.error("Can only generate events under esphome domain!")
|
||||
return
|
||||
hass.bus.async_fire(service.service, service_data)
|
||||
else:
|
||||
|
@ -131,7 +131,7 @@ class FeedManager:
|
||||
"""Filter the entries provided and return the ones to keep."""
|
||||
if len(self._feed.entries) > self._max_entries:
|
||||
_LOGGER.debug(
|
||||
"Processing only the first %s entries " "in feed %s",
|
||||
"Processing only the first %s entries in feed %s",
|
||||
self._max_entries,
|
||||
self._url,
|
||||
)
|
||||
|
@ -134,11 +134,11 @@ class FibaroController:
|
||||
info = self._client.info.get()
|
||||
self.hub_serial = slugify(info.serialNumber)
|
||||
except AssertionError:
|
||||
_LOGGER.error("Can't connect to Fibaro HC. " "Please check URL.")
|
||||
_LOGGER.error("Can't connect to Fibaro HC. Please check URL.")
|
||||
return False
|
||||
if login is None or login.status is False:
|
||||
_LOGGER.error(
|
||||
"Invalid login for Fibaro HC. " "Please check username and password"
|
||||
"Invalid login for Fibaro HC. Please check username and password"
|
||||
)
|
||||
return False
|
||||
|
||||
@ -380,7 +380,7 @@ class FibaroDevice(Entity):
|
||||
def dont_know_message(self, action):
|
||||
"""Make a warning in case we don't know how to perform an action."""
|
||||
_LOGGER.warning(
|
||||
"Not sure how to setValue: %s " "(available actions: %s)",
|
||||
"Not sure how to setValue: %s (available actions: %s)",
|
||||
str(self.ha_id),
|
||||
str(self.fibaro_device.actions),
|
||||
)
|
||||
|
@ -323,7 +323,7 @@ class FluxSwitch(SwitchDevice, RestoreEntity):
|
||||
elif self._mode == MODE_RGB:
|
||||
await async_set_lights_rgb(self.hass, self._lights, rgb, self._transition)
|
||||
_LOGGER.debug(
|
||||
"Lights updated to rgb:%s, %s%% " "of %s cycle complete at %s",
|
||||
"Lights updated to rgb:%s, %s%% of %s cycle complete at %s",
|
||||
rgb,
|
||||
round(percentage_complete * 100),
|
||||
time_state,
|
||||
|
@ -103,7 +103,7 @@ class FoursquarePushReceiver(HomeAssistantView):
|
||||
|
||||
if self.push_secret != secret:
|
||||
_LOGGER.error(
|
||||
"Received Foursquare push with invalid" "push secret: %s", secret
|
||||
"Received Foursquare push with invalid push secret: %s", secret
|
||||
)
|
||||
return self.json_message("Incorrect secret", HTTP_BAD_REQUEST)
|
||||
|
||||
|
@ -60,7 +60,7 @@ class FritzBoxScanner(DeviceScanner):
|
||||
self._update_info()
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Failed to establish connection to FRITZ!Box " "with IP: %s", self.host
|
||||
"Failed to establish connection to FRITZ!Box with IP: %s", self.host
|
||||
)
|
||||
|
||||
def scan_devices(self):
|
||||
|
@ -214,7 +214,7 @@ class GenericThermostat(ClimateDevice, RestoreEntity):
|
||||
else:
|
||||
self._target_temp = self.min_temp
|
||||
_LOGGER.warning(
|
||||
"Undefined target temperature," "falling back to %s",
|
||||
"Undefined target temperature, falling back to %s",
|
||||
self._target_temp,
|
||||
)
|
||||
else:
|
||||
|
@ -369,7 +369,7 @@ class HarmonyRemote(remote.RemoteDevice):
|
||||
|
||||
for result in result_list:
|
||||
_LOGGER.error(
|
||||
"Sending command %s to device %s failed with code " "%s: %s",
|
||||
"Sending command %s to device %s failed with code %s: %s",
|
||||
result.command.command,
|
||||
result.command.device,
|
||||
result.code,
|
||||
|
@ -178,7 +178,7 @@ class HaveIBeenPwnedData:
|
||||
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Failed fetching data for %s" "(HTTP Status_code = %d)",
|
||||
"Failed fetching data for %s (HTTP Status_code = %d)",
|
||||
self._email,
|
||||
req.status_code,
|
||||
)
|
||||
|
@ -45,7 +45,7 @@ def exactly_two_period_keys(conf):
|
||||
"""Ensure exactly 2 of CONF_PERIOD_KEYS are provided."""
|
||||
if sum(param in conf for param in CONF_PERIOD_KEYS) != 2:
|
||||
raise vol.Invalid(
|
||||
"You must provide exactly 2 of the following:" " start, end, duration"
|
||||
"You must provide exactly 2 of the following: start, end, duration"
|
||||
)
|
||||
return conf
|
||||
|
||||
@ -262,7 +262,7 @@ class HistoryStatsSensor(Entity):
|
||||
)
|
||||
except ValueError:
|
||||
_LOGGER.error(
|
||||
"Parsing error: start must be a datetime" "or a timestamp"
|
||||
"Parsing error: start must be a datetime or a timestamp"
|
||||
)
|
||||
return
|
||||
|
||||
@ -281,7 +281,7 @@ class HistoryStatsSensor(Entity):
|
||||
)
|
||||
except ValueError:
|
||||
_LOGGER.error(
|
||||
"Parsing error: end must be a datetime " "or a timestamp"
|
||||
"Parsing error: end must be a datetime or a timestamp"
|
||||
)
|
||||
return
|
||||
|
||||
|
@ -328,7 +328,7 @@ class HomeKit:
|
||||
aid = generate_aid(entity_id)
|
||||
if aid not in self.bridge.accessories:
|
||||
_LOGGER.warning(
|
||||
"Could not reset accessory. entity_id " "not found %s", entity_id
|
||||
"Could not reset accessory. entity_id not found %s", entity_id
|
||||
)
|
||||
continue
|
||||
acc = self.remove_bridge_accessory(aid)
|
||||
|
@ -422,7 +422,7 @@ class TelevisionMediaPlayer(HomeAccessory):
|
||||
self.char_input_source.set_value(index)
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
"%s: Sources out of sync. " "Restart HomeAssistant",
|
||||
"%s: Sources out of sync. Restart HomeAssistant",
|
||||
self.entity_id,
|
||||
)
|
||||
self.char_input_source.set_value(0)
|
||||
|
@ -103,7 +103,7 @@ def validate_entity_config(values):
|
||||
|
||||
if not isinstance(config, dict):
|
||||
raise vol.Invalid(
|
||||
"The configuration for {} must be " " a dictionary.".format(entity)
|
||||
"The configuration for {} must be a dictionary.".format(entity)
|
||||
)
|
||||
|
||||
if domain in ("alarm_control_panel", "lock"):
|
||||
|
@ -345,12 +345,12 @@ class HTML5PushCallbackView(HomeAssistantView):
|
||||
|
||||
if parts[0].lower() != "bearer":
|
||||
return self.json_message(
|
||||
"Authorization header must " "start with Bearer",
|
||||
"Authorization header must start with Bearer",
|
||||
status_code=HTTP_UNAUTHORIZED,
|
||||
)
|
||||
if len(parts) != 2:
|
||||
return self.json_message(
|
||||
"Authorization header must " "be Bearer token",
|
||||
"Authorization header must be Bearer token",
|
||||
status_code=HTTP_UNAUTHORIZED,
|
||||
)
|
||||
|
||||
@ -507,7 +507,7 @@ class HTML5NotificationService(BaseNotificationService):
|
||||
info = REGISTER_SCHEMA(info)
|
||||
except vol.Invalid:
|
||||
_LOGGER.error(
|
||||
"%s is not a valid HTML5 push notification" " target", target
|
||||
"%s is not a valid HTML5 push notification target", target
|
||||
)
|
||||
continue
|
||||
payload[ATTR_DATA][ATTR_JWT] = add_jwt(
|
||||
|
@ -96,7 +96,7 @@ async def process_wrong_login(request):
|
||||
"""
|
||||
remote_addr = request[KEY_REAL_IP]
|
||||
|
||||
msg = "Login attempt or request with invalid authentication " "from {}".format(
|
||||
msg = "Login attempt or request with invalid authentication from {}".format(
|
||||
remote_addr
|
||||
)
|
||||
_LOGGER.warning(msg)
|
||||
@ -150,7 +150,7 @@ async def process_success_login(request):
|
||||
and request.app[KEY_FAILED_LOGIN_ATTEMPTS][remote_addr] > 0
|
||||
):
|
||||
_LOGGER.debug(
|
||||
"Login success, reset failed login attempts counter" " from %s", remote_addr
|
||||
"Login success, reset failed login attempts counter from %s", remote_addr
|
||||
)
|
||||
request.app[KEY_FAILED_LOGIN_ATTEMPTS].pop(remote_addr)
|
||||
|
||||
|
@ -142,9 +142,11 @@ def request_handler_factory(view, handler):
|
||||
elif result is None:
|
||||
result = b""
|
||||
elif not isinstance(result, bytes):
|
||||
assert False, (
|
||||
"Result should be None, string, bytes or Response. " "Got: {}"
|
||||
).format(result)
|
||||
assert (
|
||||
False
|
||||
), "Result should be None, string, bytes or Response. Got: {}".format(
|
||||
result
|
||||
)
|
||||
|
||||
return web.Response(body=result, status=status_code)
|
||||
|
||||
|
@ -136,9 +136,7 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
if config.swupdate2_bridge_state == "readytoinstall":
|
||||
err = (
|
||||
"Please check for software updates of the bridge " "in the Philips Hue App."
|
||||
)
|
||||
err = "Please check for software updates of the bridge in the Philips Hue App."
|
||||
_LOGGER.warning(err)
|
||||
|
||||
return True
|
||||
|
@ -277,7 +277,7 @@ class HueLight(Light):
|
||||
_LOGGER.warning(err, self.name)
|
||||
if self.gamut:
|
||||
if not color.check_valid_gamut(self.gamut):
|
||||
err = "Color gamut of %s: %s, not valid, " "setting gamut to None."
|
||||
err = "Color gamut of %s: %s, not valid, setting gamut to None."
|
||||
_LOGGER.warning(err, self.name, str(self.gamut))
|
||||
self.gamut_typ = GAMUT_TYPE_UNAVAILABLE
|
||||
self.gamut = None
|
||||
|
@ -162,7 +162,7 @@ class ImapSensor(Entity):
|
||||
self._email_count = len(lines[0].split())
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Can't parse IMAP server response to search " "'%s': %s / %s",
|
||||
"Can't parse IMAP server response to search '%s': %s / %s",
|
||||
self._search,
|
||||
result,
|
||||
lines[0],
|
||||
|
@ -205,14 +205,13 @@ class InfluxSensorData:
|
||||
points = list(self.influx.query(self.query).get_points())
|
||||
if not points:
|
||||
_LOGGER.warning(
|
||||
"Query returned no points, sensor state set " "to UNKNOWN: %s",
|
||||
self.query,
|
||||
"Query returned no points, sensor state set to UNKNOWN: %s", self.query,
|
||||
)
|
||||
self.value = None
|
||||
else:
|
||||
if len(points) > 1:
|
||||
_LOGGER.warning(
|
||||
"Query returned multiple points, only first " "one shown: %s",
|
||||
"Query returned multiple points, only first one shown: %s",
|
||||
self.query,
|
||||
)
|
||||
self.value = points[0].get("value")
|
||||
|
@ -98,7 +98,7 @@ async def async_setup(hass, config):
|
||||
and not (time or dttm)
|
||||
):
|
||||
_LOGGER.error(
|
||||
"Invalid service data for %s " "input_datetime.set_datetime: %s",
|
||||
"Invalid service data for %s input_datetime.set_datetime: %s",
|
||||
entity.entity_id,
|
||||
str(call.data),
|
||||
)
|
||||
|
@ -92,9 +92,9 @@ class iOSNotificationService(BaseNotificationService):
|
||||
|
||||
if req.status_code != 201:
|
||||
fallback_error = req.json().get("errorMessage", "Unknown error")
|
||||
fallback_message = (
|
||||
"Internal server error, " "please try again later: " "{}"
|
||||
).format(fallback_error)
|
||||
fallback_message = "Internal server error, please try again later: {}".format(
|
||||
fallback_error
|
||||
)
|
||||
message = req.json().get("message", fallback_message)
|
||||
if req.status_code == 429:
|
||||
_LOGGER.warning(message)
|
||||
|
@ -165,7 +165,7 @@ class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice):
|
||||
"""Handle an "On" control event from the "negative" node."""
|
||||
if event == "DON":
|
||||
_LOGGER.debug(
|
||||
"Sensor %s turning Off via the Negative node " "sending a DON command",
|
||||
"Sensor %s turning Off via the Negative node sending a DON command",
|
||||
self.name,
|
||||
)
|
||||
self._computed_state = False
|
||||
@ -181,7 +181,7 @@ class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice):
|
||||
"""
|
||||
if event == "DON":
|
||||
_LOGGER.debug(
|
||||
"Sensor %s turning On via the Primary node " "sending a DON command",
|
||||
"Sensor %s turning On via the Primary node sending a DON command",
|
||||
self.name,
|
||||
)
|
||||
self._computed_state = True
|
||||
@ -189,7 +189,7 @@ class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice):
|
||||
self._heartbeat()
|
||||
if event == "DOF":
|
||||
_LOGGER.debug(
|
||||
"Sensor %s turning Off via the Primary node " "sending a DOF command",
|
||||
"Sensor %s turning Off via the Primary node sending a DOF command",
|
||||
self.name,
|
||||
)
|
||||
self._computed_state = False
|
||||
|
@ -102,7 +102,7 @@ async def async_setup(hass, config):
|
||||
except XKNXException as ex:
|
||||
_LOGGER.warning("Can't connect to KNX interface: %s", ex)
|
||||
hass.components.persistent_notification.async_create(
|
||||
"Can't connect to KNX interface: <br>" "<b>{0}</b>".format(ex), title="KNX"
|
||||
"Can't connect to KNX interface: <br><b>{0}</b>".format(ex), title="KNX"
|
||||
)
|
||||
|
||||
for component, discovery_type in (
|
||||
|
@ -811,7 +811,7 @@ class KodiDevice(MediaPlayerDevice):
|
||||
except jsonrpc_base.jsonrpc.TransportError:
|
||||
result = None
|
||||
_LOGGER.warning(
|
||||
"TransportError trying to run API method " "%s.%s(%s)",
|
||||
"TransportError trying to run API method %s.%s(%s)",
|
||||
self.entity_id,
|
||||
method,
|
||||
kwargs,
|
||||
|
@ -113,7 +113,7 @@ class LaMetricNotificationService(BaseNotificationService):
|
||||
self._devices = lmn.get_devices()
|
||||
except RequestsConnectionError:
|
||||
_LOGGER.warning(
|
||||
"Problem connecting to LaMetric, " "using cached devices instead"
|
||||
"Problem connecting to LaMetric, using cached devices instead"
|
||||
)
|
||||
for dev in self._devices:
|
||||
if targets is None or dev["name"] in targets:
|
||||
|
@ -9,7 +9,7 @@ from .const import DEFAULT_NAME
|
||||
|
||||
# Regex for address validation
|
||||
PATTERN_ADDRESS = re.compile(
|
||||
"^((?P<conn_id>\\w+)\\.)?s?(?P<seg_id>\\d+)" "\\.(?P<type>m|g)?(?P<id>\\d+)$"
|
||||
"^((?P<conn_id>\\w+)\\.)?s?(?P<seg_id>\\d+)\\.(?P<type>m|g)?(?P<id>\\d+)$"
|
||||
)
|
||||
|
||||
|
||||
|
@ -305,7 +305,7 @@ class SendKeys(LcnServiceCall):
|
||||
hit = pypck.lcn_defs.SendKeyCommand.HIT
|
||||
if pypck.lcn_defs.SendKeyCommand[call.data[CONF_STATE]] != hit:
|
||||
raise ValueError(
|
||||
"Only hit command is allowed when sending" " deferred keys."
|
||||
"Only hit command is allowed when sending deferred keys."
|
||||
)
|
||||
delay_unit = pypck.lcn_defs.TimeUnit.parse(call.data[CONF_TIME_UNIT])
|
||||
address_connection.send_keys_hit_deferred(keys, delay_time, delay_unit)
|
||||
@ -344,7 +344,7 @@ class LockKeys(LcnServiceCall):
|
||||
if delay_time != 0:
|
||||
if table_id != 0:
|
||||
raise ValueError(
|
||||
"Only table A is allowed when locking keys" " for a specific time."
|
||||
"Only table A is allowed when locking keys for a specific time."
|
||||
)
|
||||
delay_unit = pypck.lcn_defs.TimeUnit.parse(call.data[CONF_TIME_UNIT])
|
||||
address_connection.lock_keys_tab_a_temporary(delay_time, delay_unit, states)
|
||||
|
@ -207,5 +207,5 @@ class LogiCircleAuthCallbackView(HomeAssistantView):
|
||||
)
|
||||
return self.json_message("Authorisation code saved")
|
||||
return self.json_message(
|
||||
"Authorisation code missing " "from query string", status_code=400
|
||||
"Authorisation code missing from query string", status_code=400
|
||||
)
|
||||
|
@ -153,7 +153,7 @@ class MinMaxSensor(Entity):
|
||||
self.last = float(new_state.state)
|
||||
except ValueError:
|
||||
_LOGGER.warning(
|
||||
"Unable to store state. " "Only numerical states are supported"
|
||||
"Unable to store state. Only numerical states are supported"
|
||||
)
|
||||
|
||||
hass.async_add_job(self.async_update_ha_state, True)
|
||||
|
@ -139,9 +139,9 @@ class MobileAppNotificationService(BaseNotificationService):
|
||||
return
|
||||
|
||||
fallback_error = result.get("errorMessage", "Unknown error")
|
||||
fallback_message = (
|
||||
"Internal server error, " "please try again later: " "{}"
|
||||
).format(fallback_error)
|
||||
fallback_message = "Internal server error, please try again later: {}".format(
|
||||
fallback_error
|
||||
)
|
||||
message = result.get("message", fallback_message)
|
||||
if response.status == 429:
|
||||
_LOGGER.warning(message)
|
||||
|
@ -102,7 +102,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
)
|
||||
except KeyError:
|
||||
_LOGGER.error(
|
||||
"Unable to detect data type for %s sensor, " "try a custom type",
|
||||
"Unable to detect data type for %s sensor, try a custom type",
|
||||
register.get(CONF_NAME),
|
||||
)
|
||||
continue
|
||||
@ -119,7 +119,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
||||
if register.get(CONF_COUNT) * 2 != size:
|
||||
_LOGGER.error(
|
||||
"Structure size (%d bytes) mismatch registers count " "(%d words)",
|
||||
"Structure size (%d bytes) mismatch registers count (%d words)",
|
||||
size,
|
||||
register.get(CONF_COUNT),
|
||||
)
|
||||
|
@ -236,7 +236,7 @@ class ModbusRegisterSwitch(ModbusCoilSwitch):
|
||||
self._is_on = False
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Unexpected response from hub %s, slave %s " "register %s, got 0x%2x",
|
||||
"Unexpected response from hub %s, slave %s register %s, got 0x%2x",
|
||||
self._hub.name,
|
||||
self._slave,
|
||||
self._verify_register,
|
||||
|
@ -110,7 +110,7 @@ class MoldIndicator(Entity):
|
||||
def mold_indicator_sensors_state_listener(entity, old_state, new_state):
|
||||
"""Handle for state changes for dependent sensors."""
|
||||
_LOGGER.debug(
|
||||
"Sensor state change for %s that had old state %s " "and new state %s",
|
||||
"Sensor state change for %s that had old state %s and new state %s",
|
||||
entity,
|
||||
old_state,
|
||||
new_state,
|
||||
@ -188,7 +188,7 @@ class MoldIndicator(Entity):
|
||||
# Return an error if the sensor change its state to Unknown.
|
||||
if state.state == STATE_UNKNOWN:
|
||||
_LOGGER.error(
|
||||
"Unable to parse temperature sensor %s with state:" " %s",
|
||||
"Unable to parse temperature sensor %s with state: %s",
|
||||
state.entity_id,
|
||||
state.state,
|
||||
)
|
||||
@ -199,7 +199,7 @@ class MoldIndicator(Entity):
|
||||
|
||||
if temp is None:
|
||||
_LOGGER.error(
|
||||
"Unable to parse temperature sensor %s with state:" " %s",
|
||||
"Unable to parse temperature sensor %s with state: %s",
|
||||
state.entity_id,
|
||||
state.state,
|
||||
)
|
||||
@ -211,7 +211,7 @@ class MoldIndicator(Entity):
|
||||
if unit == TEMP_CELSIUS:
|
||||
return temp
|
||||
_LOGGER.error(
|
||||
"Temp sensor %s has unsupported unit: %s (allowed: %s, " "%s)",
|
||||
"Temp sensor %s has unsupported unit: %s (allowed: %s, %s)",
|
||||
state.entity_id,
|
||||
unit,
|
||||
TEMP_CELSIUS,
|
||||
@ -306,7 +306,7 @@ class MoldIndicator(Entity):
|
||||
if None in (self._dewpoint, self._calib_factor) or self._calib_factor == 0:
|
||||
|
||||
_LOGGER.debug(
|
||||
"Invalid inputs - dewpoint: %s," " calibration-factor: %s",
|
||||
"Invalid inputs - dewpoint: %s, calibration-factor: %s",
|
||||
self._dewpoint,
|
||||
self._calib_factor,
|
||||
)
|
||||
|
@ -136,10 +136,10 @@ def valid_topic(value: Any) -> str:
|
||||
raise vol.Invalid("MQTT topic name/filter must not be empty.")
|
||||
if len(raw_value) > 65535:
|
||||
raise vol.Invalid(
|
||||
"MQTT topic name/filter must not be longer than " "65535 encoded bytes."
|
||||
"MQTT topic name/filter must not be longer than 65535 encoded bytes."
|
||||
)
|
||||
if "\0" in value:
|
||||
raise vol.Invalid("MQTT topic name/filter must not contain null " "character.")
|
||||
raise vol.Invalid("MQTT topic name/filter must not contain null character.")
|
||||
return value
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ def valid_subscribe_topic(value: Any) -> str:
|
||||
i < len(value) - 1 and value[i + 1] != "/"
|
||||
):
|
||||
raise vol.Invalid(
|
||||
"Single-level wildcard must occupy an entire " "level of the filter"
|
||||
"Single-level wildcard must occupy an entire level of the filter"
|
||||
)
|
||||
|
||||
index = value.find("#")
|
||||
@ -164,7 +164,7 @@ def valid_subscribe_topic(value: Any) -> str:
|
||||
)
|
||||
if len(value) > 1 and value[index - 1] != "/":
|
||||
raise vol.Invalid(
|
||||
"Multi-level wildcard must be after a topic " "level separator."
|
||||
"Multi-level wildcard must be after a topic level separator."
|
||||
)
|
||||
|
||||
return value
|
||||
|
@ -216,7 +216,7 @@ async def async_setup_entry(hass, entry):
|
||||
structure.set_eta(trip_id, eta_begin, eta_end)
|
||||
else:
|
||||
_LOGGER.info(
|
||||
"No thermostats found in structure: %s, " "unable to set ETA",
|
||||
"No thermostats found in structure: %s, unable to set ETA",
|
||||
structure.name,
|
||||
)
|
||||
|
||||
|
@ -124,9 +124,7 @@ def setup(hass, config):
|
||||
# for the charging request to reach the car.
|
||||
result = await hass.async_add_executor_job(data_store.leaf.start_charging)
|
||||
if result:
|
||||
_LOGGER.debug(
|
||||
"Start charging sent, " "request updated data in 1 minute"
|
||||
)
|
||||
_LOGGER.debug("Start charging sent, request updated data in 1 minute")
|
||||
check_charge_at = utcnow() + timedelta(minutes=1)
|
||||
data_store.next_update = check_charge_at
|
||||
async_track_point_in_utc_time(
|
||||
@ -414,7 +412,7 @@ class LeafDataStore:
|
||||
for attempt in range(MAX_RESPONSE_ATTEMPTS):
|
||||
if attempt > 0:
|
||||
_LOGGER.debug(
|
||||
"Climate data not in yet (%s) (%s). " "Waiting (%s) seconds",
|
||||
"Climate data not in yet (%s) (%s). Waiting (%s) seconds",
|
||||
self.leaf.vin,
|
||||
attempt,
|
||||
PYCARWINGS2_SLEEP,
|
||||
|
@ -189,7 +189,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
data.update(no_throttle=True)
|
||||
except data.pynuterror as err:
|
||||
_LOGGER.error(
|
||||
"Failure while testing NUT status retrieval. " "Cannot continue setup: %s",
|
||||
"Failure while testing NUT status retrieval. Cannot continue setup: %s",
|
||||
err,
|
||||
)
|
||||
raise PlatformNotReady
|
||||
|
@ -66,9 +66,7 @@ class OhmconnectSensor(Entity):
|
||||
def update(self):
|
||||
"""Get the latest data from OhmConnect."""
|
||||
try:
|
||||
url = ("https://login.ohmconnect.com" "/verify-ohm-hour/{}").format(
|
||||
self._ohmid
|
||||
)
|
||||
url = "https://login.ohmconnect.com/verify-ohm-hour/{}".format(self._ohmid)
|
||||
response = requests.get(url, timeout=10)
|
||||
root = ET.fromstring(response.text)
|
||||
|
||||
|
@ -40,7 +40,7 @@ EVENT_OPENSKY_EXIT = f"{DOMAIN}_exit"
|
||||
SCAN_INTERVAL = timedelta(seconds=12) # opensky public limit is 10 seconds
|
||||
|
||||
OPENSKY_ATTRIBUTION = (
|
||||
"Information provided by the OpenSky Network " "(https://opensky-network.org)"
|
||||
"Information provided by the OpenSky Network (https://opensky-network.org)"
|
||||
)
|
||||
OPENSKY_API_URL = "https://opensky-network.org/api/states/all"
|
||||
OPENSKY_API_FIELDS = [
|
||||
|
@ -272,7 +272,7 @@ class WeatherData:
|
||||
self.latitude, self.longitude
|
||||
)
|
||||
except APICallError:
|
||||
_LOGGER.error("Exception when calling OWM web API " "to update forecast")
|
||||
_LOGGER.error("Exception when calling OWM web API to update forecast")
|
||||
return
|
||||
|
||||
if fcd is None:
|
||||
|
@ -51,7 +51,7 @@ def setup(hass, config):
|
||||
device = PyOwlet(username, password)
|
||||
except KeyError:
|
||||
_LOGGER.error(
|
||||
"Owlet authentication failed. Please verify your " "credentials are correct"
|
||||
"Owlet authentication failed. Please verify your credentials are correct"
|
||||
)
|
||||
return False
|
||||
|
||||
|
@ -233,7 +233,7 @@ class OwnTracksContext:
|
||||
|
||||
if self.max_gps_accuracy is not None and acc > self.max_gps_accuracy:
|
||||
_LOGGER.info(
|
||||
"Ignoring %s update because expected GPS " "accuracy %s is not met: %s",
|
||||
"Ignoring %s update because expected GPS accuracy %s is not met: %s",
|
||||
message["_type"],
|
||||
self.max_gps_accuracy,
|
||||
message,
|
||||
|
@ -59,7 +59,7 @@ class ProwlNotificationService(BaseNotificationService):
|
||||
|
||||
if response.status != 200 or "error" in result:
|
||||
_LOGGER.error(
|
||||
"Prowl service returned http " "status %d, response %s",
|
||||
"Prowl service returned http status %d, response %s",
|
||||
response.status,
|
||||
result,
|
||||
)
|
||||
|
@ -268,7 +268,7 @@ class Proximity(Entity):
|
||||
self.nearest = entity_name
|
||||
self.schedule_update_ha_state()
|
||||
_LOGGER.debug(
|
||||
"proximity.%s update entity: distance=%s: direction=%s: " "device=%s",
|
||||
"proximity.%s update entity: distance=%s: direction=%s: device=%s",
|
||||
self.friendly_name,
|
||||
round(dist_to_zone),
|
||||
direction_of_travel,
|
||||
|
@ -225,7 +225,7 @@ class TimeWrapper:
|
||||
if not TimeWrapper.warned:
|
||||
TimeWrapper.warned = True
|
||||
_LOGGER.warning(
|
||||
"Using time.sleep can reduce the performance of " "Home Assistant"
|
||||
"Using time.sleep can reduce the performance of Home Assistant"
|
||||
)
|
||||
|
||||
time.sleep(*args, **kwargs)
|
||||
|
@ -54,7 +54,7 @@ class QuantumGatewayDeviceScanner(DeviceScanner):
|
||||
_LOGGER.error("Unable to connect to gateway. Check host.")
|
||||
|
||||
if not self.success_init:
|
||||
_LOGGER.error("Unable to login to gateway. Check password and " "host.")
|
||||
_LOGGER.error("Unable to login to gateway. Check password and host.")
|
||||
|
||||
def scan_devices(self):
|
||||
"""Scan for new devices and return a list of found MACs."""
|
||||
|
@ -228,7 +228,7 @@ class Recorder(threading.Thread):
|
||||
_LOGGER.debug("Connected to recorder database")
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
_LOGGER.error(
|
||||
"Error during connection setup: %s (retrying " "in %s seconds)",
|
||||
"Error during connection setup: %s (retrying in %s seconds)",
|
||||
err,
|
||||
CONNECT_RETRY_WAIT,
|
||||
)
|
||||
|
@ -166,7 +166,7 @@ class RememberTheMilkConfiguration:
|
||||
self._config = json.load(config_file)
|
||||
except ValueError:
|
||||
_LOGGER.error(
|
||||
"Failed to load configuration file, creating a " "new one: %s",
|
||||
"Failed to load configuration file, creating a new one: %s",
|
||||
self._config_file_path,
|
||||
)
|
||||
self._config = dict()
|
||||
@ -258,7 +258,7 @@ class RememberTheMilk(Entity):
|
||||
valid = self._rtm_api.token_valid()
|
||||
if not valid:
|
||||
_LOGGER.error(
|
||||
"Token for account %s is invalid. You need to " "register again!",
|
||||
"Token for account %s is invalid. You need to register again!",
|
||||
self.name,
|
||||
)
|
||||
self._rtm_config.delete_token(self._name)
|
||||
@ -306,14 +306,14 @@ class RememberTheMilk(Entity):
|
||||
timeline=timeline,
|
||||
)
|
||||
_LOGGER.debug(
|
||||
"Updated task with id '%s' in account " "%s to name %s",
|
||||
"Updated task with id '%s' in account %s to name %s",
|
||||
hass_id,
|
||||
self.name,
|
||||
task_name,
|
||||
)
|
||||
except RtmRequestFailedException as rtm_exception:
|
||||
_LOGGER.error(
|
||||
"Error creating new Remember The Milk task for " "account %s: %s",
|
||||
"Error creating new Remember The Milk task for account %s: %s",
|
||||
self._name,
|
||||
rtm_exception,
|
||||
)
|
||||
@ -347,7 +347,7 @@ class RememberTheMilk(Entity):
|
||||
)
|
||||
except RtmRequestFailedException as rtm_exception:
|
||||
_LOGGER.error(
|
||||
"Error creating new Remember The Milk task for " "account %s: %s",
|
||||
"Error creating new Remember The Milk task for account %s: %s",
|
||||
self._name,
|
||||
rtm_exception,
|
||||
)
|
||||
|
@ -62,9 +62,7 @@ PARTITION_SCHEMA = vol.Schema(
|
||||
def is_alarm_code_necessary(value):
|
||||
"""Check if alarm code must be configured."""
|
||||
if value.get(CONF_SWITCHABLE_OUTPUTS) and CONF_DEVICE_CODE not in value:
|
||||
raise vol.Invalid(
|
||||
"You need to specify alarm " " code to use switchable_outputs"
|
||||
)
|
||||
raise vol.Invalid("You need to specify alarm code to use switchable_outputs")
|
||||
|
||||
return value
|
||||
|
||||
|
@ -69,14 +69,14 @@ class SatelIntegraSwitch(SwitchDevice):
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn the device on."""
|
||||
_LOGGER.debug("Switch: %s status: %s," " turning on", self._name, self._state)
|
||||
_LOGGER.debug("Switch: %s status: %s, turning on", self._name, self._state)
|
||||
await self._satel.set_output(self._code, self._device_number, True)
|
||||
self.async_schedule_update_ha_state()
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Turn the device off."""
|
||||
_LOGGER.debug(
|
||||
"Switch name: %s status: %s," " turning off", self._name, self._state
|
||||
"Switch name: %s status: %s, turning off", self._name, self._state
|
||||
)
|
||||
await self._satel.set_output(self._code, self._device_number, False)
|
||||
self.async_schedule_update_ha_state()
|
||||
|
@ -60,8 +60,7 @@ async def async_setup(hass, config):
|
||||
for slide in result:
|
||||
if "device_id" not in slide:
|
||||
_LOGGER.error(
|
||||
"Found invalid Slide entry, device_id is " "missing. Entry=%s",
|
||||
slide,
|
||||
"Found invalid Slide entry, device_id is missing. Entry=%s", slide,
|
||||
)
|
||||
continue
|
||||
|
||||
@ -104,7 +103,7 @@ async def async_setup(hass, config):
|
||||
)
|
||||
elif "code" in slide["device_info"]:
|
||||
_LOGGER.warning(
|
||||
"Slide %s (%s) is offline with " "code=%s",
|
||||
"Slide %s (%s) is offline with code=%s",
|
||||
slide["id"],
|
||||
slidenew["mac"],
|
||||
slide["device_info"]["code"],
|
||||
|
@ -339,7 +339,7 @@ async def smartapp_sync_subscriptions(
|
||||
)
|
||||
except Exception as error: # pylint:disable=broad-except
|
||||
_LOGGER.error(
|
||||
"Failed to remove subscription for '%s' under app " "'%s': %s",
|
||||
"Failed to remove subscription for '%s' under app '%s': %s",
|
||||
sub.capability,
|
||||
installed_app_id,
|
||||
error,
|
||||
|
@ -37,7 +37,7 @@ CONF_CLIENT_ID = "client_id"
|
||||
CONF_CLIENT_SECRET = "client_secret"
|
||||
|
||||
CONFIGURATOR_DESCRIPTION = (
|
||||
"To link your Spotify account, " "click the link, login, and authorize:"
|
||||
"To link your Spotify account, click the link, login, and authorize:"
|
||||
)
|
||||
CONFIGURATOR_LINK_NAME = "Link Spotify account"
|
||||
CONFIGURATOR_SUBMIT_CAPTION = "I authorized successfully"
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTRIBUTION = "Data provided by the Swiss Federal Office for the " "Environment FOEN"
|
||||
ATTRIBUTION = "Data provided by the Swiss Federal Office for the Environment FOEN"
|
||||
|
||||
ATTR_DELTA_24H = "delta-24h"
|
||||
ATTR_MAX_1H = "max-1h"
|
||||
|
@ -60,9 +60,7 @@ class TadoDeviceScanner(DeviceScanner):
|
||||
if self.home_id is None:
|
||||
self.tadoapiurl = "https://my.tado.com/api/v2/me"
|
||||
else:
|
||||
self.tadoapiurl = (
|
||||
"https://my.tado.com/api/v2" "/homes/{home_id}/mobileDevices"
|
||||
)
|
||||
self.tadoapiurl = "https://my.tado.com/api/v2/homes/{home_id}/mobileDevices"
|
||||
|
||||
# The API URL always needs a username and password
|
||||
self.tadoapiurl += "?username={username}&password={password}"
|
||||
|
@ -628,7 +628,7 @@ class TelegramNotificationService:
|
||||
"""Answer a callback originated with a press in an inline keyboard."""
|
||||
params = self._get_msg_kwargs(kwargs)
|
||||
_LOGGER.debug(
|
||||
"Answer callback query with callback ID %s: %s, " "alert: %s.",
|
||||
"Answer callback query with callback ID %s: %s, alert: %s.",
|
||||
callback_query_id,
|
||||
message,
|
||||
show_alert,
|
||||
|
@ -223,7 +223,7 @@ class BinarySensorTemplate(BinarySensorDevice):
|
||||
):
|
||||
# Common during HA startup - so just a warning
|
||||
_LOGGER.warning(
|
||||
"Could not render template %s, " "the state is unknown", self._name
|
||||
"Could not render template %s, the state is unknown", self._name
|
||||
)
|
||||
return
|
||||
_LOGGER.error("Could not render template %s: %s", self._name, ex)
|
||||
@ -259,7 +259,7 @@ class BinarySensorTemplate(BinarySensorDevice):
|
||||
):
|
||||
# Common during HA startup - so just a warning
|
||||
_LOGGER.warning(
|
||||
"Could not render %s template %s," " the state is unknown.",
|
||||
"Could not render %s template %s, the state is unknown.",
|
||||
friendly_property_name,
|
||||
self._name,
|
||||
)
|
||||
|
@ -437,8 +437,7 @@ class CoverTemplate(CoverDevice):
|
||||
if state < 0 or state > 100:
|
||||
self._tilt_value = None
|
||||
_LOGGER.error(
|
||||
"Tilt value must be between 0 and 100." " Value was: %.2f",
|
||||
state,
|
||||
"Tilt value must be between 0 and 100. Value was: %.2f", state,
|
||||
)
|
||||
else:
|
||||
self._tilt_value = state
|
||||
@ -466,7 +465,7 @@ class CoverTemplate(CoverDevice):
|
||||
):
|
||||
# Common during HA startup - so just a warning
|
||||
_LOGGER.warning(
|
||||
"Could not render %s template %s," " the state is unknown.",
|
||||
"Could not render %s template %s, the state is unknown.",
|
||||
friendly_property_name,
|
||||
self._name,
|
||||
)
|
||||
|
@ -320,7 +320,7 @@ class LightTemplate(Light):
|
||||
):
|
||||
# Common during HA startup - so just a warning
|
||||
_LOGGER.warning(
|
||||
"Could not render %s template %s," " the state is unknown.",
|
||||
"Could not render %s template %s, the state is unknown.",
|
||||
friendly_property_name,
|
||||
self._name,
|
||||
)
|
||||
|
@ -230,7 +230,7 @@ class SensorTemplate(Entity):
|
||||
):
|
||||
# Common during HA startup - so just a warning
|
||||
_LOGGER.warning(
|
||||
"Could not render template %s," " the state is unknown.", self._name
|
||||
"Could not render template %s, the state is unknown.", self._name
|
||||
)
|
||||
else:
|
||||
self._state = None
|
||||
@ -268,7 +268,7 @@ class SensorTemplate(Entity):
|
||||
):
|
||||
# Common during HA startup - so just a warning
|
||||
_LOGGER.warning(
|
||||
"Could not render %s template %s," " the state is unknown.",
|
||||
"Could not render %s template %s, the state is unknown.",
|
||||
friendly_property_name,
|
||||
self._name,
|
||||
)
|
||||
|
@ -233,7 +233,7 @@ class SwitchTemplate(SwitchDevice):
|
||||
):
|
||||
# Common during HA startup - so just a warning
|
||||
_LOGGER.warning(
|
||||
"Could not render %s template %s," " the state is unknown.",
|
||||
"Could not render %s template %s, the state is unknown.",
|
||||
friendly_property_name,
|
||||
self._name,
|
||||
)
|
||||
|
@ -124,7 +124,7 @@ class TomatoDeviceScanner(DeviceScanner):
|
||||
# We get this if we could not connect to the router or
|
||||
# an invalid http_id was supplied.
|
||||
_LOGGER.exception(
|
||||
"Failed to connect to the router or " "invalid http_id supplied"
|
||||
"Failed to connect to the router or invalid http_id supplied"
|
||||
)
|
||||
return False
|
||||
|
||||
|
@ -119,7 +119,7 @@ class TotalConnectAlarm(alarm.AlarmControlPanel):
|
||||
attr["triggered_source"] = "Carbon Monoxide"
|
||||
else:
|
||||
logging.info(
|
||||
"Total Connect Client returned unknown " "status code: %s", status
|
||||
"Total Connect Client returned unknown status code: %s", status
|
||||
)
|
||||
state = None
|
||||
|
||||
|
@ -30,7 +30,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
if uscis.valid_case_id:
|
||||
add_entities([uscis])
|
||||
else:
|
||||
_LOGGER.error("Setup USCIS Sensor Fail" " check if your Case ID is Valid")
|
||||
_LOGGER.error("Setup USCIS Sensor Fail check if your Case ID is Valid")
|
||||
|
||||
|
||||
class UscisSensor(Entity):
|
||||
|
@ -740,7 +740,7 @@ class WinkDevice(Entity):
|
||||
try:
|
||||
if message is None:
|
||||
_LOGGER.error(
|
||||
"Error on pubnub update for %s " "polling API for current state",
|
||||
"Error on pubnub update for %s polling API for current state",
|
||||
self.name,
|
||||
)
|
||||
self.schedule_update_ha_state(True)
|
||||
@ -749,8 +749,7 @@ class WinkDevice(Entity):
|
||||
self.schedule_update_ha_state()
|
||||
except (ValueError, KeyError, AttributeError):
|
||||
_LOGGER.error(
|
||||
"Error in pubnub JSON for %s " "polling API for current state",
|
||||
self.name,
|
||||
"Error in pubnub JSON for %s polling API for current state", self.name,
|
||||
)
|
||||
self.schedule_update_ha_state(True)
|
||||
|
||||
|
@ -199,7 +199,7 @@ def setup(hass, config):
|
||||
except (ConnectTimeout, HTTPError, WirelessTagsException) as ex:
|
||||
_LOGGER.error("Unable to connect to wirelesstag.net service: %s", str(ex))
|
||||
hass.components.persistent_notification.create(
|
||||
"Error: {}<br />" "Please restart hass after fixing this." "".format(ex),
|
||||
"Error: {}<br />Please restart hass after fixing this.".format(ex),
|
||||
title=NOTIFICATION_TITLE,
|
||||
notification_id=NOTIFICATION_ID,
|
||||
)
|
||||
|
@ -1012,7 +1012,7 @@ class WUndergroundSensor(Entity):
|
||||
val = val(self.rest)
|
||||
except (KeyError, IndexError, TypeError, ValueError) as err:
|
||||
_LOGGER.warning(
|
||||
"Failed to expand cfg from WU API." " Condition: %s Attr: %s Error: %s",
|
||||
"Failed to expand cfg from WU API. Condition: %s Attr: %s Error: %s",
|
||||
self._condition,
|
||||
what,
|
||||
repr(err),
|
||||
|
@ -32,7 +32,7 @@ def get_scanner(hass, config):
|
||||
scanner = XfinityDeviceScanner(gateway)
|
||||
except (RequestException, ValueError):
|
||||
_LOGGER.error(
|
||||
"Error communicating with Xfinity Gateway. " "Check host: %s", gateway.host
|
||||
"Error communicating with Xfinity Gateway. Check host: %s", gateway.host
|
||||
)
|
||||
|
||||
return scanner
|
||||
@ -51,7 +51,7 @@ class XfinityDeviceScanner(DeviceScanner):
|
||||
try:
|
||||
connected_devices = self.gateway.scan_devices()
|
||||
except (RequestException, ValueError):
|
||||
_LOGGER.error("Unable to scan devices. " "Check connection to gateway")
|
||||
_LOGGER.error("Unable to scan devices. Check connection to gateway")
|
||||
return connected_devices
|
||||
|
||||
def get_device_name(self, device):
|
||||
|
@ -467,7 +467,7 @@ class XiaomiPhilipsBulb(XiaomiPhilipsGenericLight):
|
||||
)
|
||||
|
||||
result = await self._try_command(
|
||||
"Setting brightness and color temperature failed: " "%s bri, %s cct",
|
||||
"Setting brightness and color temperature failed: %s bri, %s cct",
|
||||
self._light.set_brightness_and_color_temperature,
|
||||
percent_brightness,
|
||||
percent_color_temp,
|
||||
@ -479,7 +479,7 @@ class XiaomiPhilipsBulb(XiaomiPhilipsGenericLight):
|
||||
|
||||
elif ATTR_COLOR_TEMP in kwargs:
|
||||
_LOGGER.debug(
|
||||
"Setting color temperature: " "%s mireds, %s%% cct",
|
||||
"Setting color temperature: %s mireds, %s%% cct",
|
||||
color_temp,
|
||||
percent_color_temp,
|
||||
)
|
||||
@ -825,14 +825,14 @@ class XiaomiPhilipsMoonlightLamp(XiaomiPhilipsBulb):
|
||||
|
||||
if ATTR_BRIGHTNESS in kwargs and ATTR_HS_COLOR in kwargs:
|
||||
_LOGGER.debug(
|
||||
"Setting brightness and color: " "%s %s%%, %s",
|
||||
"Setting brightness and color: %s %s%%, %s",
|
||||
brightness,
|
||||
percent_brightness,
|
||||
rgb,
|
||||
)
|
||||
|
||||
result = await self._try_command(
|
||||
"Setting brightness and color failed: " "%s bri, %s color",
|
||||
"Setting brightness and color failed: %s bri, %s color",
|
||||
self._light.set_brightness_and_rgb,
|
||||
percent_brightness,
|
||||
rgb,
|
||||
@ -853,7 +853,7 @@ class XiaomiPhilipsMoonlightLamp(XiaomiPhilipsBulb):
|
||||
)
|
||||
|
||||
result = await self._try_command(
|
||||
"Setting brightness and color temperature failed: " "%s bri, %s cct",
|
||||
"Setting brightness and color temperature failed: %s bri, %s cct",
|
||||
self._light.set_brightness_and_color_temperature,
|
||||
percent_brightness,
|
||||
percent_color_temp,
|
||||
@ -875,7 +875,7 @@ class XiaomiPhilipsMoonlightLamp(XiaomiPhilipsBulb):
|
||||
|
||||
elif ATTR_COLOR_TEMP in kwargs:
|
||||
_LOGGER.debug(
|
||||
"Setting color temperature: " "%s mireds, %s%% cct",
|
||||
"Setting color temperature: %s mireds, %s%% cct",
|
||||
color_temp,
|
||||
percent_color_temp,
|
||||
)
|
||||
|
@ -379,7 +379,7 @@ class MiroboVacuum(StateVacuumDevice):
|
||||
fan_speed = int(fan_speed)
|
||||
except ValueError as exc:
|
||||
_LOGGER.error(
|
||||
"Fan speed step not recognized (%s). " "Valid speeds are: %s",
|
||||
"Fan speed step not recognized (%s). Valid speeds are: %s",
|
||||
exc,
|
||||
self.fan_speed_list,
|
||||
)
|
||||
|
@ -201,7 +201,7 @@ async def async_send_message(
|
||||
except FileTooBig as ex:
|
||||
_LOGGER.error("File too big for server, could not upload file %s", ex)
|
||||
except UploadServiceNotFound as ex:
|
||||
_LOGGER.error("UploadServiceNotFound: " " could not upload file %s", ex)
|
||||
_LOGGER.error("UploadServiceNotFound, could not upload file %s", ex)
|
||||
except FileUploadError as ex:
|
||||
_LOGGER.error("FileUploadError, could not upload file %s", ex)
|
||||
except requests.exceptions.SSLError as ex:
|
||||
|
@ -63,8 +63,7 @@ def setup(hass, config):
|
||||
)
|
||||
except ConnectionError as error:
|
||||
_LOGGER.error(
|
||||
"Failed to create XS1 API client " "because of a connection error: %s",
|
||||
error,
|
||||
"Failed to create XS1 API client because of a connection error: %s", error,
|
||||
)
|
||||
return False
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user