Added logic for wife's work status
This commit is contained in:
@ -8,6 +8,9 @@ input_boolean:
|
||||
school_early_release:
|
||||
name: School Early Release
|
||||
icon: mdi:bus-school
|
||||
work_today:
|
||||
name: Work Today
|
||||
icon: mdi:briefcase
|
||||
|
||||
input_datetime:
|
||||
school_first_day:
|
||||
@ -163,6 +166,35 @@ automation:
|
||||
- service: script.turn_on
|
||||
entity_id: script.school_in_session
|
||||
|
||||
- id: cd9f921f-71c7-4e29-9aee-7421ef19bdd3
|
||||
alias: Work Today
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '05:45: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: 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
|
||||
|
||||
|
||||
- id: b9028665-401c-4de3-8f13-1099160b011f
|
||||
alias: School Reset
|
||||
initial_state: true
|
||||
@ -173,6 +205,16 @@ automation:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.school_today
|
||||
|
||||
- id: a6eeb075-d21b-436c-983f-39188ee9b016
|
||||
alias: Work Reset
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time
|
||||
at: input_datetime.tina_workday_end
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.work_today
|
||||
|
||||
script:
|
||||
|
||||
school_in_session:
|
||||
|
@ -59,7 +59,7 @@ sensor:
|
||||
{% set person = states.person.christina_stork.state %}
|
||||
{%- if person in ['Wal-Mart','Kroger','Chief','Meijer'] %}
|
||||
Grocery Store
|
||||
{% elif person in ['Chipotle','Ft Wayne Chipotle'] and is_state('binary_sensor.tina_work','on') %}
|
||||
{% elif person in ['Chipotle'] and is_state('input_boolean.work_today','on') %}
|
||||
Work
|
||||
{% else %}
|
||||
{% if person in ['not_home','Stationary'] %}
|
||||
|
@ -18,6 +18,20 @@
|
||||
{% else %}
|
||||
off
|
||||
{% endif %}
|
||||
work_tomorrow:
|
||||
friendly_name: 'Work Tomorrow'
|
||||
value_template: >-
|
||||
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
|
||||
{% if states.calendar.family_tinawork.attributes.start_time == test + " 09:00:00" %}
|
||||
on
|
||||
{% elif states.calendar.family_tinawork.attributes.start_time == test + " 07:00:00" %}
|
||||
on
|
||||
{% elif states.calendar.family_tinawork.attributes.start_time == test + " 10:00:00" %}
|
||||
on
|
||||
{% else %}
|
||||
off
|
||||
{% endif %}
|
||||
|
||||
- platform: time_date
|
||||
display_options:
|
||||
- 'time'
|
||||
|
Reference in New Issue
Block a user