Hi all,
I have a PIR sensor and a bluetooth device tracker.
What I want to do it a “small security” system for my home, that send me a notification if PIR sensor detects a motion when no one is at home.
the problem is that my device tracker needs around 60 seconds to understand that I’m at home, so I can trigger the PIR sensor before the device tracker updated the fact that I’m at home.
How can I do an automation that send me a notification if PIR sensor is triggered but only if I’m not at home?
A simple condition is not enough. the condition should wait 60 seconds to give the device tracker to understand if I’m at home or not.
automation:
alias: Security alert
trigger:
platform: state
entity_id:
- LIST
- OF
- PIRS
to: DETECT_MOTION
action:
- delay: '00:01:00'
- condition: state
entity_id: YOUR _DEVICE _TRACKER
state: 'not_home'
- service: notify.notify
data:
message: 'Burglars on the rampage!'
is there a smarter way to not launch thousands of delay when I’m at home?
as far as I understood in that way every time the PIR sensor detects a movement he starts a delay and than evaluate the condition if I’m home or not.
is it possible to not start a delay if I’m at home?
in any case the automation seems to not work properly.
the notification is sent as soon as PIR detect a movement even if I set a delay of one minutes, I don’t understand why…
- id: '1546568397602'
alias: Intrusione
trigger:
- entity_id: binary_sensor.sr501pir
from: 'off'
platform: state
to: 'on'
condition: []
action:
- condition: state
entity_id: device_tracker.droidstar
state: not_home
- condition: state
entity_id: device_tracker.nexus_5x
state: not_home
- delay: 60
- condition: state
entity_id: device_tracker.droidstar
state: not_home
- condition: state
entity_id: device_tracker.nexus_5x
state: not_home
- data:
message: Intrusione rilevata.
service: notify.hassio_notifier
- data:
language: it
message: Intrusione rilevata, chiamata alle autorità in corso!
service: tts.google_say