Squirrel Logo

Smart doorbell

Johan Vromans
Articles » Smart Doorbell


Smart doorbell

As part of an ongoing home automation project I attacked our front door bell.

For this I used a very nice smart ESPHome based doorbell developed by Marcel Zuidwijk.

Installation

Marcel’s doorbell is controlled by ESPHome firmware, something I am not familiar with. Almost all of my devices are using Tasmota firmware, so the first step was to reflash the doorbell with Tasmota.

The doorbell is equipped with a Wemos D1 mini board which makes flashing easy. Just connect the board to the PC using a standard USB cable, and use one of the documented methods to flash. Using the base variant of the Tasmota firmware is always good; I chose the sensors variant since I intend to add additional sensors to the Wemos board in the future.

Configure WiFi and MQTT as usual.

The GPIO pins used by the doorbell are GPIO5 (D1) for the relay, and GPIO14 (D5) for the switch. The configuration template for this setup is

    {"NAME":"Doorbell V2.0","GPIO":[1,1,1,1,1,224,1,1,1,1,160,1,1,1],"FLAG":0,"BASE":18}

This is sufficient for the doorbell to function. In this default configuration, when the switch is pressed the relay is activated and the bell rings. When the switch is released the ringing stops. Just like a dumb doorbell.

Home Assistant

The Tasmota integration of Home Assistant will automatically pick up the new device via the MQTT broker.

Home Assistant Integration

Ring modes

Dumb mode

In the default setup, the smart doorbell behaves as a dumb doorbell. You push the button and it rings.

You can restore the default mode with the command:

    SwitchMode1 0
    PulseTime1 0

Alternatively, as a single command:

    Backlog SwitchMode1 0; PulseTime1 0

Note: SwitchMode and PulseTime have a trailing 1 (digit one, not letter ell) since they apply to switch 1.

Fixed ring time

To improve hearability, I want the bell to ring for a fixed amount of time, regardless how short (or long) the button is pressed. This can easily be achieved by setting the appropriate values for SwitchMode and PulseTime as follows:

    SwitchMode1 13
    PulseTime1 20

As a single command:

    Backlog SwitchMode1 13; PulseTime1 20

SwitchMode1 13 means that the switch is used in pushbutton mode, pressing it turns on, and it switches off after PulseTime. PulseTime is measured in 0.1 seconds, so with a value of 20 the bell will ring for 2 seconds when the button is pressed.

Note: This is autonomous and will work even if there is no connection to Home Assistant.

Muting

To silence (mute) the bell use the following command:

    SwitchMode1 15

This setting disables the switch from controlling the relay. When the switch is pushed, only a MQTT message is sent.

Controlling ring modes from Home Assistant

As already noticed, the doorbell will be detected by Home Assistant (Tasmota integration) as a switch.

To control the ring mode, I defined a helper (Configuration > Automations, Helpers tab), an input_select entity input_select.doorbell_mode with values: Follow, 1 Sec, 2 Sec and Mute. To connect this entity to the doorbell, an automation is used:

alias: Doorbell Mode
description: ''
trigger:
  - platform: state
    entity_id: input_select.doorbell_mode
condition: []
action:
  - service: mqtt.publish
    data:
      topic: cmnd/doorbell/json
      payload_template: |-
        {% if trigger.to_state.state == 'Mute' %}
        {"SwitchMode1":"15"}
        {% elif trigger.to_state.state == '1 Sec' %}
        {"SwitchMode1":"13","PulseTime1":"10"}
        {% elif trigger.to_state.state == '2 Sec' %}
        {"SwitchMode1":"13","PulseTime1":"20"}
        {% else %}
        {"SwitchMode1":"0","PulseTime1":"0"}
        {% endif %}
mode: single
  

You can use the input_select.doorbell_mode entity in automations, for example to mute the doorbell depending on time of day or whatever tickles your fancy.

An example of a nice integration into an entities card on the dashboard:

type: entities
title: Hal
state_color: true
entities:
  - entity: switch.doorbell
    type: custom:multiple-entity-row
    name: Voordeurbel
    icon: mdi:doorbell
    state_color: true
    entities:
      - entity: input_select.doorbell_mode
        name: false
  

This looks like this:

dashboard

Adding a sensor

Since I already had a DHT22 temperature sensor near the location where the smart doorbell is going to be placed, I moved this sensor to the Wemos D1 card of the smart doorbell.

Wires soldered

For this, I soldered three wires to the board: 5V, Ground and D2. The DHT22 can run with 3.3V but 5V provides more stability especially when using long cables.

Through the case

It almost feels a sin to make a hole in the nice case...

Configuration

Configuring the sensor. The DHT22 is seen as an AM2301.

With sensor

Ready with sensor.

Home

The tasmota home screen of the doorbell.



© Copyright 2003-2022 Johan Vromans. All Rights Reserved.
articles/tasmota_doorbell/index.html last modified 23:02:30 05-Jul-2022