From 7e36da4cc0b2bf1ee962f3b8e96eb1ef4fe6a1ea Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 4 Sep 2023 20:17:30 +0200 Subject: [PATCH] Small cleanup of WS command render_template (#99562) --- homeassistant/components/websocket_api/commands.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index c6564967a39..84c7567a40e 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -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} ) )