Update work today and school today automations/scripts

This commit is contained in:
2023-03-22 13:14:54 -04:00
parent 6a63faa7aa
commit 41f780b4e9
2 changed files with 24 additions and 14 deletions

View File

@ -266,14 +266,18 @@ automation:
trigger: trigger:
- platform: time - platform: time
at: '04:00:10' at: '04:00:10'
condition: action:
- if:
- condition: template - condition: template
value_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") %} {%- 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 true
{%- endif -%} {%- endif -%}
action: then:
- service: script.kallen_school_today - service: script.kallen_school_today
- service: input_boolean.turn_on
target:
entity_id: input_boolean.school_today_ran
- id: b9028665-401c-4de3-8f13-1099160b011f - id: b9028665-401c-4de3-8f13-1099160b011f
alias: Kallen School Reset alias: Kallen School Reset

View File

@ -24,14 +24,18 @@ automation:
trigger: trigger:
- platform: time - platform: time
at: '04:00:00' at: '04:00:00'
condition: action:
- if:
- condition: template - condition: template
value_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") %} {%- 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 true
{%- endif -%} {%- endif -%}
action: then:
- service: script.tina_work_today - service: script.tina_work_today
- service: input_boolean.turn_on
target:
entity_id: input_boolean.work_today_ran
- id: a6eeb075-d21b-436c-983f-39188ee9b016 - id: a6eeb075-d21b-436c-983f-39188ee9b016
alias: Work Reset alias: Work Reset
@ -59,12 +63,14 @@ script:
time: > time: >
{{ as_timestamp(strptime(state_attr('calendar.family_tinawork','end_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }} {{ 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 - service: input_boolean.turn_on
target:
entity_id: input_boolean.work_today entity_id: input_boolean.work_today
tina_work_reset: tina_work_reset:
alias: 'Tina Work Reset' alias: 'Tina Work Reset'
sequence: sequence:
- service: input_boolean.turn_off - service: input_boolean.turn_off
target:
entity_id: input_boolean.work_today entity_id: input_boolean.work_today
# This is in case her schedule changes after the regular 4:00AM scheduling scripts run # This is in case her schedule changes after the regular 4:00AM scheduling scripts run