Migrate time automations and scripts #154

This commit is contained in:
2023-10-02 20:45:50 -04:00
parent c44d8e1bee
commit c15e1b6289
3 changed files with 44 additions and 45 deletions

View File

@ -2201,3 +2201,25 @@
data:
value: '{{ states(''sensor.todays_high_temp'') | int }}'
mode: single
- id: '1696293127764'
alias: Timer Handling
description: This automation will handle when house timers (usually set by voice)
are finished
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_timer
id: kitchen-finished
condition: []
action:
- choose:
- conditions: '{{ trigger.id == ''kitchen-finished'' }}'
sequence:
- service: script.speech_engine
data:
type: normal
who: common
message: The timer for the kitchen is finished
mode: queued
max: 10

View File

@ -53,48 +53,4 @@ intent_script:
target:
entity_id: "{{ room }}"
speech:
text: "Okay"
automation:
- id: 849b72f0-89e9-421b-9e75-01a6d977488d
alias: Timer Handling
description: This automation will handle when house timers (usually set by voice) are finished
mode: queued
max: 10
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_timer
id: kitchen-finished
action:
- choose:
- conditions: "{{ trigger.id == 'kitchen-finished' }}"
sequence:
- service: script.speech_engine
data:
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 }}"
text: "Okay"

View File

@ -1778,3 +1778,24 @@ bright_mode_in_tina_desk:
brightness: 255
mode: restart
icon: mdi:palette
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 }}'