Two sensor setup - people walking to main door video snapshot setup?

Hi All

Holding off on the “video doorbell” no perfect solution yet :confounded: so I thought this would be a nice alternative :thinking:

I am trying to setup two motion sensors up the walkway in order to register people coming (Not going)
(Later I hope to setup IOS snapshot when sensor “B - Main Door” is triggered and even have a condition saying that when someone is home don’t send IOS message)

But one thing at a time… :wink:

Narrow walkway sensor A: binary_sensor.hue_outdoor_motion_sensor_1_motion
Main door sensor B: binary_sensor.hue_outdoor_motion_sensor_1_motion_2

Picture just to illustrate…
image

My problem is the triggers I need it to go “On” trigger A and in a timeframe of maybee 3 min? after I need trigger B to be “on” the order would keep this from triggering when someone leaves

I tried this but it doesn’t work, do I need a timer? (My initial thought was that the distance is very short so it would trigger them both in a short time?

################################################################################
# Automations notification for people approaching the front door (PHILUPS HUE) #
################################################################################
automation:
  - alias: Front door movement
    initial_state: 'on'
    trigger:
 # Garage sensor     
    - platform: state      
      entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion
      to: 'on'
    condition:
      - condition: and
        conditions:
# Only when Frontdoor sensor is on
        - condition: state
          entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion_2
          state: 'on'
# Only when the adults are not home
        - condition: and
          conditions:  
        - condition: state
          entity_id: sensor.henrik_presence
          state: 'not_home'
        - condition: and
          conditions:  
        - condition: state
          entity_id: sensor.nina_presence
          state: 'not_home'
    action:
      - service: notify.ios_group_caspersen_home
        data:
          message: "Der er nogen på vej til hoveddøren? {{ states('sensor.time') }}"
          title: "Home Assistant"

notify:
  - name: ios_group_caspersen_home
    platform: group
    services:
      - service: mobile_app_caspersensiphone7p
      - service: mobile_app_ninas_iphone6s

I think this is a perfect use for a wait template :slight_smile: https://www.home-assistant.io/docs/scripts/#wait

################################################################################
# Automations notification for people approaching the front door (PHILUPS HUE) #
################################################################################
automation:
 - alias: Front door movement
   initial_state: 'on'
   trigger:
# Garage sensor     
   - platform: state      
     entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion
     to: 'on'
   condition:
# You don't need to specify "AND", it's AND per default :)
     - condition: state
       entity_id: sensor.henrik_presence
       state: 'not_home'
     - condition: state
       entity_id: sensor.nina_presence
       state: 'not_home'
   action:
# Wait until motion sensor 2 turns on
     - wait_template: "{{ is_state('binary_sensor.hue_outdoor_motion_sensor_1_motion_2', 'on') }}"
# But wait for max. 3 minutes
       timeout: '00:03:00'
# If the template won't become true, don't continue.
       continue_on_timeout: 'false'
     - service: notify.ios_group_caspersen_home
       data:
         message: "Der er nogen på vej til hoveddøren? {{ states('sensor.time') }}"
         title: "Home Assistant"

Thanks for your feedback and suggestion

I went from +50 false positive notification to 0

For some reason I think its to sensitive and I can’t change this in Home Assistant. I found that I could do it in the App
(Philips Hue only allow changes if I select light bulbs to be associated with the sensor)

Does the 3 min mean that the sensors should both be active in the time period of 3 min?
or 3 min apart? (That could be while it doesn’t work right now?)

In order to get the direction of people coming and not going it need to be first

binary_sensor.hue_outdoor_motion_sensor_1_motion
and then
binary_sensor.hue_outdoor_motion_sensor_1_motion_2

my first check are
when binary_sensor.hue_outdoor_motion_sensor_1_motion send a on how long does it wait before you get the off

I have motion sensor in my office send a on then a off within 2 sec later

my work again was have a input_boolean

#=======================================
input_boolean:
#=======================================
  someone_in_room_1:
    name: "Someone in Office"
    initial: off
  someone_in_room_2:
    name: "Someone at Mame Machine"
    initial: off

and then each time the motion went off

  - id: 'motion gone off'
    alias: 'motion gone off'
    initial_state: true
    trigger:
    - platform: state
      entity_id: binary_sensor.office_motion
      to: 'on'
    action:
    - data:
        entity_id: input_boolean.someone_in_room_1
      service:  input_boolean.turn_on
    - delay: 00:00:01 
    - data:
        entity_id: input_boolean.someone_in_room_1
      service: input_boolean.turn_off

and then using the

for:

did this

  - id: 'motion on for x min'
    alias: 'motion on for x min'
    initial_state: false
    trigger:
      - platform: state
        entity_id: input_boolean.someone_in_room_1
        to: 'off'
        for:
          minutes: 5
    condition: []
    action:
      - data:
          entity_id: light.office
        service: light.turn_off

the way it works is
each time the input_boolean.someone_in_room_1 get turn on then off
and it must be off for 5 minutes before the light get turn off

only problem I can set still for longer than 5 minutes now

hope this get you thinking

THINKING OFF TOP OF HEAD

you could setup a input_Select

  1st_motion:
    name: 1st motion 
    options:
        - "door"
        - "step"
        - 'nothing'
    initial: nothing

then build a automation then when motion 1 (door) goes on and the condition of 1st_motion is nothing action it to change to door

and then the other way motion 2 (step) goes on and the condition of 1st_motion is nothing action it to change to steps

then use the for: to change the 1st_motion back to nothing after x mins

could then add sec input_select

do same but use a condition NOT 1st_motion nothing change to to the right one

now we know if someone walk

door -> step

of

step -> door

There are motion sensors which can detect if the motion is coming towards it or walking away from it.
I have only seen them on industrial doors but they do exist.
Perhaps one could be made wireless with a 8266 if you manage to find one.

@casperse not sure if you are set on the hue sensors, but another way might be one of those arduino sonic distance sensors with a wemos d1 mini and esphome (for simplicity). That could reliably detect an approaching human within like 10ft or so… like this one:

An advantage is you could trigger the camera when the subject is at an exact distance from the lens… thus obtaining optimum focus on a manual lens.

1 Like

@Hellis81 I already bought the two Philips Hue motion sensors (Easy to install an fast response with the HUE integration to HA)

But way to sensitive any leave movement 2m away sets it off

The Door sensor is better
image
(I used tap to only have a narrow detection by the door)

But even if the door sensor isnt trickering so much I still get alerts

But looking at the sensors notification individual this combination should work…

I also found that two people leaving could trigger sensor so it thinks people are coming and not going
Really wish there would be a “Z-wave” Laser fence product or the ultra sound as a finished product

I still think this can work - setting mortion to lowest settings and taping it so the detection is narrow should work…

@fedot thanks for the code but it still get me to many notifications (Tried to set the time down to 1 minute - you can go the distance in 20-30 seconds) but that didn’t help
Looks like it triggers on the first sensor alone?
image
Above you can see that the window is 20 sec so I have now lowered it to 18 sec
(I Have to fix the first sensor sensitivity…)

@myle The activation and deactivation of the sensors looks to be = 5 seconds
image

The “input select” might be the thing but it’s might a little advanced for me would need help doing this…

Looks like you need to can use my logic above

This is the best solution.
It’s very cheap and can easily be adapted to only trigger on a set distance as you say but also only when the distance is getting lower, not higher.

@casperse you should be looking at this.
You can even mount it on the door making it mains powered from an outlet outside or inside.

Yeap bro just buzz me

Thinking turning into package
just getting my thought in place and building some samples up