Add example

This commit is contained in:
Fabian Affolter 2018-01-28 23:07:24 +01:00
parent 034e65aa13
commit 5eba15c0e4
No known key found for this signature in database
GPG Key ID: DDF3D6F44AAB1336

View File

@ -92,17 +92,19 @@ Select <img src='/images/screenshots/developer-tool-services-icon.png' alt='serv
}
```
### {% linkable_title Configuration example %}
## {% linkable_title Examples %}
Set a timer called `test` to a duration of 30 seconds.
```yaml
# Example configuration.yaml entry
# Set a timer called test to a duration of 30 seconds:
timer:
test:
duration: '00:00:30'
```
### {% linkable_title Control a timer from the frontend %}
```yaml
# Example automations.yaml entry
- action:
@ -131,3 +133,31 @@ timer:
entity_id: timer.test
```
### {% linkable_title Control a timer from the frontend %}
With the [`script`](/components/script/) component you would be able to control a timer (see above for a `timer` configuration sample) manually.
```yaml
script:
start_timer:
alias: Start timer
sequence:
- service: timer.start
entity_id: timer.test
pause_timer:
alias: Pause timer
sequence:
- service: timer.pause
entity_id: timer.test
cancel_timer:
alias: Cancel timer
sequence:
- service: timer.cancel
entity_id: timer.test
finish_timer:
alias: Finish timer
sequence:
- service: timer.finish
entity_id: timer.test
```