mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Split long strings in components (#135263)
This commit is contained in:
parent
5df7092f41
commit
e29ead2a36
@ -131,7 +131,10 @@ def _no_overlapping(configs: list[dict]) -> list[dict]:
|
||||
for i, tup in enumerate(intervals):
|
||||
if len(intervals) > i + 1 and tup.below > intervals[i + 1].above:
|
||||
raise vol.Invalid(
|
||||
f"Ranges for bayesian numeric state entities must not overlap, but {ent_id} has overlapping ranges, above:{tup.above}, below:{tup.below} overlaps with above:{intervals[i+1].above}, below:{intervals[i+1].below}."
|
||||
"Ranges for bayesian numeric state entities must not overlap, "
|
||||
f"but {ent_id} has overlapping ranges, above:{tup.above}, "
|
||||
f"below:{tup.below} overlaps with above:{intervals[i + 1].above}, "
|
||||
f"below:{intervals[i + 1].below}."
|
||||
)
|
||||
return configs
|
||||
|
||||
@ -206,7 +209,10 @@ async def async_setup_platform(
|
||||
broken_observations: list[dict[str, Any]] = []
|
||||
for observation in observations:
|
||||
if CONF_P_GIVEN_F not in observation:
|
||||
text: str = f"{name}/{observation.get(CONF_ENTITY_ID,'')}{observation.get(CONF_VALUE_TEMPLATE,'')}"
|
||||
text = (
|
||||
f"{name}/{observation.get(CONF_ENTITY_ID, '')}"
|
||||
f"{observation.get(CONF_VALUE_TEMPLATE, '')}"
|
||||
)
|
||||
raise_no_prob_given_false(hass, text)
|
||||
_LOGGER.error("Missing prob_given_false YAML entry for %s", text)
|
||||
broken_observations.append(observation)
|
||||
|
@ -38,7 +38,9 @@ def _item_preset_payload(preset: Preset, player_mode: str) -> BrowseMedia:
|
||||
media_content_type=MediaType.CHANNEL,
|
||||
# We add 1 to the preset key to keep it in sync with the numbering shown
|
||||
# on the interface of the device
|
||||
media_content_id=f"{player_mode}/{MEDIA_CONTENT_ID_PRESET}/{int(preset.key)+1}",
|
||||
media_content_id=(
|
||||
f"{player_mode}/{MEDIA_CONTENT_ID_PRESET}/{int(preset.key) + 1}"
|
||||
),
|
||||
can_play=True,
|
||||
can_expand=False,
|
||||
)
|
||||
|
@ -184,12 +184,12 @@ class IstaSensor(CoordinatorEntity[IstaCoordinator], SensorEntity):
|
||||
self.consumption_unit = consumption_unit
|
||||
self.entity_description = entity_description
|
||||
self._attr_unique_id = f"{consumption_unit}_{entity_description.key}"
|
||||
address = coordinator.details[consumption_unit]["address"]
|
||||
self._attr_device_info = DeviceInfo(
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
manufacturer="ista SE",
|
||||
model="ista EcoTrend",
|
||||
name=f"{coordinator.details[consumption_unit]["address"]["street"]} "
|
||||
f"{coordinator.details[consumption_unit]["address"]["houseNumber"]}".strip(),
|
||||
name=f"{address['street']} {address['houseNumber']}".strip(),
|
||||
configuration_url="https://ecotrend.ista.de/",
|
||||
identifiers={(DOMAIN, consumption_unit)},
|
||||
)
|
||||
|
@ -138,7 +138,10 @@ def get_origin_log_string(
|
||||
support_url_log = ""
|
||||
if include_url and (support_url := get_origin_support_url(discovery_payload)):
|
||||
support_url_log = f", support URL: {support_url}"
|
||||
return f" from external application {origin_info["name"]}{sw_version_log}{support_url_log}"
|
||||
return (
|
||||
" from external application "
|
||||
f"{origin_info['name']}{sw_version_log}{support_url_log}"
|
||||
)
|
||||
|
||||
|
||||
@callback
|
||||
|
@ -79,7 +79,10 @@ class PicnicUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""Get the address that identifies the Picnic service."""
|
||||
if self._user_address is None:
|
||||
address = self.picnic_api_client.get_user()["address"]
|
||||
self._user_address = f'{address["street"]} {address["house_number"]}{address["house_number_ext"]}'
|
||||
self._user_address = (
|
||||
f"{address['street']} "
|
||||
f"{address['house_number']}{address['house_number_ext']}"
|
||||
)
|
||||
|
||||
return self._user_address
|
||||
|
||||
|
@ -67,7 +67,7 @@ def get_queue_attr(queue: SonarrQueue) -> dict[str, str]:
|
||||
remaining = 1 if item.size == 0 else item.sizeleft / item.size
|
||||
remaining_pct = 100 * (1 - remaining)
|
||||
identifier = (
|
||||
f"S{item.episode.seasonNumber:02d}E{item.episode. episodeNumber:02d}"
|
||||
f"S{item.episode.seasonNumber:02d}E{item.episode.episodeNumber:02d}"
|
||||
)
|
||||
attrs[f"{item.series.title} {identifier}"] = f"{remaining_pct:.2f}%"
|
||||
return attrs
|
||||
@ -120,7 +120,8 @@ SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = {
|
||||
value_fn=len,
|
||||
attributes_fn=lambda data: {
|
||||
i.title: (
|
||||
f"{getattr(i.statistics,'episodeFileCount', 0)}/{getattr(i.statistics, 'episodeCount', 0)} Episodes"
|
||||
f"{getattr(i.statistics, 'episodeFileCount', 0)}/"
|
||||
f"{getattr(i.statistics, 'episodeCount', 0)} Episodes"
|
||||
)
|
||||
for i in data
|
||||
},
|
||||
|
@ -188,9 +188,13 @@ class HlsPlaylistView(StreamView):
|
||||
if track.stream_settings.ll_hls:
|
||||
playlist.extend(
|
||||
[
|
||||
f"#EXT-X-PART-INF:PART-TARGET={track.stream_settings.part_target_duration:.3f}",
|
||||
f"#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,PART-HOLD-BACK={2*track.stream_settings.part_target_duration:.3f}",
|
||||
f"#EXT-X-START:TIME-OFFSET=-{EXT_X_START_LL_HLS*track.stream_settings.part_target_duration:.3f},PRECISE=YES",
|
||||
"#EXT-X-PART-INF:PART-TARGET="
|
||||
f"{track.stream_settings.part_target_duration:.3f}",
|
||||
"#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,PART-HOLD-BACK="
|
||||
f"{2 * track.stream_settings.part_target_duration:.3f}",
|
||||
"#EXT-X-START:TIME-OFFSET=-"
|
||||
f"{EXT_X_START_LL_HLS * track.stream_settings.part_target_duration:.3f}"
|
||||
",PRECISE=YES",
|
||||
]
|
||||
)
|
||||
else:
|
||||
@ -203,7 +207,9 @@ class HlsPlaylistView(StreamView):
|
||||
# which seems to take precedence for setting target delay. Yet it also
|
||||
# doesn't seem to hurt, so we can stick with it for now.
|
||||
playlist.append(
|
||||
f"#EXT-X-START:TIME-OFFSET=-{EXT_X_START_NON_LL_HLS*track.target_duration:.3f},PRECISE=YES"
|
||||
"#EXT-X-START:TIME-OFFSET=-"
|
||||
f"{EXT_X_START_NON_LL_HLS * track.target_duration:.3f}"
|
||||
",PRECISE=YES"
|
||||
)
|
||||
|
||||
last_stream_id = first_segment.stream_id
|
||||
|
@ -146,7 +146,8 @@ async def async_migrate_devices_and_entities(
|
||||
# to `<device_identifier>-heating-<circuit_no>`
|
||||
if entity_entry.domain == DOMAIN_CLIMATE:
|
||||
unique_id_parts[len(unique_id_parts) - 1] = (
|
||||
f"{entity_entry.translation_key}-{unique_id_parts[len(unique_id_parts)-1]}"
|
||||
f"{entity_entry.translation_key}-"
|
||||
f"{unique_id_parts[len(unique_id_parts) - 1]}"
|
||||
)
|
||||
entity_new_unique_id = "-".join(unique_id_parts)
|
||||
|
||||
|
@ -29,7 +29,11 @@ class ViCareEntity(Entity):
|
||||
gateway_serial = device_config.getConfig().serial
|
||||
device_id = device_config.getId()
|
||||
|
||||
identifier = f"{gateway_serial}_{device_serial.replace("zigbee-", "zigbee_") if device_serial is not None else device_id}"
|
||||
identifier = (
|
||||
f"{gateway_serial}_{device_serial.replace('zigbee-', 'zigbee_')}"
|
||||
if device_serial is not None
|
||||
else f"{gateway_serial}_{device_id}"
|
||||
)
|
||||
|
||||
self._api: PyViCareDevice | PyViCareHeatingDeviceComponent = (
|
||||
component if component else device
|
||||
|
Loading…
x
Reference in New Issue
Block a user