Small cleanup of WS command render_template (#99562)

pull/99636/head
Erik Montnemery 2023-09-04 20:17:30 +02:00 committed by GitHub
parent 26fd36dc4c
commit 7e36da4cc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -516,7 +516,6 @@ async def handle_render_template(
template_obj = _cached_template(template_str, hass)
variables = msg.get("variables")
timeout = msg.get("timeout")
info = None
if timeout:
try:
@ -540,7 +539,6 @@ async def handle_render_template(
event: EventType[EventStateChangedData] | None,
updates: list[TrackTemplateResult],
) -> None:
nonlocal info
track_template_result = updates.pop()
result = track_template_result.result
if isinstance(result, TemplateError):
@ -549,7 +547,7 @@ async def handle_render_template(
connection.send_message(
messages.event_message(
msg["id"], {"result": result, "listeners": info.listeners} # type: ignore[attr-defined]
msg["id"], {"result": result, "listeners": info.listeners}
)
)