Driveway Alarm using a pair of Defender DX-500 PIR sensors

The Defender DX-500 sensors are solar powered passive infrared (PIR) sensors and in normal operation send out a signal on 433 MHz to a base unit in the house which can then play a sound. I found that this gave too many false alarms. I have thus used a pair of Defender DX-500 sensors to create an alarm if someone walks up my driveway. When the top of the driveway sensor is triggered with 30 seconds of the bottom of the driveway sensor being triggered then I have configured HA to play a doorbell sound. The 433 MHz signal from the sensors are received by a Software Defined Radio module plugged into my Home Assistant.

Hardware required
Two off Defender DX-500 sensors - Outdoor PIR Sensor | Defender DX-500 - approx. £20 each
NESDR Mini 2 USB RTL-SDR – approx. £20 from eBay

Configuration
I installed rtl_433 component as an Add-On. I had to run this component in a verbose mode initially to discover the signals being sent from the DX-500 sensors. Each sensor seems to have its own unique identity, which needs to be discovered and then used in the config file below after the ‘match=’

My final rtl_433 config file for this component is below :-

#  
#  Driveway alarm sensor Defender DX-500
#

# Disable all existing Protocols
protocol 0

decoder {
        n=Defender_DX500_Drive_Top,
        m=OOK_PWM,
        s=220,
        l=613,
        r=7550,
        g=1500,
        match=0x1B0069,get=@20:{4}:alarm:[9:DriveTop],unique
}

decoder {
        n=Defender_DX500_Drive_Bottom,
        m=OOK_PWM,
        s=220,
        l=613,
        r=7550,
        g=1500,
        match=0x3100C9,get=@20:{4}:alarm:[9:DriveBottom],unique
}

# Output Key Value pairs to the Device log file
output kv

# Output to MQTT
output mqtt://192.168.1.999:1883,user=mqtt,pass=pwd,retain=false

I then installed rtl_433 MQTT Auto Discovery and Mosquito broker as Add-ons

I set up an integration to detect the trigger of the Drive Bottom sensor followed within 30 seconds by the Drive Top sensor. If this happens then I play a doorbell sound and write to my own log file.

Below is a copy of the YAML to implement this :-

alias: House Arrival Alarm
description: ""
trigger:
  - platform: mqtt
    topic: rtl_433/9b13b3f4-rtl433/devices/Defender_DX500_Drive_Bottom/alarm
    payload: DriveBottom
condition: []
action:
  - wait_for_trigger:
      - platform: mqtt
        topic: rtl_433/9b13b3f4-rtl433/devices/Defender_DX500_Drive_Top/alarm
        payload: DriveTop
    timeout:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
    continue_on_timeout: false
  - service: media_player.play_media
    target:
      entity_id: media_player.vlc_telnet
    data:
      media_content_id: media-source://media_source/local/chime.mp3
      media_content_type: audio/mpeg
    metadata:
      title: chime.mp3
      thumbnail: null
      media_class: music
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://media_source
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 100
  - service: notify.send_message
    target:
      entity_id: notify.file_cph
    data:
      message: "{{now().strftime('%Y-%m-%d %H:%M:%S.%f')}} House Arrival Alarm"
mode: restart

Conclusion
It took me a fair amount of fiddling around to get this working, but in the end, I am very pleased with the results, and it is very reliable.

Fair point, should be better now

1 Like