From: Giorgio Ravera Date: Wed, 12 Jun 2019 12:44:14 +0000 (+0200) Subject: Added guard mode X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=a52a29cbe11845fa0d9d6c8520c72be626d662d5;p=homeassistant.git Added guard mode --- diff --git a/automation/guard_mode.yaml b/automation/guard_mode.yaml new file mode 100644 index 00000000..f3cadf6c --- /dev/null +++ b/automation/guard_mode.yaml @@ -0,0 +1,69 @@ +###################################################################### +# Guard Mode: Enable +###################################################################### + +- alias: "Modalità Guardia: Attivazione" + initial_state: 'on' + + trigger: + - platform: zone + entity_id: + - device_tracker.google_maps_115265981849847357125 + - device_tracker.google_maps_103158638433668748797 + zone: zone.casa + event: leave + - platform: homeassistant + event: start + + condition: + condition: template + value_template: >- + {{ (not is_state('device_tracker.google_maps_115265981849847357125', 'Casa')) and + (not is_state('device_tracker.google_maps_103158638433668748797', 'Casa')) }} +# condition: +# condition: and +# conditions: +# - condition: zone +# entity_id: device_tracker.google_maps_115265981849847357125 +# zone: not zone.casa +# - condition: template +# entity_id: device_tracker.google_maps_103158638433668748797 +# zone: not zone.casa + + action: + - service: input_boolean.turn_on + data_template: + entity_id: input_boolean.guard_mode + +###################################################################### +# Guard Mode: Disable +###################################################################### + +- alias: "Modalità Guardia: Disattivazione" + initial_state: 'on' + + trigger: + - platform: zone + entity_id: + - device_tracker.google_maps_115265981849847357125 + - device_tracker.google_maps_103158638433668748797 + zone: zone.casa + event: enter + - platform: homeassistant + event: start + + condition: + condition: and + conditions: + - condition: zone + entity_id: device_tracker.google_maps_115265981849847357125 + zone: zone.casa + - condition: zone + entity_id: device_tracker.google_maps_103158638433668748797 + zone: zone.casa + + action: + - service: input_boolean.turn_off + data_template: + entity_id: input_boolean.guard_mode + diff --git a/binary_sensor/home_assistant.yaml b/binary_sensor/home_assistant.yaml index 86fd550c..a44929d7 100644 --- a/binary_sensor/home_assistant.yaml +++ b/binary_sensor/home_assistant.yaml @@ -20,6 +20,24 @@ mdi:airplane-takeoff {% endif %} +###################################################################### +# Binary Sensor: Guard Mode +###################################################################### + +- platform: template + sensors: + guard_mode: + friendly_name: Modalità Guardia + entity_id: input_boolean.guard_mode + value_template: >- + {{ is_state('input_boolean.guard_mode', 'on') }} + icon_template: >- + {% if is_state('input_boolean.guard_mode', 'on') %} + mdi:shield-home + {% else %} + mdi:shield-off + {% endif %} + ###################################################################### # Binary Sensor: Text Notification ###################################################################### diff --git a/input_boolean/home_assistant.yaml b/input_boolean/home_assistant.yaml index ef304435..013af5ac 100644 --- a/input_boolean/home_assistant.yaml +++ b/input_boolean/home_assistant.yaml @@ -15,6 +15,13 @@ home_mode_away: name: Vacanza icon: mdi:airplane-takeoff +###################################################################### +# Inputs: Guard Mode +###################################################################### +guard_mode: + name: Modalità Guardia + icon: mdi:shield-home + ###################################################################### # Inputs: Notification Settings ###################################################################### diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml index 31815df0..6656d782 100644 --- a/ui-lovelace.yaml +++ b/ui-lovelace.yaml @@ -17,6 +17,7 @@ views: - device_tracker.wdd1760081v167576 - sensor.time - binary_sensor.home_mode + - binary_sensor.guard_mode - binary_sensor.speech_notifications - binary_sensor.text_notifications cards: @@ -101,6 +102,7 @@ views: - input_boolean.home_mode_day - input_boolean.home_mode_night - input_boolean.home_mode_away + - input_boolean.guard_mode - type: entities title: Controlli Vari @@ -393,7 +395,8 @@ views: title: "Mercedes A200d: Sensori" show_header_toggle: false entities: - - lock.ff590mr_lock + #- lock.ff590mr_lock + - input_boolean.ff590mr_lock - binary_sensor.ff590mr_locked - binary_sensor.ff590mr_doors_closed - binary_sensor.ff590mr_windows_closed_2