From 184b19d1091ace474e98c32fbd6e9e78e64239aa Mon Sep 17 00:00:00 2001 From: Rick Auch <48502913+mekaneck@users.noreply.github.com> Date: Tue, 12 Mar 2024 04:49:42 -0500 Subject: [PATCH] Add state object detail to numeric state (#31809) * Add state object detail to numeric state The numeric state trigger populates an object called `state` but this was not in the documentation previously. This change makes it explicit and also provides a link to the relevant state object documentation. * Update trigger.markdown User more concise explanation of the state object in the numeric trigger, and added an example using `state.state` * Update trigger.markdown Added explanation to examples that use `state` --- source/_docs/automation/trigger.markdown | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source/_docs/automation/trigger.markdown b/source/_docs/automation/trigger.markdown index dc4fcc8a889..ae76aad53d6 100644 --- a/source/_docs/automation/trigger.markdown +++ b/source/_docs/automation/trigger.markdown @@ -257,7 +257,24 @@ automation: {% endraw %} -More dynamic and complex calculations can be done with `value_template`. +More dynamic and complex calculations can be done with `value_template`. The variable 'state' is the [state object](/docs/configuration/state_object) of the entity specified by `entity_id`. + +The state of the entity can be referenced like this: + +{% raw %} + +```yaml +automation: + trigger: + - platform: numeric_state + entity_id: sensor.temperature + value_template: "{{ state.state | float * 9 / 5 + 32 }}" + above: 70 +``` + +{% endraw %} + +Attributes of the entity can be referenced like this: {% raw %}