Initil after Upgrade
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user