Timer modify script
This commit is contained in:
@ -76,3 +76,25 @@ automation:
|
||||
type: normal
|
||||
who: common
|
||||
message: "The timer for the kitchen is finished"
|
||||
|
||||
script:
|
||||
timer_modify:
|
||||
alias: Timer Modify
|
||||
description: For adding/subtracting time from a running timer
|
||||
mode: restart
|
||||
sequence:
|
||||
- service: timer.pause
|
||||
target:
|
||||
entity_id: "{{ timer }}"
|
||||
- delay:
|
||||
seconds: 1
|
||||
- variables:
|
||||
modify: >
|
||||
{% set x = state_attr(timer, 'remaining') ~ '-0000' %}
|
||||
{% set y = strptime(x, '%H:%M:%S%z') %}
|
||||
{{ (as_timestamp(y) + change) | timestamp_custom('%H:%M:%S', false) }}
|
||||
- service: timer.start
|
||||
target:
|
||||
entity_id: "{{ timer }}"
|
||||
data:
|
||||
duration: "{{ modify }}"
|
Reference in New Issue
Block a user