Brian Wente
Published © GPL3+

ESPHome Kennel Door Monitor

This project uses ESPHome, a Wemos D1 Mini (ESP-8266), and a magnetic reed switch to monitor the time your dog spends inside their kennel.

BeginnerFull instructions provided1 hour174
ESPHome Kennel Door Monitor

Things used in this project

Hardware components

Wemos D1 Mini
Espressif Wemos D1 Mini
×1
Reed Switch, Standard Gap
Reed Switch, Standard Gap
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Code

dog-kennel.yaml

YAML
esphome:
  name: dog-kennel
  friendly_name: Dog Kennel
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  ap:
    ssid: "Dog Kennel Fallback Hotspot"
    password: "fallback_password"

captive_portal:

logger:

api:
  encryption:
    key: "your_api_encryption_key"

ota:
  password: "your_ota_password"

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO5  # Pin connected to the reed switch
      mode: INPUT_PULLUP
    name: "Kennel Door Sensor"
    device_class: door
    filters:
      - delayed_on: 100ms
      - delayed_off: 100ms
    on_state:
      then:
        - homeassistant.event:
            event: esphome.kennel_door_state
            data:
              state: !lambda 'return x ? "open" : "closed";'
        - lambda: |-
            // Control the onboard LED based on the state
            if (x) {
              id(led).turn_on();  // Turn on LED when door is open
            } else {
              id(led).turn_off();  // Turn off LED when door is closed

output:
  - platform: gpio
    pin: GPIO2  # Onboard LED pin on D1 Mini
    id: led

Credits

Brian Wente
6 projects • 8 followers
Contact

Comments

Please log in or sign up to comment.