diff --git a/packages/time.yaml b/packages/time.yaml index 30c9799..ebe4417 100644 --- a/packages/time.yaml +++ b/packages/time.yaml @@ -75,4 +75,26 @@ automation: data: type: normal who: common - message: "The timer for the kitchen is finished" \ No newline at end of file + 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 }}" \ No newline at end of file