diff --git a/automations.yaml b/automations.yaml index c4c852c..ac95fd7 100644 --- a/automations.yaml +++ b/automations.yaml @@ -186,7 +186,7 @@ description: Runs when family arrives at home trigger: - platform: state - entity_id: group.family + entity_id: group.adults from: not_home to: home - platform: event @@ -226,7 +226,7 @@ description: Runs when the family has left home trigger: - platform: state - entity_id: group.family + entity_id: group.adults from: home to: not_home - platform: event @@ -260,7 +260,7 @@ description: '' trigger: - platform: state - entity_id: group.family + entity_id: group.adults to: not_home for: hours: 1 diff --git a/groups.yaml b/groups.yaml index f009a8f..7689ece 100644 --- a/groups.yaml +++ b/groups.yaml @@ -1,6 +1,11 @@ Family: - person.tony_stork - person.christina_stork + - person.kallen_stork + +Adults: + - person.tony_stork + - person.christina_stork Presence Simulation: - light.hallway_overhead diff --git a/node-red/projects/NerdFlows b/node-red/projects/NerdFlows index 8a8bfad..2057ce3 160000 --- a/node-red/projects/NerdFlows +++ b/node-red/projects/NerdFlows @@ -1 +1 @@ -Subproject commit 8a8bfadc9245dd29c2e5528653f34d3186c77318 +Subproject commit 2057ce3404eda1c3a6e696f397f52474aebc7123 diff --git a/packages/notify.yaml b/packages/notify.yaml index e7120a3..330d3e0 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -759,7 +759,7 @@ script: entity_id: input_boolean.audible_notifications state: 'on' - condition: state - entity_id: group.family + entity_id: group.adults state: 'home' - condition: state entity_id: input_boolean.vacation_mode @@ -863,7 +863,7 @@ script: entity_id: input_boolean.audible_notifications state: 'on' - condition: state - entity_id: group.family + entity_id: group.adults state: 'home' - condition: state entity_id: input_boolean.vacation_mode diff --git a/packages/presence.yaml b/packages/presence.yaml index e15082e..94edf9b 100644 --- a/packages/presence.yaml +++ b/packages/presence.yaml @@ -70,7 +70,7 @@ sensor: {% set person = states.person.tony_stork.state %} {% if person in ['Home','home'] %} Home - {% elif person in ['WalMart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %} + {% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %} Grocery Store {% elif person in ['Rite Aid'] %} Pharmacy @@ -95,7 +95,7 @@ sensor: {% set person = states.person.christina_stork.state %} {% if person in ['Home','home'] %} Home - {% elif person in ['WalMart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %} + {% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %} Grocery Store {% elif person in ['Rite Aid'] %} Pharmacy @@ -119,19 +119,27 @@ sensor: friendly_name: "Kallen" unit_of_measurement: "" value_template: >- - {% if is_state('input_boolean.kallen_at_school', 'on') %} - School - {% elif is_state('calendar.kallen_events', 'on') %} - {{ state_attr('calendar.kallen_events', 'message') }} - {%- elif is_state('person.tony_stork', 'home') and is_state('person.christina_stork', 'home') and is_state('input_boolean.kallen_at_school', 'off')%} + {% set person = states.person.kallen_stork.state %} + {% if person in ['Home','home'] %} Home - {%- elif is_state('person.tony_stork', 'Hospital') and is_state('input_boolean.kallen_at_school', 'off')%} - {{ states('sensor.tina_location') }} - {%- elif is_state('person.christina_stork', 'Bob Evans') and is_state('input_boolean.kallen_at_school', 'off')%} - {{ states('sensor.tony_location') }} + {% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %} + Grocery Store + {% elif person in ['Rite Aid'] %} + Pharmacy {% else %} - Unknown + {% if person in ['not_home','Stationary'] %} + {{ state_attr('device_tracker.life360_kallen_stork','address') }} + {% else %} + {{ states('person.kallen_stork') }} + {%- endif %} {%- endif %} + icon_template: >- + {% set person = states.person.kallen_stork.state %} + {% if person in ['Home','home'] %} + mdi:home + {% else %} + mdi:car + {% endif %} people_home: friendly_name: "People" unit_of_measurement: 'home' @@ -167,26 +175,34 @@ template: - name: "Tina Home" state: "{{ is_state('device_tracker.tinas_iphone', 'home') or is_state('device_tracker.life360_christina_stork','home') }}" device_class: presence + - binary_sensor: + - name: "Kallen Home" + state: "{{ is_state('device_tracker.kallen_iphone','home') or is_state('device_tracker.life360_kallen_stork','home') }}" + device_class: presence - binary_sensor: - name: "Nerds Home" state: >- {% if is_state('group.family','home') %} - {% if is_state('binary_sensor.tony_home','on') or is_state('device_tracker.kallen_iphone','home') %} + {% if is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.kallen_home','on') %} true {% else %} false {% endif %} + {% else %} + false {% endif %} device_class: presence - binary_sensor: - name: "Parents Home" state: >- - {% if is_state('group.family','home') %} + {% if is_state('group.adults','home') %} {% if is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.tina_home','on') %} true {% else %} false {% endif %} + {% else %} + false {% endif %} device_class: presence @@ -305,7 +321,7 @@ automation: condition: - alias: "Are we home?" condition: state - entity_id: group.family + entity_id: group.adults state: "home" action: - alias: "Save Current Light State" @@ -392,7 +408,7 @@ script: alias: Family Is Away sequence: - condition: state - entity_id: group.family + entity_id: group.adults state: not_home - service: notify.all_ios data: @@ -404,7 +420,7 @@ script: - action: "SKIP_AWAY" title: Skip Away Mode icon: mdi:debug-step-over - - wait_template: "{{ is_state('input_boolean.away_mode_skipped','on') or is_state('group.family','home') }}" + - wait_template: "{{ is_state('input_boolean.away_mode_skipped','on') or is_state('group.adults','home') }}" continue_on_timeout: true timeout: minutes: 1 @@ -415,7 +431,7 @@ script: tag: skip-away - if: - condition: template - value_template: "{{ is_state('input_boolean.away_mode_skipped','on') or is_state('group.family','home') }}" + value_template: "{{ is_state('input_boolean.away_mode_skipped','on') or is_state('group.adults','home') }}" then: - stop: Away Mode Skipped - service: light.turn_off diff --git a/packages/security.yaml b/packages/security.yaml index bd5a2b8..50c03bd 100644 --- a/packages/security.yaml +++ b/packages/security.yaml @@ -121,7 +121,7 @@ automation: at: input_datetime.master_bedroom_wakeup condition: - condition: state - entity_id: group.family + entity_id: group.adults state: 'home' - condition: state entity_id: input_boolean.vacation_mode @@ -147,7 +147,7 @@ automation: at: input_datetime.morning_alarm_rearm condition: - condition: state - entity_id: group.family + entity_id: group.adults state: 'home' - condition: state entity_id: input_boolean.vacation_mode diff --git a/template.yaml b/template.yaml index 73352ec..c983b96 100644 --- a/template.yaml +++ b/template.yaml @@ -1,8 +1,7 @@ binary_sensor: - name: People Present state: > - {{ is_state('person.tony_stork', 'home') - or is_state('person.christina_stork', 'home') }} + {{ is_state('person.tony_stork', 'home') or is_state('person.christina_stork', 'home') }} - name: Precipitation state: >- diff --git a/templates/speech/welcome_home.yaml b/templates/speech/welcome_home.yaml index a23cac3..8bf7fa9 100644 --- a/templates/speech/welcome_home.yaml +++ b/templates/speech/welcome_home.yaml @@ -3,7 +3,9 @@ {%- macro getReport() -%}

"Welcome home, " - {% if is_state('person.tony_stork','home') and is_state('person.christina_stork','home') %} + {% if is_state('group.family','home') %} + "Stork family." + {% elif is_state('group.adults','home') %} "Stork family. " {% elif is_state('person.tony_stork','home') %} "Tony. " @@ -25,7 +27,7 @@ {% set endbefore = state_attr('input_datetime.kallen_school_day_end','timestamp') - 3600 %} {% set endafter = state_attr('input_datetime.kallen_school_day_end','timestamp') + 3600 %} {% set current = ((now().hour * 60 + now().minute) * 60 ) %} - {% if is_state('input_boolean.kallen_school_today_extended','on') and current > endbefore and current < endafter %} + {% if is_state('person.kallen_stork','home') and is_state('input_boolean.kallen_school_today_extended','on') and current > endbefore and current < endafter %} "Welcome home Collin as well, " {{ [ 'I hope you had a great day at school! ', @@ -42,7 +44,7 @@ 'You did not achieve eighth position this morning, did you? ', ] | random }} {% endif %} - {% elif is_state('input_boolean.kallen_school_cancelled','on') %} + {% elif is_state('input_boolean.kallen_school_cancelled','on') and is_state('person.kallen_stork','home') %} "I hope you are enjoying your free day off from school, Collin. " {% endif %}