Garage Door Sensor Eyes as Trigger to Action

Hello,

My first post to the forum. I’m a SmartThings user working to migrate to Home Assistant. I’ve made some 120db 12v Sonoff Sirens, Sonoff lighting projects and a Sonoff Garage Door Opener. I’m trying to solve another challenge. I currently have a PIR motion sensor that triggers a bell in the house, a std driveway motion detector. It drives me nuts hearing it all day and night as it detects the critters that wander through the yard. I have a gated driveway entry so I don’t really need a wide area to be monitored, only a narrow channel. I would like to set up a light beam which will have a much more specific trigger. I was thinking I could use the infra red garage door sensor eyes to trigger GPIO pins on an ESP86xx board. This way I could define a beam that needs to be broken at say 3 or 4 ft above groung and would eliminate the alerts for the animals in the yard. I was hoping to get some pointers and direction from the vast experience the forum members. Any advice would be great!

TD

I wanted a sensor to notify me when my car was past the door. I bought a NPN laser emitter / sensor and used an ESP32 dev board with esphome. I haven’t installed it yet, but the setup tests fine.

I researched using the garage door sensors and it seemed that it would be more complicated.

@ceh I/we would be interested in how you pinned the NPN laser/sensor to the ESP32. Would you mind sharing your pinout/setup? I found this photoelectric beam sensor on Amazon and thought it could be a candidate for this type of project. I contacted the mfg and they confirmed that it should work based on NC/NO configuration.

https://www.amazon.com/dp/B001LFPB0M/ref=nav_timeline_asin?_encoding=UTF8&psc=1

In my initial post I wrote that I was using an ESP32. I was wrong, it’s an ESP8266. I have the sensor on pin 16. There’s also a relay on pin 5 to control the door opener and a light on pin 12 that comes on when the doorway is clear. I’ve copied the esphome yaml below.

esphome:
  name: garage_door_control
  platform: ESP8266
  board: modwifi

wifi:
  networks:
  - ssid: "  "
    password: "  "
  - ssid: "  "
    password: "   "

# Enable logging
logger:
#  level: VERY_VERBOSE

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin: 16
    name: "Garage Door Clear"
    id: garage_door_clear
    device_class: safety 
    filters:
      - invert:
      - delayed_on: 200ms
    on_state:
      then:
        if:
          condition:
            binary_sensor.is_on: garage_door_clear
          then:
            - output.turn_off:  gpio_12
          else: 
            - output.turn_on:  gpio_12

     
switch:
  - platform: gpio
    pin: 5
    id: GarageDoorRelay
  - platform: template
    name: "Garage Door Remote"
    icon: "mdi:arrow-up-down"
    turn_on_action:
    - switch.turn_on: GarageDoorRelay
    - delay: 500ms
    - switch.turn_off: GarageDoorRelay      

output:
  - platform: gpio
    pin: 12
    id: gpio_12

Curious, is this a garage safety sensor that has 2 wires? I’ve been attempting to get mine to work with an ESP8266 board with no success.
If the above is correct, did you just connect one wire of the sensor to a GPIO pin 16?

No, I used an NPM sensor that has three wires. I looked into using the existing 2-wire door garage sensors, but that was more complicated.