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`
This commit is contained in:
Rick Auch 2024-03-12 04:49:42 -05:00 committed by GitHub
parent 5d4cc78296
commit 184b19d109
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -257,7 +257,24 @@ automation:
{% endraw %} {% 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 %} {% raw %}