mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 23:06:58 +00:00
Add documentation for supporting offsets (#33611)
This commit is contained in:
parent
855d78c483
commit
af018c77bd
@ -751,9 +751,32 @@ automation:
|
||||
entity_id: light.bedroom
|
||||
```
|
||||
|
||||
### Sensors of datetime device class with offsets
|
||||
|
||||
When the time is provided using a sensor of the timestamp device class, an offset can be provided. This offset will be added to (or subtracted from when negative) the sensor value.
|
||||
|
||||
For example, this trigger fires 5 minutes before the phone alarm goes off.
|
||||
|
||||
```yaml
|
||||
automation:
|
||||
- trigger:
|
||||
- platform: time
|
||||
at:
|
||||
entity_id: sensor.phone_next_alarm
|
||||
offset: -00:05:00
|
||||
action:
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id: light.bedroom
|
||||
```
|
||||
|
||||
{% important %}
|
||||
When using a positive offset the trigger might never fire. This is due to the sensor changing before the offset is reached. For example, when using a phone alarm as a trigger, the sensor value will change to the new alarm time when the alarm goes off, which means this trigger will change to the new time as well.
|
||||
{% endimportant %}
|
||||
|
||||
### Multiple times
|
||||
|
||||
Multiple times can be provided in a list. Both formats can be intermixed.
|
||||
Multiple times can be provided in a list. All formats can be intermixed.
|
||||
|
||||
```yaml
|
||||
automation:
|
||||
@ -762,6 +785,8 @@ automation:
|
||||
at:
|
||||
- input_datetime.leave_for_work
|
||||
- "18:30:00"
|
||||
- entity_id: sensor.bus_arrival
|
||||
offset: "-00:10:00"
|
||||
```
|
||||
|
||||
## Time pattern trigger
|
||||
|
Loading…
x
Reference in New Issue
Block a user