For just $2, convert any existing wired doorbell into a smart doorbell

Recently I come across this blog when I was looking for ideas to make my existing doorbell smart. No cloud wanted, video/photo not needed. Only “problem” was that this project is using ESPHome and Home Assistant. Since I use ESPeasy and openHAB, I converted the software part to those 2 systems.

Please read this blog for the basics before continuing below. Hardware needs and setup are explained there. Kodus for @Frenck for creating this project!

I assume you already have some ESPeasy’s with MQTT in your network. I won’t guide your through the process of settings this up. There are plenty of howto’s available online.

The ESPeasy part

I’m using firmware version ESP_Easy_mega-20200328_normal_ESP8266_1M.bin. But this should probably work on newer and older versions too.

I disabled some hardware settings, since we won’t need them:

I have only added a switch to ESPeasy, the relay is controlled by GPIO and MQTT.

Enable the rules engine in Tools -> Advanced:

A new tab “Rules” will appear after you press submit. Add the following rule:

on drukknop#State do
    if [drukknop#State] = 1
        gpio,0,0
    else
        gpio,0,1
    endif
endon

Now your doorbell should already work without the interference of openHAB. So even if openHAB is offline for some reason, your doorbell just works.

The openHAB part

thing

Thing mqtt:topic:deurbel "Deurbel" (mqtt:broker:MosquittoMqttBroker) @ "Meterkast"  {
  Channels:
    Type switch : gpio0    "Power Switch"     [ commandTopic="/deurbel_15/gpio/0", on="0", off="1" ]
    Type switch : drukknop    "Switch State"     [ stateTopic="/deurbel_15/drukknop/State", on="1", off="0"]
}

items

Switch Deurbel_relay “Gong” (gMeterkast, gSensorsStatuses) {channel=“mqtt:topic:deurbel:gpio0”, expire=“1s,state=OFF”}
Switch Deurbel “Deurbel” (gMeterkast, gSensorsStatuses) {channel=“mqtt:topic:deurbel:drukknop”}

rules

val telegramAction = getActions(“telegram”,“telegram:telegramBot:Telegram_Bot”)

var Timer deurbelautooff = null
var Timer ringingprotection = null
var boolean ringing = false

rule “Deurbel auto OFF”
when
Item Deurbel changed to ON
then
logInfo(“Deurbel”, "1a. ringing = " + ringing)
if (ringing == false) {
logInfo(“Deurbel”, "1b. Ringing = " + ringing)
//Deurbel_relay.sendCommand(ON) //UNCOMMENT THIS and delete the rule on the ESPeasy if you want openHAB to control your doorbell.
telegramAction.sendTelegram(“Er staat iemand voor de deur!”)
}

    //Adds protection for pushing the doorbell multiple times within 10 seconds. Doesn't work when the ESPeasy rule controls the doorbel
    if (ringingprotection === null) {
        ringing = true
        ringingprotection = createTimer(now.plusSeconds(10), [|
        logInfo("Deurbel", "2. Ringingprotection = " + ringingprotection)
            ringing = false
            ringingprotection = null
        ])
    }

    if(deurbelautooff === null) {
        logInfo("Deurbel", "3. deurbelautooff = " + deurbelautooff)
        deurbelautooff = createTimer(now.plusSeconds(1), [|
            logInfo("Deurbel", "4. deurbelautooff = " + deurbelautooff)
            Deurbel_relay.sendCommand(OFF)
            deurbelautooff = null
        ])
    }

end

I’ve added multiple protections to turn the doorbell off after 1s.

In my experience there is quite a big lag sometimes between pushing the button and hearing the doorbell when openHAB controls it. So I stopped doing that and created the ESPeasy rule.

5 Likes

Thanks for this. I found Frencks tutorial as well and was about to open a topic when I saw your post.

However, I can’t get the (my first) ESP-01s to connect to my WiFi. Flashed ESP_Easy_mega-20201022_normal_ESP8266_1M.bin via FTDI and ESP Easy Flasher with my WiFi settings but after rebooting, the only effect is the blue LED flashing slow. WiFi is 2.4GHz set to Channel 1 and 802.11g+n. Same effect for fixed IP and leased IP.

Any idea on what might be wrong or how to troubleshoot?

I think your better off on the espeasy forum for support on this matter.

What I can think of, is your wifi hidden? That could be an issue. Do you have another ESP-01s to test with? Also double check your wiring when flashing the ESP-01s, it needs 2 extra connections compared to the normal esp8266.

I’m not familiar with the esp easy flasher? This is a windows program? Not sure how this adds your wifi settings. What you could try, flash the image, boot it, connect to the espeasy AP and enter your wifi settings.

1 Like