String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
3149c52be1
commit
d4f69a3652
40 changed files with 249 additions and 110 deletions
|
@ -101,7 +101,10 @@ class ColorChannel(ZigbeeChannel):
|
||||||
min_mireds = self.cluster.get("color_temp_physical_min", self.MIN_MIREDS)
|
min_mireds = self.cluster.get("color_temp_physical_min", self.MIN_MIREDS)
|
||||||
if min_mireds == 0:
|
if min_mireds == 0:
|
||||||
self.warning(
|
self.warning(
|
||||||
"[Min mireds is 0, setting to %s] Please open an issue on the quirks repo to have this device corrected",
|
(
|
||||||
|
"[Min mireds is 0, setting to %s] Please open an issue on the"
|
||||||
|
" quirks repo to have this device corrected"
|
||||||
|
),
|
||||||
self.MIN_MIREDS,
|
self.MIN_MIREDS,
|
||||||
)
|
)
|
||||||
min_mireds = self.MIN_MIREDS
|
min_mireds = self.MIN_MIREDS
|
||||||
|
@ -113,7 +116,10 @@ class ColorChannel(ZigbeeChannel):
|
||||||
max_mireds = self.cluster.get("color_temp_physical_max", self.MAX_MIREDS)
|
max_mireds = self.cluster.get("color_temp_physical_max", self.MAX_MIREDS)
|
||||||
if max_mireds == 0:
|
if max_mireds == 0:
|
||||||
self.warning(
|
self.warning(
|
||||||
"[Max mireds is 0, setting to %s] Please open an issue on the quirks repo to have this device corrected",
|
(
|
||||||
|
"[Max mireds is 0, setting to %s] Please open an issue on the"
|
||||||
|
" quirks repo to have this device corrected"
|
||||||
|
),
|
||||||
self.MAX_MIREDS,
|
self.MAX_MIREDS,
|
||||||
)
|
)
|
||||||
max_mireds = self.MAX_MIREDS
|
max_mireds = self.MAX_MIREDS
|
||||||
|
|
|
@ -397,7 +397,10 @@ class ZHADevice(LogMixin):
|
||||||
or not self._channels.pools
|
or not self._channels.pools
|
||||||
):
|
):
|
||||||
self.debug(
|
self.debug(
|
||||||
"last_seen is %s seconds ago and ping attempts have been exhausted, marking the device unavailable",
|
(
|
||||||
|
"last_seen is %s seconds ago and ping attempts have been exhausted,"
|
||||||
|
" marking the device unavailable"
|
||||||
|
),
|
||||||
difference,
|
difference,
|
||||||
)
|
)
|
||||||
self.update_available(False)
|
self.update_available(False)
|
||||||
|
@ -422,7 +425,10 @@ class ZHADevice(LogMixin):
|
||||||
def update_available(self, available: bool) -> None:
|
def update_available(self, available: bool) -> None:
|
||||||
"""Update device availability and signal entities."""
|
"""Update device availability and signal entities."""
|
||||||
self.debug(
|
self.debug(
|
||||||
"Update device availability - device available: %s - new availability: %s - changed: %s",
|
(
|
||||||
|
"Update device availability - device available: %s - new availability:"
|
||||||
|
" %s - changed: %s"
|
||||||
|
),
|
||||||
self.available,
|
self.available,
|
||||||
available,
|
available,
|
||||||
self.available ^ available,
|
self.available ^ available,
|
||||||
|
@ -432,7 +438,8 @@ class ZHADevice(LogMixin):
|
||||||
if availability_changed and available:
|
if availability_changed and available:
|
||||||
# reinit channels then signal entities
|
# reinit channels then signal entities
|
||||||
self.debug(
|
self.debug(
|
||||||
"Device availability changed and device became available, reinitializing channels"
|
"Device availability changed and device became available,"
|
||||||
|
" reinitializing channels"
|
||||||
)
|
)
|
||||||
self.hass.async_create_task(self._async_became_available())
|
self.hass.async_create_task(self._async_became_available())
|
||||||
return
|
return
|
||||||
|
@ -562,8 +569,10 @@ class ZHADevice(LogMixin):
|
||||||
else:
|
else:
|
||||||
names.append(
|
names.append(
|
||||||
{
|
{
|
||||||
ATTR_NAME: f"unknown {endpoint.device_type} device_type "
|
ATTR_NAME: (
|
||||||
f"of 0x{(endpoint.profile_id or 0xFFFF):04x} profile id"
|
f"unknown {endpoint.device_type} device_type "
|
||||||
|
f"of 0x{(endpoint.profile_id or 0xFFFF):04x} profile id"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
device_info[ATTR_ENDPOINT_NAMES] = names
|
device_info[ATTR_ENDPOINT_NAMES] = names
|
||||||
|
@ -696,7 +705,8 @@ class ZHADevice(LogMixin):
|
||||||
)
|
)
|
||||||
except KeyError as exc:
|
except KeyError as exc:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Cluster {cluster_id} not found on endpoint {endpoint_id} while issuing command {command} with args {args}"
|
f"Cluster {cluster_id} not found on endpoint {endpoint_id} while"
|
||||||
|
f" issuing command {command} with args {args}"
|
||||||
) from exc
|
) from exc
|
||||||
commands: dict[int, ZCLCommandDef] = (
|
commands: dict[int, ZCLCommandDef] = (
|
||||||
cluster.server_commands
|
cluster.server_commands
|
||||||
|
@ -705,7 +715,10 @@ class ZHADevice(LogMixin):
|
||||||
)
|
)
|
||||||
if args is not None:
|
if args is not None:
|
||||||
self.warning(
|
self.warning(
|
||||||
"args [%s] are deprecated and should be passed with the params key. The parameter names are: %s",
|
(
|
||||||
|
"args [%s] are deprecated and should be passed with the params key."
|
||||||
|
" The parameter names are: %s"
|
||||||
|
),
|
||||||
args,
|
args,
|
||||||
[field.name for field in commands[command].schema.fields],
|
[field.name for field in commands[command].schema.fields],
|
||||||
)
|
)
|
||||||
|
@ -790,7 +803,10 @@ class ZHADevice(LogMixin):
|
||||||
await self._zigpy_device.endpoints[endpoint_id].remove_from_group(group_id)
|
await self._zigpy_device.endpoints[endpoint_id].remove_from_group(group_id)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x ex: %s",
|
(
|
||||||
|
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x"
|
||||||
|
" ex: %s"
|
||||||
|
),
|
||||||
endpoint_id,
|
endpoint_id,
|
||||||
self._zigpy_device.ieee,
|
self._zigpy_device.ieee,
|
||||||
group_id,
|
group_id,
|
||||||
|
|
|
@ -209,7 +209,10 @@ class ZHAGateway:
|
||||||
zha_device.available = delta < zha_device.consider_unavailable_time
|
zha_device.available = delta < zha_device.consider_unavailable_time
|
||||||
delta_msg = f"{str(timedelta(seconds=delta))} ago"
|
delta_msg = f"{str(timedelta(seconds=delta))} ago"
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"[%s](%s) restored as '%s', last seen: %s, consider_unavailable_time: %s seconds",
|
(
|
||||||
|
"[%s](%s) restored as '%s', last seen: %s,"
|
||||||
|
" consider_unavailable_time: %s seconds"
|
||||||
|
),
|
||||||
zha_device.nwk,
|
zha_device.nwk,
|
||||||
zha_device.name,
|
zha_device.name,
|
||||||
"available" if zha_device.available else "unavailable",
|
"available" if zha_device.available else "unavailable",
|
||||||
|
@ -649,7 +652,10 @@ class ZHAGateway:
|
||||||
tasks = []
|
tasks = []
|
||||||
for member in members:
|
for member in members:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Adding member with IEEE: %s and endpoint ID: %s to group: %s:0x%04x",
|
(
|
||||||
|
"Adding member with IEEE: %s and endpoint ID: %s to group:"
|
||||||
|
" %s:0x%04x"
|
||||||
|
),
|
||||||
member.ieee,
|
member.ieee,
|
||||||
member.endpoint_id,
|
member.endpoint_id,
|
||||||
name,
|
name,
|
||||||
|
|
|
@ -103,7 +103,10 @@ class ZHAGroupMember(LogMixin):
|
||||||
].remove_from_group(self._zha_group.group_id)
|
].remove_from_group(self._zha_group.group_id)
|
||||||
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x ex: %s",
|
(
|
||||||
|
"Failed to remove endpoint: %s for device '%s' from group: 0x%04x"
|
||||||
|
" ex: %s"
|
||||||
|
),
|
||||||
self._endpoint_id,
|
self._endpoint_id,
|
||||||
self._zha_device.ieee,
|
self._zha_device.ieee,
|
||||||
self._zha_group.group_id,
|
self._zha_group.group_id,
|
||||||
|
|
|
@ -349,10 +349,7 @@ def retryable_req(
|
||||||
if delay:
|
if delay:
|
||||||
delay = uniform(delay * 0.75, delay * 1.25)
|
delay = uniform(delay * 0.75, delay * 1.25)
|
||||||
channel.debug(
|
channel.debug(
|
||||||
(
|
"%s: retryable request #%d failed: %s. Retrying in %ss",
|
||||||
"%s: retryable request #%d failed: %s. "
|
|
||||||
"Retrying in %ss"
|
|
||||||
),
|
|
||||||
func.__name__,
|
func.__name__,
|
||||||
try_count,
|
try_count,
|
||||||
ex,
|
ex,
|
||||||
|
|
|
@ -210,12 +210,14 @@ async def _execute_channel_command_based_action(
|
||||||
|
|
||||||
if action_channel is None:
|
if action_channel is None:
|
||||||
raise InvalidDeviceAutomationConfig(
|
raise InvalidDeviceAutomationConfig(
|
||||||
f"Unable to execute channel action - channel: {channel_name} action: {action_type}"
|
f"Unable to execute channel action - channel: {channel_name} action:"
|
||||||
|
f" {action_type}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not hasattr(action_channel, action_type):
|
if not hasattr(action_channel, action_type):
|
||||||
raise InvalidDeviceAutomationConfig(
|
raise InvalidDeviceAutomationConfig(
|
||||||
f"Unable to execute channel action - channel: {channel_name} action: {action_type}"
|
f"Unable to execute channel action - channel: {channel_name} action:"
|
||||||
|
f" {action_type}"
|
||||||
)
|
)
|
||||||
|
|
||||||
await getattr(action_channel, action_type)(**config)
|
await getattr(action_channel, action_type)(**config)
|
||||||
|
|
|
@ -113,7 +113,8 @@ class BaseFan(FanEntity):
|
||||||
"""Set the preset mode for the fan."""
|
"""Set the preset mode for the fan."""
|
||||||
if preset_mode not in self.preset_modes:
|
if preset_mode not in self.preset_modes:
|
||||||
raise NotValidPresetModeError(
|
raise NotValidPresetModeError(
|
||||||
f"The preset_mode {preset_mode} is not a valid preset_mode: {self.preset_modes}"
|
f"The preset_mode {preset_mode} is not a valid preset_mode:"
|
||||||
|
f" {self.preset_modes}"
|
||||||
)
|
)
|
||||||
await self._async_set_fan_mode(NAME_TO_PRESET_MODE[preset_mode])
|
await self._async_set_fan_mode(NAME_TO_PRESET_MODE[preset_mode])
|
||||||
|
|
||||||
|
@ -288,7 +289,8 @@ class IkeaFan(BaseFan, ZhaEntity):
|
||||||
"""Set the preset mode for the fan."""
|
"""Set the preset mode for the fan."""
|
||||||
if preset_mode not in self.preset_modes:
|
if preset_mode not in self.preset_modes:
|
||||||
raise NotValidPresetModeError(
|
raise NotValidPresetModeError(
|
||||||
f"The preset_mode {preset_mode} is not a valid preset_mode: {self.preset_modes}"
|
f"The preset_mode {preset_mode} is not a valid preset_mode:"
|
||||||
|
f" {self.preset_modes}"
|
||||||
)
|
)
|
||||||
await self._async_set_fan_mode(IKEA_NAME_TO_PRESET_MODE[preset_mode])
|
await self._async_set_fan_mode(IKEA_NAME_TO_PRESET_MODE[preset_mode])
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,10 @@ async def async_attach_trigger(
|
||||||
|
|
||||||
if not (zone_state := hass.states.get(zone_entity_id)):
|
if not (zone_state := hass.states.get(zone_entity_id)):
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Automation '%s' is referencing non-existing zone '%s' in a zone trigger",
|
(
|
||||||
|
"Automation '%s' is referencing non-existing zone '%s' in a zone"
|
||||||
|
" trigger"
|
||||||
|
),
|
||||||
trigger_info["name"],
|
trigger_info["name"],
|
||||||
zone_entity_id,
|
zone_entity_id,
|
||||||
)
|
)
|
||||||
|
|
|
@ -377,7 +377,11 @@ class ControllerEvents:
|
||||||
|
|
||||||
async_dispatcher_send(
|
async_dispatcher_send(
|
||||||
self.hass,
|
self.hass,
|
||||||
f"{DOMAIN}_{get_valueless_base_unique_id(self.driver_events.driver, node)}_remove_entity",
|
(
|
||||||
|
f"{DOMAIN}_"
|
||||||
|
f"{get_valueless_base_unique_id(self.driver_events.driver, node)}_"
|
||||||
|
"remove_entity"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.remove_device(device)
|
self.remove_device(device)
|
||||||
|
|
|
@ -63,8 +63,8 @@ class ZWaveNodePingButton(ButtonEntity):
|
||||||
async def async_poll_value(self, _: bool) -> None:
|
async def async_poll_value(self, _: bool) -> None:
|
||||||
"""Poll a value."""
|
"""Poll a value."""
|
||||||
LOGGER.error(
|
LOGGER.error(
|
||||||
"There is no value to refresh for this entity so the zwave_js.refresh_value "
|
"There is no value to refresh for this entity so the zwave_js.refresh_value"
|
||||||
"service won't work for it"
|
" service won't work for it"
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
|
|
|
@ -181,7 +181,8 @@ class ValueMappingZwaveFan(ZwaveFan):
|
||||||
return
|
return
|
||||||
|
|
||||||
raise NotValidPresetModeError(
|
raise NotValidPresetModeError(
|
||||||
f"The preset_mode {preset_mode} is not a valid preset_mode: {self.preset_modes}"
|
f"The preset_mode {preset_mode} is not a valid preset_mode:"
|
||||||
|
f" {self.preset_modes}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -490,8 +490,8 @@ class ZWaveNodeStatusSensor(SensorEntity):
|
||||||
async def async_poll_value(self, _: bool) -> None:
|
async def async_poll_value(self, _: bool) -> None:
|
||||||
"""Poll a value."""
|
"""Poll a value."""
|
||||||
LOGGER.error(
|
LOGGER.error(
|
||||||
"There is no value to refresh for this entity so the zwave_js.refresh_value "
|
"There is no value to refresh for this entity so the zwave_js.refresh_value"
|
||||||
"service won't work for it"
|
" service won't work for it"
|
||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
|
|
@ -246,8 +246,8 @@ class ZWaveNodeFirmwareUpdate(UpdateEntity):
|
||||||
async def async_poll_value(self, _: bool) -> None:
|
async def async_poll_value(self, _: bool) -> None:
|
||||||
"""Poll a value."""
|
"""Poll a value."""
|
||||||
LOGGER.error(
|
LOGGER.error(
|
||||||
"There is no value to refresh for this entity so the zwave_js.refresh_value "
|
"There is no value to refresh for this entity so the zwave_js.refresh_value"
|
||||||
"service won't work for it"
|
" service won't work for it"
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
|
|
|
@ -289,7 +289,8 @@ async def async_get_registry(hass: HomeAssistant) -> AreaRegistry:
|
||||||
This is deprecated and will be removed in the future. Use async_get instead.
|
This is deprecated and will be removed in the future. Use async_get instead.
|
||||||
"""
|
"""
|
||||||
report(
|
report(
|
||||||
"uses deprecated `async_get_registry` to access area registry, use async_get instead"
|
"uses deprecated `async_get_registry` to access area registry, use async_get"
|
||||||
|
" instead"
|
||||||
)
|
)
|
||||||
return async_get(hass)
|
return async_get(hass)
|
||||||
|
|
||||||
|
|
|
@ -385,7 +385,10 @@ def async_numeric_state( # noqa: C901
|
||||||
except (ValueError, TypeError) as ex:
|
except (ValueError, TypeError) as ex:
|
||||||
raise ConditionErrorMessage(
|
raise ConditionErrorMessage(
|
||||||
"numeric_state",
|
"numeric_state",
|
||||||
f"the 'below' entity {below} state '{below_entity.state}' cannot be processed as a number",
|
(
|
||||||
|
f"the 'below' entity {below} state '{below_entity.state}'"
|
||||||
|
" cannot be processed as a number"
|
||||||
|
),
|
||||||
) from ex
|
) from ex
|
||||||
elif fvalue >= below:
|
elif fvalue >= below:
|
||||||
condition_trace_set_result(False, state=fvalue, wanted_state_below=below)
|
condition_trace_set_result(False, state=fvalue, wanted_state_below=below)
|
||||||
|
@ -413,7 +416,10 @@ def async_numeric_state( # noqa: C901
|
||||||
except (ValueError, TypeError) as ex:
|
except (ValueError, TypeError) as ex:
|
||||||
raise ConditionErrorMessage(
|
raise ConditionErrorMessage(
|
||||||
"numeric_state",
|
"numeric_state",
|
||||||
f"the 'above' entity {above} state '{above_entity.state}' cannot be processed as a number",
|
(
|
||||||
|
f"the 'above' entity {above} state '{above_entity.state}'"
|
||||||
|
" cannot be processed as a number"
|
||||||
|
),
|
||||||
) from ex
|
) from ex
|
||||||
elif fvalue <= above:
|
elif fvalue <= above:
|
||||||
condition_trace_set_result(False, state=fvalue, wanted_state_above=above)
|
condition_trace_set_result(False, state=fvalue, wanted_state_above=above)
|
||||||
|
@ -889,7 +895,10 @@ def zone_from_config(config: ConfigType) -> ConditionCheckerType:
|
||||||
errors.append(
|
errors.append(
|
||||||
ConditionErrorMessage(
|
ConditionErrorMessage(
|
||||||
"zone",
|
"zone",
|
||||||
f"error matching {entity_id} with {zone_entity_id}: {ex.message}",
|
(
|
||||||
|
f"error matching {entity_id} with {zone_entity_id}:"
|
||||||
|
f" {ex.message}"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,8 @@ class AbstractOAuth2FlowHandler(config_entries.ConfigFlow, metaclass=ABCMeta):
|
||||||
"""Instantiate config flow."""
|
"""Instantiate config flow."""
|
||||||
if self.DOMAIN == "":
|
if self.DOMAIN == "":
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"Can't instantiate class {self.__class__.__name__} without DOMAIN being set"
|
f"Can't instantiate class {self.__class__.__name__} without DOMAIN"
|
||||||
|
" being set"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.external_data: Any = None
|
self.external_data: Any = None
|
||||||
|
@ -290,7 +291,9 @@ class AbstractOAuth2FlowHandler(config_entries.ConfigFlow, metaclass=ABCMeta):
|
||||||
return self.async_abort(
|
return self.async_abort(
|
||||||
reason="no_url_available",
|
reason="no_url_available",
|
||||||
description_placeholders={
|
description_placeholders={
|
||||||
"docs_url": "https://www.home-assistant.io/more-info/no-url-available"
|
"docs_url": (
|
||||||
|
"https://www.home-assistant.io/more-info/no-url-available"
|
||||||
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,10 @@ def deprecated_substitute(
|
||||||
if not warnings.get(module_name):
|
if not warnings.get(module_name):
|
||||||
logger = logging.getLogger(module_name)
|
logger = logging.getLogger(module_name)
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"'%s' is deprecated. Please rename '%s' to "
|
(
|
||||||
"'%s' in '%s' to ensure future support.",
|
"'%s' is deprecated. Please rename '%s' to "
|
||||||
|
"'%s' in '%s' to ensure future support."
|
||||||
|
),
|
||||||
substitute_name,
|
substitute_name,
|
||||||
substitute_name,
|
substitute_name,
|
||||||
func.__name__,
|
func.__name__,
|
||||||
|
@ -79,8 +81,10 @@ def get_deprecated(
|
||||||
|
|
||||||
logger = logging.getLogger(module_name)
|
logger = logging.getLogger(module_name)
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"'%s' is deprecated. Please rename '%s' to '%s' in your "
|
(
|
||||||
"configuration file.",
|
"'%s' is deprecated. Please rename '%s' to '%s' in your "
|
||||||
|
"configuration file."
|
||||||
|
),
|
||||||
old_name,
|
old_name,
|
||||||
old_name,
|
old_name,
|
||||||
new_name,
|
new_name,
|
||||||
|
@ -133,7 +137,10 @@ def _print_deprecation_warning(obj: Any, replacement: str, description: str) ->
|
||||||
_, integration, path = get_integration_frame()
|
_, integration, path = get_integration_frame()
|
||||||
if path == "custom_components/":
|
if path == "custom_components/":
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"%s was called from %s, this is a deprecated %s. Use %s instead, please report this to the maintainer of %s",
|
(
|
||||||
|
"%s was called from %s, this is a deprecated %s. Use %s instead,"
|
||||||
|
" please report this to the maintainer of %s"
|
||||||
|
),
|
||||||
obj.__name__,
|
obj.__name__,
|
||||||
integration,
|
integration,
|
||||||
description,
|
description,
|
||||||
|
|
|
@ -345,9 +345,11 @@ class DeviceRegistry:
|
||||||
|
|
||||||
if isinstance(entry_type, str) and not isinstance(entry_type, DeviceEntryType):
|
if isinstance(entry_type, str) and not isinstance(entry_type, DeviceEntryType):
|
||||||
report( # type: ignore[unreachable]
|
report( # type: ignore[unreachable]
|
||||||
"uses str for device registry entry_type. This is deprecated and will "
|
(
|
||||||
"stop working in Home Assistant 2022.3, it should be updated to use "
|
"uses str for device registry entry_type. This is deprecated and"
|
||||||
"DeviceEntryType instead",
|
" will stop working in Home Assistant 2022.3, it should be updated"
|
||||||
|
" to use DeviceEntryType instead"
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
entry_type = DeviceEntryType(entry_type)
|
entry_type = DeviceEntryType(entry_type)
|
||||||
|
@ -417,9 +419,11 @@ class DeviceRegistry:
|
||||||
disabled_by, DeviceEntryDisabler
|
disabled_by, DeviceEntryDisabler
|
||||||
):
|
):
|
||||||
report( # type: ignore[unreachable]
|
report( # type: ignore[unreachable]
|
||||||
"uses str for device registry disabled_by. This is deprecated and will "
|
(
|
||||||
"stop working in Home Assistant 2022.3, it should be updated to use "
|
"uses str for device registry disabled_by. This is deprecated and"
|
||||||
"DeviceEntryDisabler instead",
|
" will stop working in Home Assistant 2022.3, it should be updated"
|
||||||
|
" to use DeviceEntryDisabler instead"
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
disabled_by = DeviceEntryDisabler(disabled_by)
|
disabled_by = DeviceEntryDisabler(disabled_by)
|
||||||
|
@ -698,7 +702,8 @@ async def async_get_registry(hass: HomeAssistant) -> DeviceRegistry:
|
||||||
This is deprecated and will be removed in the future. Use async_get instead.
|
This is deprecated and will be removed in the future. Use async_get instead.
|
||||||
"""
|
"""
|
||||||
report(
|
report(
|
||||||
"uses deprecated `async_get_registry` to access device registry, use async_get instead"
|
"uses deprecated `async_get_registry` to access device registry, use async_get"
|
||||||
|
" instead"
|
||||||
)
|
)
|
||||||
return async_get(hass)
|
return async_get(hass)
|
||||||
|
|
||||||
|
|
|
@ -579,7 +579,10 @@ class Entity(ABC):
|
||||||
self._disabled_reported = True
|
self._disabled_reported = True
|
||||||
assert self.platform is not None
|
assert self.platform is not None
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Entity %s is incorrectly being triggered for updates while it is disabled. This is a bug in the %s integration",
|
(
|
||||||
|
"Entity %s is incorrectly being triggered for updates while it"
|
||||||
|
" is disabled. This is a bug in the %s integration"
|
||||||
|
),
|
||||||
self.entity_id,
|
self.entity_id,
|
||||||
self.platform.platform_name,
|
self.platform.platform_name,
|
||||||
)
|
)
|
||||||
|
@ -767,7 +770,8 @@ class Entity(ABC):
|
||||||
"""Start adding an entity to a platform."""
|
"""Start adding an entity to a platform."""
|
||||||
if self._platform_state == EntityPlatformState.ADDED:
|
if self._platform_state == EntityPlatformState.ADDED:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
f"Entity {self.entity_id} cannot be added a second time to an entity platform"
|
f"Entity {self.entity_id} cannot be added a second time to an entity"
|
||||||
|
" platform"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
|
|
|
@ -145,7 +145,12 @@ class EntityPlatform:
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
"""Represent an EntityPlatform."""
|
"""Represent an EntityPlatform."""
|
||||||
return f"<EntityPlatform domain={self.domain} platform_name={self.platform_name} config_entry={self.config_entry}>"
|
return (
|
||||||
|
"<EntityPlatform "
|
||||||
|
f"domain={self.domain} "
|
||||||
|
f"platform_name={self.platform_name} "
|
||||||
|
f"config_entry={self.config_entry}>"
|
||||||
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _get_parallel_updates_semaphore(
|
def _get_parallel_updates_semaphore(
|
||||||
|
@ -191,7 +196,10 @@ class EntityPlatform:
|
||||||
platform, "setup_platform"
|
platform, "setup_platform"
|
||||||
):
|
):
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
"The %s platform for the %s integration does not support platform setup. Please remove it from your config.",
|
(
|
||||||
|
"The %s platform for the %s integration does not support platform"
|
||||||
|
" setup. Please remove it from your config."
|
||||||
|
),
|
||||||
self.platform_name,
|
self.platform_name,
|
||||||
self.domain,
|
self.domain,
|
||||||
)
|
)
|
||||||
|
@ -327,8 +335,10 @@ class EntityPlatform:
|
||||||
return False
|
return False
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Setup of platform %s is taking longer than %s seconds."
|
(
|
||||||
" Startup will proceed without waiting any longer.",
|
"Setup of platform %s is taking longer than %s seconds."
|
||||||
|
" Startup will proceed without waiting any longer."
|
||||||
|
),
|
||||||
self.platform_name,
|
self.platform_name,
|
||||||
SLOW_SETUP_MAX_WAIT,
|
SLOW_SETUP_MAX_WAIT,
|
||||||
)
|
)
|
||||||
|
@ -514,9 +524,15 @@ class EntityPlatform:
|
||||||
f"Platform {self.platform_name} does not generate unique IDs. "
|
f"Platform {self.platform_name} does not generate unique IDs. "
|
||||||
)
|
)
|
||||||
if entity.entity_id:
|
if entity.entity_id:
|
||||||
msg += f"ID {entity.unique_id} is already used by {registered_entity_id} - ignoring {entity.entity_id}"
|
msg += (
|
||||||
|
f"ID {entity.unique_id} is already used by"
|
||||||
|
f" {registered_entity_id} - ignoring {entity.entity_id}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
msg += f"ID {entity.unique_id} already exists - ignoring {registered_entity_id}"
|
msg += (
|
||||||
|
f"ID {entity.unique_id} already exists - ignoring"
|
||||||
|
f" {registered_entity_id}"
|
||||||
|
)
|
||||||
self.logger.error(msg)
|
self.logger.error(msg)
|
||||||
entity.add_to_platform_abort()
|
entity.add_to_platform_abort()
|
||||||
return
|
return
|
||||||
|
|
|
@ -943,7 +943,8 @@ async def async_get_registry(hass: HomeAssistant) -> EntityRegistry:
|
||||||
This is deprecated and will be removed in the future. Use async_get instead.
|
This is deprecated and will be removed in the future. Use async_get instead.
|
||||||
"""
|
"""
|
||||||
report(
|
report(
|
||||||
"uses deprecated `async_get_registry` to access entity registry, use async_get instead"
|
"uses deprecated `async_get_registry` to access entity registry, use async_get"
|
||||||
|
" instead"
|
||||||
)
|
)
|
||||||
return async_get(hass)
|
return async_get(hass)
|
||||||
|
|
||||||
|
|
|
@ -884,7 +884,10 @@ class TrackTemplateResultInfo:
|
||||||
)
|
)
|
||||||
self._update_time_listeners()
|
self._update_time_listeners()
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Template group %s listens for %s, first render blocker by super template: %s",
|
(
|
||||||
|
"Template group %s listens for %s, first render blocker by super"
|
||||||
|
" template: %s"
|
||||||
|
),
|
||||||
self._track_templates,
|
self._track_templates,
|
||||||
self.listeners,
|
self.listeners,
|
||||||
block_render,
|
block_render,
|
||||||
|
@ -1106,7 +1109,10 @@ class TrackTemplateResultInfo:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Template group %s listens for %s, re-render blocker by super template: %s",
|
(
|
||||||
|
"Template group %s listens for %s, re-render blocker by super"
|
||||||
|
" template: %s"
|
||||||
|
),
|
||||||
self._track_templates,
|
self._track_templates,
|
||||||
self.listeners,
|
self.listeners,
|
||||||
block_updates,
|
block_updates,
|
||||||
|
|
|
@ -102,8 +102,10 @@ def report_integration(
|
||||||
|
|
||||||
_LOGGER.log(
|
_LOGGER.log(
|
||||||
level,
|
level,
|
||||||
"Detected integration that %s. "
|
(
|
||||||
"Please report issue%s for %s using this method at %s, line %s: %s",
|
"Detected integration that %s. "
|
||||||
|
"Please report issue%s for %s using this method at %s, line %s: %s"
|
||||||
|
),
|
||||||
what,
|
what,
|
||||||
extra,
|
extra,
|
||||||
integration,
|
integration,
|
||||||
|
|
|
@ -84,7 +84,10 @@ def find_coordinates(
|
||||||
recursion_history.append(name)
|
recursion_history.append(name)
|
||||||
if entity_state.state in recursion_history:
|
if entity_state.state in recursion_history:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Circular reference detected while trying to find coordinates of an entity. The state of %s has already been checked",
|
(
|
||||||
|
"Circular reference detected while trying to find coordinates of an"
|
||||||
|
" entity. The state of %s has already been checked"
|
||||||
|
),
|
||||||
entity_state.state,
|
entity_state.state,
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -716,7 +716,10 @@ async def _handle_entity_call(
|
||||||
|
|
||||||
if asyncio.iscoroutine(result):
|
if asyncio.iscoroutine(result):
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Service %s for %s incorrectly returns a coroutine object. Await result instead in service handler. Report bug to integration author",
|
(
|
||||||
|
"Service %s for %s incorrectly returns a coroutine object. Await result"
|
||||||
|
" instead in service handler. Report bug to integration author"
|
||||||
|
),
|
||||||
func,
|
func,
|
||||||
entity.entity_id,
|
entity.entity_id,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1409,8 +1409,8 @@ def raise_no_default(function: str, value: Any) -> NoReturn:
|
||||||
"""Log warning if no default is specified."""
|
"""Log warning if no default is specified."""
|
||||||
template, action = template_cv.get() or ("", "rendering or compiling")
|
template, action = template_cv.get() or ("", "rendering or compiling")
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Template error: {function} got invalid input '{value}' when {action} template '{template}' "
|
f"Template error: {function} got invalid input '{value}' when {action} template"
|
||||||
"but no default was specified"
|
f" '{template}' but no default was specified"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1800,7 +1800,11 @@ def struct_pack(value: Any | None, format_string: str) -> bytes | None:
|
||||||
return pack(format_string, value)
|
return pack(format_string, value)
|
||||||
except StructError:
|
except StructError:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Template warning: 'pack' unable to pack object '%s' with type '%s' and format_string '%s' see https://docs.python.org/3/library/struct.html for more information",
|
(
|
||||||
|
"Template warning: 'pack' unable to pack object '%s' with type '%s' and"
|
||||||
|
" format_string '%s' see https://docs.python.org/3/library/struct.html"
|
||||||
|
" for more information"
|
||||||
|
),
|
||||||
str(value),
|
str(value),
|
||||||
type(value).__name__,
|
type(value).__name__,
|
||||||
format_string,
|
format_string,
|
||||||
|
@ -1814,7 +1818,11 @@ def struct_unpack(value: bytes, format_string: str, offset: int = 0) -> Any | No
|
||||||
return unpack_from(format_string, value, offset)[0]
|
return unpack_from(format_string, value, offset)[0]
|
||||||
except StructError:
|
except StructError:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Template warning: 'unpack' unable to unpack object '%s' with format_string '%s' and offset %s see https://docs.python.org/3/library/struct.html for more information",
|
(
|
||||||
|
"Template warning: 'unpack' unable to unpack object '%s' with"
|
||||||
|
" format_string '%s' and offset %s see"
|
||||||
|
" https://docs.python.org/3/library/struct.html for more information"
|
||||||
|
),
|
||||||
value,
|
value,
|
||||||
format_string,
|
format_string,
|
||||||
offset,
|
offset,
|
||||||
|
|
|
@ -106,9 +106,11 @@ class _TemplateAttribute:
|
||||||
"""Handle a template result event callback."""
|
"""Handle a template result event callback."""
|
||||||
if isinstance(result, TemplateError):
|
if isinstance(result, TemplateError):
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"TemplateError('%s') "
|
(
|
||||||
"while processing template '%s' "
|
"TemplateError('%s') "
|
||||||
"for attribute '%s' in entity '%s'",
|
"while processing template '%s' "
|
||||||
|
"for attribute '%s' in entity '%s'"
|
||||||
|
),
|
||||||
result,
|
result,
|
||||||
self.template,
|
self.template,
|
||||||
self._attribute,
|
self._attribute,
|
||||||
|
@ -130,10 +132,12 @@ class _TemplateAttribute:
|
||||||
validated = self.validator(result)
|
validated = self.validator(result)
|
||||||
except vol.Invalid as ex:
|
except vol.Invalid as ex:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Error validating template result '%s' "
|
(
|
||||||
"from template '%s' "
|
"Error validating template result '%s' "
|
||||||
"for attribute '%s' in entity %s "
|
"from template '%s' "
|
||||||
"validation message '%s'",
|
"for attribute '%s' in entity %s "
|
||||||
|
"validation message '%s'"
|
||||||
|
),
|
||||||
result,
|
result,
|
||||||
self.template,
|
self.template,
|
||||||
self._attribute,
|
self._attribute,
|
||||||
|
@ -310,7 +314,10 @@ class TemplateEntity(Entity):
|
||||||
if self._self_ref_update_count > len(self._template_attrs):
|
if self._self_ref_update_count > len(self._template_attrs):
|
||||||
for update in updates:
|
for update in updates:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Template loop detected while processing event: %s, skipping template render for Template[%s]",
|
(
|
||||||
|
"Template loop detected while processing event: %s, skipping"
|
||||||
|
" template render for Template[%s]"
|
||||||
|
),
|
||||||
event,
|
event,
|
||||||
update.template.template,
|
update.template.template,
|
||||||
)
|
)
|
||||||
|
|
|
@ -118,7 +118,10 @@ def _merge_resources(
|
||||||
domain_resources.update(new_value)
|
domain_resources.update(new_value)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"An integration providing translations for %s provided invalid data: %s",
|
(
|
||||||
|
"An integration providing translations for %s provided invalid"
|
||||||
|
" data: %s"
|
||||||
|
),
|
||||||
domain,
|
domain,
|
||||||
new_value,
|
new_value,
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,7 +33,7 @@ def run(args):
|
||||||
# Disable logging
|
# Disable logging
|
||||||
logging.getLogger("homeassistant.core").setLevel(logging.CRITICAL)
|
logging.getLogger("homeassistant.core").setLevel(logging.CRITICAL)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=("Run a Home Assistant benchmark."))
|
parser = argparse.ArgumentParser(description="Run a Home Assistant benchmark.")
|
||||||
parser.add_argument("name", choices=BENCHMARKS)
|
parser.add_argument("name", choices=BENCHMARKS)
|
||||||
parser.add_argument("--script", choices=["benchmark"])
|
parser.add_argument("--script", choices=["benchmark"])
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant
|
||||||
def run(args):
|
def run(args):
|
||||||
"""Handle ensure config commandline script."""
|
"""Handle ensure config commandline script."""
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=("Ensure a Home Assistant config exists, creates one if necessary.")
|
description="Ensure a Home Assistant config exists, creates one if necessary."
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c",
|
"-c",
|
||||||
|
|
|
@ -32,10 +32,7 @@ def install_osx():
|
||||||
|
|
||||||
os.popen(f"launchctl load -w -F {path}")
|
os.popen(f"launchctl load -w -F {path}")
|
||||||
|
|
||||||
print(
|
print("Home Assistant has been installed. Open it here: http://localhost:8123")
|
||||||
"Home Assistant has been installed. \
|
|
||||||
Open it here: http://localhost:8123"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def uninstall_osx():
|
def uninstall_osx():
|
||||||
|
|
|
@ -155,8 +155,11 @@ def check_loop(
|
||||||
extra = ""
|
extra = ""
|
||||||
|
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Detected blocking call to %s inside the event loop. This is causing stability issues. "
|
(
|
||||||
"Please report issue%s for %s doing blocking calls at %s, line %s: %s",
|
"Detected blocking call to %s inside the event loop. This is causing"
|
||||||
|
" stability issues. Please report issue%s for %s doing blocking calls at"
|
||||||
|
" %s, line %s: %s"
|
||||||
|
),
|
||||||
func.__name__,
|
func.__name__,
|
||||||
extra,
|
extra,
|
||||||
integration,
|
integration,
|
||||||
|
@ -166,9 +169,10 @@ def check_loop(
|
||||||
)
|
)
|
||||||
if strict:
|
if strict:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Blocking calls must be done in the executor or a separate thread; "
|
"Blocking calls must be done in the executor or a separate thread;"
|
||||||
f"{advise_msg or 'Use `await hass.async_add_executor_job()`'}; "
|
f" {advise_msg or 'Use `await hass.async_add_executor_job()`'}; at"
|
||||||
f"at {found_frame.filename[index:]}, line {found_frame.lineno}: {(found_frame.line or '?').strip()}"
|
f" {found_frame.filename[index:]}, line {found_frame.lineno}:"
|
||||||
|
f" {(found_frame.line or '?').strip()}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,11 @@ METERS_TO: dict[str, Callable[[float], float]] = {
|
||||||
def convert(value: float, from_unit: str, to_unit: str) -> float:
|
def convert(value: float, from_unit: str, to_unit: str) -> float:
|
||||||
"""Convert one unit of measurement to another."""
|
"""Convert one unit of measurement to another."""
|
||||||
report(
|
report(
|
||||||
"uses distance utility. This is deprecated since 2022.10 and will "
|
(
|
||||||
"stop working in Home Assistant 2023.4, it should be updated to use "
|
"uses distance utility. This is deprecated since 2022.10 and will "
|
||||||
"unit_conversion.DistanceConverter instead",
|
"stop working in Home Assistant 2023.4, it should be updated to use "
|
||||||
|
"unit_conversion.DistanceConverter instead"
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
return DistanceConverter.convert(value, from_unit, to_unit)
|
return DistanceConverter.convert(value, from_unit, to_unit)
|
||||||
|
|
|
@ -84,7 +84,10 @@ def save_json(
|
||||||
dump = _orjson_default_encoder
|
dump = _orjson_default_encoder
|
||||||
json_data = _orjson_default_encoder(data)
|
json_data = _orjson_default_encoder(data)
|
||||||
except TypeError as error:
|
except TypeError as error:
|
||||||
msg = f"Failed to serialize to JSON: {filename}. Bad data at {format_unserializable_data(find_paths_unserializable_data(data, dump=dump))}"
|
formatted_data = format_unserializable_data(
|
||||||
|
find_paths_unserializable_data(data, dump=dump)
|
||||||
|
)
|
||||||
|
msg = f"Failed to serialize to JSON: {filename}. Bad data at {formatted_data}"
|
||||||
_LOGGER.error(msg)
|
_LOGGER.error(msg)
|
||||||
raise SerializationError(msg) from error
|
raise SerializationError(msg) from error
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,11 @@ VALID_UNITS = PressureConverter.VALID_UNITS
|
||||||
def convert(value: float, from_unit: str, to_unit: str) -> float:
|
def convert(value: float, from_unit: str, to_unit: str) -> float:
|
||||||
"""Convert one unit of measurement to another."""
|
"""Convert one unit of measurement to another."""
|
||||||
report(
|
report(
|
||||||
"uses pressure utility. This is deprecated since 2022.10 and will "
|
(
|
||||||
"stop working in Home Assistant 2023.4, it should be updated to use "
|
"uses pressure utility. This is deprecated since 2022.10 and will "
|
||||||
"unit_conversion.PressureConverter instead",
|
"stop working in Home Assistant 2023.4, it should be updated to use "
|
||||||
|
"unit_conversion.PressureConverter instead"
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
return PressureConverter.convert(value, from_unit, to_unit)
|
return PressureConverter.convert(value, from_unit, to_unit)
|
||||||
|
|
|
@ -34,9 +34,11 @@ VALID_UNITS = SpeedConverter.VALID_UNITS
|
||||||
def convert(value: float, from_unit: str, to_unit: str) -> float:
|
def convert(value: float, from_unit: str, to_unit: str) -> float:
|
||||||
"""Convert one unit of measurement to another."""
|
"""Convert one unit of measurement to another."""
|
||||||
report(
|
report(
|
||||||
"uses speed utility. This is deprecated since 2022.10 and will "
|
(
|
||||||
"stop working in Home Assistant 2023.4, it should be updated to use "
|
"uses speed utility. This is deprecated since 2022.10 and will "
|
||||||
"unit_conversion.SpeedConverter instead",
|
"stop working in Home Assistant 2023.4, it should be updated to use "
|
||||||
|
"unit_conversion.SpeedConverter instead"
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
return SpeedConverter.convert(value, from_unit, to_unit)
|
return SpeedConverter.convert(value, from_unit, to_unit)
|
||||||
|
|
|
@ -39,9 +39,11 @@ def convert(
|
||||||
) -> float:
|
) -> float:
|
||||||
"""Convert a temperature from one unit to another."""
|
"""Convert a temperature from one unit to another."""
|
||||||
report(
|
report(
|
||||||
"uses temperature utility. This is deprecated since 2022.10 and will "
|
(
|
||||||
"stop working in Home Assistant 2023.4, it should be updated to use "
|
"uses temperature utility. This is deprecated since 2022.10 and will "
|
||||||
"unit_conversion.TemperatureConverter instead",
|
"stop working in Home Assistant 2023.4, it should be updated to use "
|
||||||
|
"unit_conversion.TemperatureConverter instead"
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
if interval:
|
if interval:
|
||||||
|
|
|
@ -125,9 +125,11 @@ class UnitSystem:
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
"""Return the name of the unit system."""
|
"""Return the name of the unit system."""
|
||||||
report(
|
report(
|
||||||
"accesses the `name` property of the unit system. "
|
(
|
||||||
"This is deprecated and will stop working in Home Assistant 2023.1. "
|
"accesses the `name` property of the unit system. "
|
||||||
"Please adjust to use instance check instead.",
|
"This is deprecated and will stop working in Home Assistant 2023.1. "
|
||||||
|
"Please adjust to use instance check instead."
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
if self is IMPERIAL_SYSTEM:
|
if self is IMPERIAL_SYSTEM:
|
||||||
|
@ -139,9 +141,11 @@ class UnitSystem:
|
||||||
def is_metric(self) -> bool:
|
def is_metric(self) -> bool:
|
||||||
"""Determine if this is the metric unit system."""
|
"""Determine if this is the metric unit system."""
|
||||||
report(
|
report(
|
||||||
"accesses the `is_metric` property of the unit system. "
|
(
|
||||||
"This is deprecated and will stop working in Home Assistant 2023.1. "
|
"accesses the `is_metric` property of the unit system. "
|
||||||
"Please adjust to use instance check instead.",
|
"This is deprecated and will stop working in Home Assistant 2023.1. "
|
||||||
|
"Please adjust to use instance check instead."
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
return self is METRIC_SYSTEM
|
return self is METRIC_SYSTEM
|
||||||
|
|
|
@ -42,9 +42,11 @@ def cubic_feet_to_cubic_meter(cubic_feet: float) -> float:
|
||||||
def convert(volume: float, from_unit: str, to_unit: str) -> float:
|
def convert(volume: float, from_unit: str, to_unit: str) -> float:
|
||||||
"""Convert a volume from one unit to another."""
|
"""Convert a volume from one unit to another."""
|
||||||
report(
|
report(
|
||||||
"uses volume utility. This is deprecated since 2022.10 and will "
|
(
|
||||||
"stop working in Home Assistant 2023.4, it should be updated to use "
|
"uses volume utility. This is deprecated since 2022.10 and will "
|
||||||
"unit_conversion.VolumeConverter instead",
|
"stop working in Home Assistant 2023.4, it should be updated to use "
|
||||||
|
"unit_conversion.VolumeConverter instead"
|
||||||
|
),
|
||||||
error_if_core=False,
|
error_if_core=False,
|
||||||
)
|
)
|
||||||
return VolumeConverter.convert(volume, from_unit, to_unit)
|
return VolumeConverter.convert(volume, from_unit, to_unit)
|
||||||
|
|
|
@ -85,7 +85,10 @@ class Secrets:
|
||||||
_LOGGER.setLevel(logging.DEBUG)
|
_LOGGER.setLevel(logging.DEBUG)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Error in secrets.yaml: 'logger: debug' expected, but 'logger: %s' found",
|
(
|
||||||
|
"Error in secrets.yaml: 'logger: debug' expected, but"
|
||||||
|
" 'logger: %s' found"
|
||||||
|
),
|
||||||
logger,
|
logger,
|
||||||
)
|
)
|
||||||
del secrets["logger"]
|
del secrets["logger"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue