@@ -1343,17 +1343,17 @@ def run_script(
13431343 # Functions that use self.render_template
13441344
13451345 @utils .sync_decorator
1346- async def render_template (self , template : str , namespace : str | None = None ) -> Any :
1346+ async def render_template (self , template : str , namespace : str | None = None , ** kwargs ) -> Any :
13471347 """Renders a Home Assistant Template.
13481348
13491349 See the documentation for the `Template Integration <https://www.home-assistant.io/integrations/template>`__ and
13501350 `Templating Configuration <https://www.home-assistant.io/docs/configuration/templating>`__ for more information.
13511351
13521352 Args:
13531353 template (str): The Home Assistant template to be rendered.
1354- namespace (str, optional): Namespace to use for the call . See the section on
1355- `namespaces <APPGUIDE.html#namespaces>`__ for a detailed description .
1356- In most cases it is safe to ignore this parameter .
1354+ namespace (str, optional): Optional namespace to use. Defaults to using the app's current namespace . See the
1355+ `namespace documentation <APPGUIDE.html#namespaces>`__ for more information .
1356+ **kwargs (optional): Zero or more keyword arguments that get passed to the template rendering .
13571357
13581358 Returns:
13591359 The rendered template in a native Python type.
@@ -1368,11 +1368,14 @@ async def render_template(self, template: str, namespace: str | None = None) ->
13681368 >>> self.render_template("{{ states('sensor.outside_temp') }}")
13691369 97.2
13701370
1371+ >>> self.render_template("hello {{ name }}", variables={"name": "bob"})
1372+ hello bob
1373+
13711374 """
13721375 plugin : "HassPlugin" = self .AD .plugins .get_plugin_object (
13731376 namespace or self .namespace
13741377 )
1375- result = await plugin .render_template (self .namespace , template )
1378+ result = await plugin .render_template (self .namespace , template , ** kwargs )
13761379 try :
13771380 return literal_eval (result )
13781381 except (SyntaxError , ValueError ):
0 commit comments