mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
Add state trigger examples with to/for and from/for (#14363)
This commit is contained in:
parent
68a3779895
commit
c859cd071d
@ -152,9 +152,30 @@ automation:
|
|||||||
from: "not_home"
|
from: "not_home"
|
||||||
# Optional
|
# Optional
|
||||||
to: "home"
|
to: "home"
|
||||||
|
```
|
||||||
|
|
||||||
# If given, will trigger when state has been the to state for X time.
|
#### Holding a state
|
||||||
for: "01:10:05"
|
|
||||||
|
You can use `for` to have the state trigger only fire if the state holds for some time.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
automation:
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: light.office
|
||||||
|
# Must stay "on" for 30 seconds
|
||||||
|
to: "on"
|
||||||
|
for: "00:00:30"
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
automation:
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: media_player.kitchen
|
||||||
|
# Not "playing" for 30 seconds
|
||||||
|
from: "playing"
|
||||||
|
for: "00:00:30"
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use templates in the `for` option.
|
You can also use templates in the `for` option.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user