Timer modify script

This commit is contained in:
2023-09-27 15:52:29 -04:00
parent ca20bf05f6
commit 71b97e5e0e

View File

@ -75,4 +75,26 @@ automation:
data:
type: normal
who: common
message: "The timer for the kitchen is finished"
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 }}"