Automating Your Doorbell with ESPHome and Home Assistant: A DIY Smart Home Project / Automatisierung einer Türklingel mit ESPHome und Home Assistant

22.05.2024 | Autor: Marc Horst | Allgemein

Welcome to my latest DIY home automation project: transforming a traditional doorbell into a smart doorbell using ESPHome and an ESP8266/NodeMCU[*] along with a sound sensor[*]. In this blog post, I’ll walk you through the setup and share the configuration that worked for me, making your doorbell not only smarter but also integrated with Home Assistant.

Why Automate Your Doorbell?

Automating your doorbell can enhance your home security and convenience. With a smart doorbell, you can receive notifications directly on your phone or through your home automation system whenever someone is at your door, even when you’re not home.

Choosing the Hardware

For this project, the choice of hardware was crucial for ensuring reliability and ease of integration:

  • ESP8266/NodeMCU[*]: A versatile board that’s perfect for DIY projects due to its Wi-Fi capability and compatibility with ESPHome.
  • Sound Sensor[*]: This component detects the bell’s ring and triggers the system. I opted for a basic sound detection module which can easily interface with the ESP8266.

Setting Up ESPHome

ESPHome makes it incredibly straightforward to program your ESP8266 without deep diving into complex programming. Here’s the final configuration that worked for me:

esphome:
  name: klingel
  friendly_name: Klingel

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "4LMHVrMVjPGmQ2n8BbLKgYl0NL6msgteXjJ9cmoK9Oc="

ota:
  password: "f53a00d0a80938e88669862cf151af67"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Klingel Fallback Hotspot"
    password: "3GePiOogehOQ"

captive_portal:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO4
      mode: INPUT_PULLUP
    name: "Sound Sensor"
    device_class: sound
    filters:
      - delayed_on_off: 100ms

Key Features of the Configuration

The delayed_on_off filter in ESPHome is used in scenarios where you want to prevent noise or fluctuations in sensor readings from causing erratic behavior. This is especially useful with binary sensors like a sound sensor, where brief, insignificant changes might be detected as valid events.

Here’s how it works:

  • Delayed On: The sensor must continuously detect the condition (e.g., sound detected) for the specified delay period before the sensor’s state is changed to „on“. This helps to avoid false triggers due to short, random noises.
  • Delayed Off: After the sensor stops detecting the condition, it waits for the specified delay period before changing the sensor’s state to „off“. This ensures that brief interruptions in the detected condition don’t lead to the sensor state toggling off prematurely.

For example, with a delayed_on_off: 100ms setting, the sound must be detected continuously for at least 100 milliseconds before the sensor reports it as „on“, and once no sound is detected, it must remain undetected for another 100 milliseconds before the sensor changes to „off“. This filtering method provides a more stable and reliable sensor output, reducing the impact of transient noises or interruptions.

Other configurations

  • Wi-Fi Connectivity: This allows the ESP8266 to connect to your home network. The !secret tag is used to keep sensitive information like your Wi-Fi credentials secure and separate from the main configuration file.
  • Fallback Hotspot: If the primary connection fails, the ESP8266 can create its own network, ensuring that it remains accessible.
  • Over-the-Air (OTA) Updates: This feature allows for updating the device firmware remotely, secured with a password.
  • Home Assistant Integration: With the API and encryption, the device can securely communicate with Home Assistant, enabling automations and notifications based on doorbell rings.

Integrating with Home Assistant

Once the device is up and running, Home Assistant detects the new device automatically, allowing you to create automations, such as sending notifications to your mobile devices or triggering other smart home actions when someone rings the doorbell.

Conclusion

Automating a doorbell using ESPHome and an ESP8266 with a sound sensor is not only fun but adds a layer of functionality and security to your home. This project is a great example of how open-source tools can be used to enhance everyday objects smartly and affordably. Whether you’re new to home automation or looking to expand your smart home ecosystem, this project is a great addition to any home.

Amazon Links

Introducing a simple Docker Compose setup for HMS MQTT Publisher

19.03.2024 | Autor: Marc Horst | Allgemein

Update: I am using this „much easier“ integration now: https://github.com/suaveolent/ha-hoymiles-wifi[GitHub, External]

I’ve been tinkering with my home automation setup recently, specifically integrating HMS-XXXXW-2T series micro-inverters with my system. The hms-mqtt-publisher[GitHub, External] is a neat tool that does just that by fetching telemetry info from these inverters and publishing it to an MQTT broker. The catch? It typically requires compiling from source with Cargo, Rust’s package manager.

Weiter >>

Effortlessly Backing Up Paperless-ngx with Cloudflare, rclone, and Docker

07.03.2024 | Autor: Marc Horst | Allgemein, Programmierung

In the digital age, data backup is a non-negotiable part of managing any document management system. For those of us relying on the efficiency and organizational prowess of Paperless-ngx, ensuring our data is safe and recoverable is paramount. I’ve devised a seamless backup solution that utilizes the power of Cloudflare’s rclone and Docker, guaranteeing peace of mind and data security. Here’s a detailed look into my approach, which is applicable not just for Paperless-ngx but for any data stored on R2 storage. (https://www.cloudflare.com/developer-platform/r2/, Pricing: https://www.cloudflare.com/plans/developer-platform/ (10GB/Month for free))

Weiter >>

Ein Leitfaden für Senioren: Günstige Smartphones und Handys für Senioren bis 170 Euro

17.11.2023 | Autor: Marc Horst | Allgemein

Mit über 80 Jahren beschlossen mein Opa, sich der digitalen Welt anzuschließen. Meine Oma nutzt bereits ein Xiaomi-Handy und schätzt dessen Einfachheit. Nun möchte mein Opa auch ein Mobiltelefon, das eine gute Kamera hat und einfach zu bedienen ist, aber dennoch WhatsApp und andere Funktionen unterstützt – und besonders wichtig: Kein Senioren Handy

Kurzversion: Am Ende ist es das Xiaomi Redmi 12 geworden, was zu dem Zeitpunkt bei Amazon für 149,90 Euro verfügbar war*

Weiter >>

Heimnetzwerk – was brauche ich?

| Autor: Marc Horst | Allgemein

Ein Freund steht vor einer aufregenden Phase seines Lebens – die Renovierung seines geliebten Zuhauses. Mit neuen Plänen, frischen Ideen und einem Hauch von Vorfreude hat er beschlossen, sein Heim für die Zukunft zu gestalten. Unter all den Überlegungen zu Farben, Möbeln und Designs, die ihm im Kopf herumschwirren, gibt es jedoch eine unerlässliche Grundlage, die den Kern seiner neuen Lebensweise zu Hause darstellen wird: Ein zuverlässiges und zukunftssicheres Netzwerk.

Weiter >>

PHP APCu Modul bei Uberspace

16.11.2017 | Autor: Marc Horst | CMS, Web

Zum aktivieren bzw. installieren des APCu Cache Moduls bei Uberspace reicht ein kurzer Befehl auf der Kommandozeile:

uberspace-install-pecl apcu

« Ältere Einträge