input_boolean: work_today: name: Work Today icon: mdi:briefcase tony_streaming_today: name: Tony Streaming Today icon: mdi:twitch input_datetime: tina_workday_start: name: Tina Workday Start has_date: false has_time: true icon: mdi:briefcase tina_workday_end: name: Tina Workday End has_date: false has_time: true icon: mdi:briefcase-off automation: # - id: refresh_special_event_sensors # alias: Refresh special event sensors # initial_state: true # trigger: # - platform: time # at: '00:00:01' # - platform: homeassistant # event: start # action: # - service: python_script.special_events # data: # name: Tony # type: birthday # date: !secret tony_bday # - service: python_script.special_events # data: # name: Tina # type: birthday # date: !secret tina_bday # - service: python_script.special_events # data: # name: Kallen # type: birthday # date: !secret kallen_bday # - service: python_script.special_events # data: # name: Emmalynn # type: birthday # date: !secret emmalynn_bday # - service: python_script.special_events # data: # name: Our Anniversary # type: anniversary # date: !secret wedding_anniversary - id: cd9f921f-71c7-4e29-9aee-7421ef19bdd3 alias: Work Today initial_state: true 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: - service: script.tina_work_today - id: 77f33070-4405-41b6-84c4-05b4f3697199 alias: Tony Stream Today initial_state: true trigger: - platform: time at: '08:00:00' condition: - condition: template value_template: > {%- if as_timestamp(strptime(state_attr('calendar.tony_s_twitch_schedule','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%Y-%m-%d") == now().strftime("%Y-%m-%d") %} true {%- endif -%} action: - service: script.tony_stream_today - id: a6eeb075-d21b-436c-983f-39188ee9b016 alias: Work Reset initial_state: true trigger: - platform: time at: input_datetime.tina_workday_end action: - service: script.tina_work_reset - id: 465ec4be-8e6c-444b-bfe7-6d4796888be4 alias: Tony Stream Reset initial_state: true trigger: - platform: state entity_id: sensor.twitch_ironnerd24 from: 'streaming' to: 'offline' action: - service: script.tony_stream_reset script: tina_work_today: alias: 'Tina Work Today' sequence: - service: input_datetime.set_datetime target: entity_id: input_datetime.tina_workday_start data: time: > {{ as_timestamp(strptime(state_attr('calendar.family_tinawork','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }} - service: input_datetime.set_datetime target: entity_id: input_datetime.tina_workday_end data: 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 tina_work_reset: alias: 'Tina Work Reset' sequence: - service: input_boolean.turn_off entity_id: input_boolean.work_today tony_stream_today: alias: 'Tony Stream Today' sequence: - service: input_datetime.set_datetime target: entity_id: input_datetime.tony_streaming_start_time data: time: > {{ as_timestamp(strptime(state_attr('calendar.tony_s_twitch_schedule','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }} - service: input_boolean.turn_on entity_id: input_boolean.tony_streaming_today tony_stream_reset: alias: 'Tony Stream Reset' sequence: - service: input_boolean.turn_off entity_id: input_boolean.tony_streaming_today