Initial rework of wife's work reset automation

Will DEFINITELY improve this later
This commit is contained in:
2023-05-30 14:05:11 -04:00
parent d15c374d11
commit adc25928d2

View File

@ -63,10 +63,29 @@ automation:
alias: Work Reset alias: Work Reset
initial_state: true initial_state: true
trigger: trigger:
- platform: zone
entity_id: person.christina_stork
zone: zone.home
event: enter
id: home
variables:
reason: "{{ trigger.id }}"
- platform: time - platform: time
at: input_datetime.tina_workday_end at: input_datetime.tina_workday_end
id: end
variables:
reason: "{{ trigger.id }}"
condition:
- condition: state
entity_id: input_boolean.work_today
state: 'on'
- condition: time
after: "15:00:00"
before: "00:00:00"
action: action:
- service: script.tina_work_reset - service: script.tina_work_reset
data:
reason: "{{ reason }}"
- id: 513e33b8-a236-474b-a9cc-e40af36a052d - id: 513e33b8-a236-474b-a9cc-e40af36a052d
alias: Tina Meds Handler alias: Tina Meds Handler
@ -139,10 +158,32 @@ script:
tina_work_reset: tina_work_reset:
alias: 'Tina Work Reset' alias: 'Tina Work Reset'
variables:
reason: '{{ reason|default("{}") }}'
sequence: sequence:
- service: input_boolean.turn_off - choose:
target: - conditions:
entity_id: input_boolean.work_today - condition: template
value_template: "{{ reason == 'home' }}"
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.work_today
- conditions:
- condition: template
value_template: "{{ reason == 'end' }}"
sequence:
- if:
- condition: template
value_template: "{{ states('person.christina_stork') not in ['Bob Evans','BobEvans'] }}"
then:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.work_today
default:
- service: input_boolean.turn_off
target:
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
tina_schedule_change: tina_schedule_change: