Initil after Upgrade

This commit is contained in:
2026-06-15 10:53:52 -04:00
parent 2fe9bf0dd6
commit 887feaa50a
143 changed files with 2288 additions and 881 deletions
+11 -3
View File
@@ -32,7 +32,7 @@ _LOGGER = logging.getLogger(__name__)
PLACEHOLDER_REGEX = re.compile(r"\[\[\s*([A-Za-z_]\w*(?::[A-Za-z_]\w*)*)\s*\]\]")
async def evaluate_power(power: Template | Decimal | float) -> Decimal | None:
def evaluate_power(power: Template | Decimal | float) -> Decimal | None:
"""When power is a template render it."""
if isinstance(power, Decimal):
@@ -154,7 +154,10 @@ def collect_placeholders(data: list | str | dict[str, Any]) -> set[str]:
return found
def replace_placeholders(data: list | str | dict[str, Any], replacements: dict[str, str]) -> list | str | dict[str, Any]:
def replace_placeholders(
data: list | str | dict[str, Any],
replacements: dict[str, str],
) -> list | str | dict[str, Any]:
"""Replace placeholders in a dictionary with values from a replacement dictionary."""
if isinstance(data, dict):
for key, value in data.items():
@@ -304,7 +307,12 @@ def _get_related_entity_for_device(
if matcher(entity_entry)
]
if not related_entities:
_LOGGER.debug("No related entities found for device %s with %s %s", source_entity.device_entry.id, match_label, match_value)
_LOGGER.debug(
"No related entities found for device %s with %s %s",
source_entity.device_entry.id,
match_label,
match_value,
)
return None
return related_entities[0]