Add native Python types support to templates (#41227)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
1 parent
cbb4324c84
commit
ee914366a8
29 files changed
+349
-282
No files matched your search
@@ -410,7 +410,7 @@ class APITemplateView(HomeAssistantView):
|
||||
try:
|
||||
data = await request.json()
|
||||
tpl = template.Template(data["template"], request.app["hass"])
|
||||
return tpl.async_render(data.get("variables"))
|
||||
return str(tpl.async_render(data.get("variables")))
|
||||
except (ValueError, TemplateError) as ex:
|
||||
return self.json_message(
|
||||
f"Error rendering template: {ex}", HTTP_BAD_REQUEST
|
||||
|
||||
Reference in new issue
Block a user