From efee6df8448d7b80d69a6994843c53fdcaab6ee8 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Sat, 22 Apr 2023 00:39:08 +0200 Subject: [PATCH] Use hallway camera for person detection --- configuration/automations/hallway.yaml | 39 ++++++++++---------------- scripts/11.cctv.yaml | 2 -- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/configuration/automations/hallway.yaml b/configuration/automations/hallway.yaml index f72d037..bc62872 100644 --- a/configuration/automations/hallway.yaml +++ b/configuration/automations/hallway.yaml @@ -1,22 +1,3 @@ -- id: hallway-motion-reset - alias: '[Hallway] Super sensor reset' - mode: restart - trigger: - - platform: state - entity_id: binary_sensor.hallway_motion_sensor - for: 00:00:05 - from: 'off' - to: 'on' - action: - - service: zha.set_zigbee_cluster_attribute - data: - ieee: 00:15:8d:00:07:75:31:c0 - endpoint_id: 1 - cluster_id: 1280 - cluster_type: in - attribute: 2 - value: '0' - - id: hallway-button alias: '[Hallway] Button single press' mode: single @@ -46,9 +27,10 @@ mode: restart trigger: - platform: state - entity_id: binary_sensor.hallway_motion_sensor - from: 'off' - to: 'on' + entity_id: + - binary_sensor.hallway_motion_sensor + - binary_sensor.hallway_person_occupancy + to: "on" condition: - condition: numeric_state entity_id: sensor.office_illuminance @@ -61,10 +43,19 @@ mode: restart trigger: - platform: state - entity_id: binary_sensor.hallway_motion_sensor + entity_id: + - binary_sensor.hallway_motion_sensor + - binary_sensor.hallway_person_occupancy from: 'on' to: 'off' - for: 00:00:05 + for: 00:00:01 + condition: + - condition: state + entity_id: binary_sensor.hallway_motion_sensor + state: "off" + - condition: state + entity_id: binary_sensor.hallway_person_occupancy + state: "off" action: - service: script.hallway_lights_off diff --git a/scripts/11.cctv.yaml b/scripts/11.cctv.yaml index 573250b..ce9490a 100644 --- a/scripts/11.cctv.yaml +++ b/scripts/11.cctv.yaml @@ -14,7 +14,6 @@ cctv_on: - switch.living_room_detect - switch.hallway_recordings - switch.hallway_snapshots - - switch.hallway_detect - service: switch.turn_on target: entity_id: @@ -36,7 +35,6 @@ cctv_off: - switch.living_room_detect - switch.hallway_recordings - switch.hallway_snapshots - - switch.hallway_detect cctv_snapshot_all: alias: CCTV snapshot all