Split time_pattern triggers from time trigger (#8080)

* Split interval triggers from time trigger

* Default smaller interval units to zero

* Rename interval to schedule

* Rename schedule trigger to time_pattern
This commit is contained in:
Adam Mills 2019-01-15 16:29:42 -05:00 committed by Franck Nijhof
parent ff7c1182b3
commit 6616750d57

View File

@ -165,33 +165,40 @@ Rendering templates with time (`now()`) is dangerous as trigger templates only u
### {% linkable_title Time trigger %} ### {% linkable_title Time trigger %}
Time can be triggered in many ways. The most common is to specify `at` and trigger at a specific point in time each day. Alternatively, you can also match if the hour, minute or second of the current time has a specific value. You can prefix the value with a `/` to match whenever the value is divisible by that number. You cannot use `at` together with hour, minute or second. The time trigger is configured to run once at a specific point in time each day.
```yaml ```yaml
automation: automation:
trigger: trigger:
platform: time platform: time
# Military time format. This trigger will fire at 3:32 PM
at: '15:32:00'
```
### {% linkable_title Time pattern trigger %}
With the time pattern trigger, you can match if the hour, minute or second of the current time matches a specific value. You can prefix the value with a `/` to match whenever the value is divisible by that number. You can specify `*` to match any value.
```yaml
automation:
trigger:
platform: time_pattern
# Matches every hour at 5 minutes past whole # Matches every hour at 5 minutes past whole
minutes: 5 minutes: 5
seconds: 00
automation 2: automation 2:
trigger: trigger:
platform: time platform: time_pattern
# When 'at' is used, you cannot also match on hour, minute, seconds. # Trigger once per minute during the hour of 3
# Military time format. hours: '3'
at: '15:32:00' minutes: '*'
automation 3: automation 3:
trigger: trigger:
platform: time platform: time_pattern
# You can also match on interval. This will match every 5 minutes # You can also match on interval. This will match every 5 minutes
minutes: '/5' minutes: '/5'
seconds: 00
``` ```
<p class='note warning'>
Remember that if you are using matching to include both `minutes` and `seconds`. Without `seconds`, your automation will trigger 60 times during the matching minute.
</p>
### {% linkable_title Webhook trigger %} ### {% linkable_title Webhook trigger %}