mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Trigger on not matching to/from states (#22322)
This commit is contained in:
parent
88dd32b169
commit
c3fabfa466
@ -326,7 +326,7 @@ If for your use case this is undesired, you could consider using the automation
|
||||
## State trigger
|
||||
|
||||
Fires when the state of any of given entities changes. If only `entity_id` is given, the trigger will fire for all state changes, even if only state attributes change.
|
||||
If at least one of `from` or `to` are given, the trigger will fire on any matching state change, but not if only attributes change. To trigger on all state changes, but not on changed attributes, set at least one of `from` or `to` to `null`.
|
||||
If at least one of `from`, `to`, `not_from`, or `not_to` are given, the trigger will fire on any matching state change, but not if only attributes change. To trigger on all state changes, but not on changed attributes, set at least one of `from`, `to`, `not_from`, or `not_to` to `null`.
|
||||
|
||||
<div class='note'>
|
||||
|
||||
@ -370,6 +370,21 @@ automation:
|
||||
to:
|
||||
```
|
||||
|
||||
The `not_from` and `not_to` options are the counter parts of `from` and `to`. They can be used to trigger on state changes that are **not** the specified state. This can be useful to trigger on all state changes, except specific ones.
|
||||
|
||||
```yaml
|
||||
automation:
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: vacuum.test
|
||||
not_from:
|
||||
- "unknown"
|
||||
- "unavailable"
|
||||
to: "on"
|
||||
```
|
||||
|
||||
You cannot use `from` and `not_from` at the same time. The same applies to `to` and `not_to`.
|
||||
|
||||
### Triggering on attribute changes
|
||||
|
||||
When the `attribute` option is specified, the trigger only fires
|
||||
|
Loading…
x
Reference in New Issue
Block a user