Render a Jinja2 template via subscription
ws_render_templateRender a Jinja2 template using Home Assistant's WebSocket render_template subscription, waiting for the streamed event result. Use when WebSocket transport is specifically required.
Instructions
Render a Jinja2 template through HA's WebSocket render_template subscription.
Sends render_template; HA acknowledges the subscription with a null
result, then streams the rendered value in a follow-up event. This
waits up to timeout seconds for that event and returns its result.
Use when: the WebSocket transport itself is specifically required.
Not for: a one-shot render — use services_render_template, a plain
HTTP call with no subscription semantics.
Returns: the rendered template value from the event's result field.
Errors: raises RuntimeError when the template itself errors (e.g. an
undefined variable), when the WebSocket handshake does not complete
within timeout, or when no event arrives within timeout.
Limits: blocks for up to timeout seconds (default 10), including the
initial handshake.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | Maximum seconds to wait for the rendered value before raising an error; must be between 1 and 300. | |
| template | Yes | Jinja2 template string to render, e.g. '{{ states("sensor.temp") }}'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |