From c15e1b62891b2fd044a88495d3daf1515cc05310 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 2 Oct 2023 20:45:50 -0400 Subject: [PATCH] Migrate time automations and scripts #154 --- automations.yaml | 22 ++++++++++++++++++++++ packages/time.yaml | 46 +--------------------------------------------- scripts.yaml | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 45 deletions(-) diff --git a/automations.yaml b/automations.yaml index eeb84c5..7a7e886 100644 --- a/automations.yaml +++ b/automations.yaml @@ -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 diff --git a/packages/time.yaml b/packages/time.yaml index ebe4417..8edc3dd 100644 --- a/packages/time.yaml +++ b/packages/time.yaml @@ -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 }}" \ No newline at end of file + text: "Okay" \ No newline at end of file diff --git a/scripts.yaml b/scripts.yaml index 977db81..b2a41cf 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -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 }}'