From 6692f284b030692270d484d9a182630d63a3d93f Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Thu, 7 Feb 2019 19:38:51 +0100 Subject: [PATCH] Addedd Laura from Google Maps --- automation/welcome.yaml | 47 +++++++++++++++---- .../{nmap.yaml.disabled => nmap.yaml} | 2 +- group/default.yaml | 2 +- group/people.yaml | 2 +- 4 files changed, 40 insertions(+), 13 deletions(-) rename device_tracker/{nmap.yaml.disabled => nmap.yaml} (96%) diff --git a/automation/welcome.yaml b/automation/welcome.yaml index 0382154a..89d8d198 100644 --- a/automation/welcome.yaml +++ b/automation/welcome.yaml @@ -9,25 +9,52 @@ - platform: state entity_id: - device_tracker.google_maps_115265981849847357125 - - device_tracker.laura - to: 'home' + - device_tracker.google_maps_103158638433668748797 + to: 'Casa' for: '00:00:30' condition: [] - #condition: - #condition: time - #after: '10:00:00' - #before: '23:00:00' - #condition: state - #entity_id: input_boolean.home_mode_night - #state: 'off' action: + - wait_template: >- + {# Giorgio #} + {% if is_state_attr('trigger.to_state.entity_id', 'friendly_name', 'Giorgio') %} + {% if is_state('device_tracker.s9', 'home') %} + true + {% else %} + false + {% endif %} + + {# Laura #} + {% elif is_state_attr('trigger.to_state.entity_id', 'friendly_name', 'Laura') %} + {% if is_state('device_tracker.a5', 'home') %} + true + {% else %} + false + {% endif %} + + {# Anna #} + {% elif is_state_attr('trigger.to_state.entity_id', 'friendly_name', 'Anna') %} + {% if is_state('device_tracker.a3', 'home') %} + true + {% else %} + false + {% endif %} + + {# Others #} + {% else %} + false + {% endif %} + + timeout: '00:10:00' + continue_on_timeout: 'false' + - service: script.speech_engine data_template: language: 'it' message: > - {% set name = trigger.entity_id.split('.')[1]|replace('_', ' ') %} + {% set name = trigger.to_state.entity_id.split('.')[1]|replace('_', ' ') %} + {% set name = state_attr('trigger.to_state.entity_id', 'friendly_name') %} {%- macro greeting_sentence(name) -%} {{ [ "Ciao " ~ name + " è un piacere rivederti a casa", diff --git a/device_tracker/nmap.yaml.disabled b/device_tracker/nmap.yaml similarity index 96% rename from device_tracker/nmap.yaml.disabled rename to device_tracker/nmap.yaml index f4c98fe1..97eefd26 100644 --- a/device_tracker/nmap.yaml.disabled +++ b/device_tracker/nmap.yaml @@ -9,7 +9,7 @@ - a3.giorgioravera.it scan_options: " --privileged -sP " # The number of minutes Nmap will not scan this device - home_interval: 10 + home_interval: 30 # Seconds between each scan for new devices interval_seconds: 60 diff --git a/group/default.yaml b/group/default.yaml index 2bbb6a6c..00eae25d 100644 --- a/group/default.yaml +++ b/group/default.yaml @@ -4,7 +4,7 @@ default_view: icon: mdi:home entities: - device_tracker.google_maps_115265981849847357125 - - device_tracker.laura + - device_tracker.google_maps_103158638433668748797 - sensor.home_mode - group.cucina - group.sala diff --git a/group/people.yaml b/group/people.yaml index 231ecd62..dcc60363 100644 --- a/group/people.yaml +++ b/group/people.yaml @@ -4,5 +4,5 @@ people: icon: mdi:account-multiple entities: - device_tracker.google_maps_115265981849847357125 - - device_tracker.laura + - device_tracker.google_maps_103158638433668748797 - device_tracker.anna -- 2.47.3