Timer modify script
This commit is contained in:
@ -75,4 +75,26 @@ automation:
|
|||||||
data:
|
data:
|
||||||
type: normal
|
type: normal
|
||||||
who: common
|
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 }}"
|
Reference in New Issue
Block a user