From 41f780b4e968020d2a29319e91e644895348d2bf Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Wed, 22 Mar 2023 13:14:54 -0400 Subject: [PATCH] Update work today and school today automations/scripts --- packages/school.yaml | 16 ++++++++++------ packages/tina.yaml | 22 ++++++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/packages/school.yaml b/packages/school.yaml index 83ce397..fb27cc5 100644 --- a/packages/school.yaml +++ b/packages/school.yaml @@ -266,14 +266,18 @@ automation: trigger: - platform: time at: '04:00:10' - condition: - - condition: template - value_template: > - {%- if as_timestamp(strptime(state_attr('calendar.kallen_school_days', 'start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%Y-%m-%d") == now().strftime("%Y-%m-%d") %} - true - {%- endif -%} action: + - if: + - condition: template + value_template: > + {%- if as_timestamp(strptime(state_attr('calendar.kallen_school_days', 'start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%Y-%m-%d") == now().strftime("%Y-%m-%d") %} + true + {%- endif -%} + then: - service: script.kallen_school_today + - service: input_boolean.turn_on + target: + entity_id: input_boolean.school_today_ran - id: b9028665-401c-4de3-8f13-1099160b011f alias: Kallen School Reset diff --git a/packages/tina.yaml b/packages/tina.yaml index 223f56b..032acfc 100644 --- a/packages/tina.yaml +++ b/packages/tina.yaml @@ -24,14 +24,18 @@ automation: trigger: - platform: time at: '04:00:00' - condition: - - condition: template - value_template: > - {%- if as_timestamp(strptime(state_attr('calendar.family_tinawork','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%Y-%m-%d") == now().strftime("%Y-%m-%d") %} - true - {%- endif -%} action: + - if: + - condition: template + value_template: > + {%- if as_timestamp(strptime(state_attr('calendar.family_tinawork','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%Y-%m-%d") == now().strftime("%Y-%m-%d") %} + true + {%- endif -%} + then: - service: script.tina_work_today + - service: input_boolean.turn_on + target: + entity_id: input_boolean.work_today_ran - id: a6eeb075-d21b-436c-983f-39188ee9b016 alias: Work Reset @@ -59,13 +63,15 @@ script: time: > {{ as_timestamp(strptime(state_attr('calendar.family_tinawork','end_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }} - service: input_boolean.turn_on - entity_id: input_boolean.work_today + target: + entity_id: input_boolean.work_today tina_work_reset: alias: 'Tina Work Reset' sequence: - service: input_boolean.turn_off - entity_id: input_boolean.work_today + target: + entity_id: input_boolean.work_today # This is in case her schedule changes after the regular 4:00AM scheduling scripts run tina_schedule_change: