mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-04-27 06:47:34 +00:00
Add support for attributes in (numeric) state conditions (#14271)
This commit is contained in:
parent
a5d778cb40
commit
049cde6970
@ -96,10 +96,18 @@ condition:
|
||||
|
||||
### Numeric state condition
|
||||
|
||||
This type of condition attempts to parse the state of the specified entity as a number, and triggers if the value matches the thresholds.
|
||||
This type of condition attempts to parse the state of the specified entity or the attribute of an entity as a number, and triggers if the value matches the thresholds.
|
||||
|
||||
If both `below` and `above` are specified, both tests have to pass.
|
||||
|
||||
```yaml
|
||||
condition:
|
||||
condition: numeric_state
|
||||
entity_id: sensor.temperature
|
||||
above: 17
|
||||
below: 25
|
||||
```
|
||||
|
||||
You can optionally use a `value_template` to process the value of the state before testing it.
|
||||
|
||||
```yaml
|
||||
@ -124,6 +132,18 @@ condition:
|
||||
below: 18
|
||||
```
|
||||
|
||||
Alternatively, the condition can test against a state attribute.
|
||||
The condition will pass if the attribute value of the entity matches the thresholds.
|
||||
|
||||
```yaml
|
||||
condition:
|
||||
condition: numeric_state
|
||||
entity_id: climate.living_room_thermostat
|
||||
attribute: temperature
|
||||
above: 17
|
||||
below: 25
|
||||
```
|
||||
|
||||
### State condition
|
||||
|
||||
Tests if an entity is a specified state.
|
||||
@ -178,6 +198,17 @@ condition:
|
||||
- paused
|
||||
```
|
||||
|
||||
Alternatively, the condition can test against a state attribute.
|
||||
The condition will pass if the attribute matches the given state.
|
||||
|
||||
```yaml
|
||||
condition:
|
||||
condition: state
|
||||
entity_id: climate.living_room_thermostat
|
||||
attribute: hvac_modes
|
||||
state: heat
|
||||
```
|
||||
|
||||
### Sun condition
|
||||
|
||||
#### Sun state condition
|
||||
|
Loading…
x
Reference in New Issue
Block a user