From e2687d9f979dffab6e2d7ca9949a615be2db3139 Mon Sep 17 00:00:00 2001 From: Piotr Machowski <6118709+PiotrMachowski@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:12:31 +0100 Subject: [PATCH] Add documentation of state_translated jinja function (#31323) Co-authored-by: Piotr Machowski --- .../_docs/configuration/templating.markdown | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index 33f07722ad2..21e11ffcdee 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -325,6 +325,32 @@ List of lights that are on with a brightness of 255: {% endraw %} + +### State translated + +Not supported in [limited templates](#limited-templates). + +The `state_translated` function returns a translated state of an entity using a language that is currently configured in the [general settings](https://my.home-assistant.io/redirect/general/). + +#### State translated examples + +{% raw %} + +```text +{{ states("sun.sun") }} # below_horizon +{{ state_translated("sun.sun") }} # Below horizon +{{ "sun.sun" | state_translated }} # Below horizon +``` + +```text +{{ states("binary_sensor.movement_backyard") }} # on +{{ state_translated("binary_sensor.movement_backyard") }} # Detected +{{ "binary_sensor.movement_backyard" | state_translated }} # Detected +``` + +{% endraw %} + + ### Working with groups Not supported in [limited templates](#limited-templates).