From 4caeecb611a2cb7d1b9e60492d59c6da2e462233 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Wed, 10 Aug 2022 21:49:38 +0200 Subject: [PATCH] Add doorbell when someone knock on door --- configuration/automations/front-door.yaml | 29 +++++++++++++++++-- .../automations/hallway-doorbell.yaml | 21 ++------------ scripts/60.doorbell-bell.yaml | 9 ++++++ 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/configuration/automations/front-door.yaml b/configuration/automations/front-door.yaml index ce5726e..af1f185 100644 --- a/configuration/automations/front-door.yaml +++ b/configuration/automations/front-door.yaml @@ -1,4 +1,4 @@ -- id: front_door_open_notify +- id: front-door-open-notify alias: '[INFO] Front door left open' description: '' mode: single @@ -10,7 +10,6 @@ hours: 0 minutes: 30 seconds: 0 - condition: [ ] action: - service: notify.mobile_app_iphone_pg data: @@ -19,3 +18,29 @@ actions: - action: LOCK_DOOR title: Lock door + +- id: front-door-knock + alias: '[Front Door] Knock' + trigger: + - type: vibration + platform: device + device_id: f5e5356b4a45190ec2dad08ca9f991e8 + entity_id: binary_sensor.front_door_vibration + domain: binary_sensor + condition: + - condition: state + entity_id: binary_sensor.front_door_open_close + state: 'off' + - condition: state + entity_id: binary_sensor.hallway_motion_sensor + state: 'off' + action: + - service: notify.mobile_app_iphone_pg + data: + message: Someone knock + data: + actions: + - action: LOCK_DOOR + title: Lock door + - service: script.turn_on + entity_id: script.doorbell_bell diff --git a/configuration/automations/hallway-doorbell.yaml b/configuration/automations/hallway-doorbell.yaml index 3f40e86..0cf60cf 100644 --- a/configuration/automations/hallway-doorbell.yaml +++ b/configuration/automations/hallway-doorbell.yaml @@ -1,4 +1,4 @@ -- id: hallway-doorbell +- id: front-door-doorbell alias: '[Hallway] Doorbell' mode: restart trigger: @@ -7,26 +7,11 @@ from: 'off' to: 'on' action: + - service: script.turn_on + entity_id: script.doorbell_bell - service: notify.notify data: message: "Doorbell" - - choose: - - conditions: - - condition: state - entity_id: input_boolean.mute_doorbell - state: 'off' - sequence: - - service: script.turn_on - entity_id: script.doorbell_bell - - service: script.pause_all_players - - service: zwave_js.set_config_parameter - data: - parameter: '7' - value: 'Door bell music' - target: - device_id: 1502b537888f71390cd2b5adfaec6430 - - service: switch.turn_on - entity_id: switch.siren_switch - id: hallway-doorbell-bell-burn-prevention alias: '[Hallway] Doorbell bell burn prevention' diff --git a/scripts/60.doorbell-bell.yaml b/scripts/60.doorbell-bell.yaml index 7132c66..5129fb4 100644 --- a/scripts/60.doorbell-bell.yaml +++ b/scripts/60.doorbell-bell.yaml @@ -5,3 +5,12 @@ doorbell_bell: entity_id: switch.doorbell_bell - service: switch.turn_off entity_id: switch.doorbell_bell + - service: zwave_js.set_config_parameter + data: + parameter: '7' + value: 'Door bell music' + target: + device_id: 1502b537888f71390cd2b5adfaec6430 + - service: switch.turn_on + entity_id: switch.siren_switch + - service: script.pause_all_players