I recently moved into my own apartment and have been wanting to automate my doorbell. I have a regular doorbell switch, but my kid wakes up on the sound of the bell chime so I wanted the ability to mute it during his afternoon nap. I still want a phone notification so it wasn’t as easy as just turning off the doorbell.
I started off by putting a Sonoff Mini R2 behind the door button to make it smart (flashed with Tasmota). This is how the switch, the Mini R2, and the bell chime as connected to each other:
Doorbell Switch ‘Dumb’ → Mini R2 (Tasmota) → Bell chime
I found that the command ‘SwitchMode 15’ in Tasmota detaches the physical button press from controlling the chime relay. To my benefit, it still sends an MQTT message to HA informing that the switch has been pressed. So it was an easy matter to just run the command when I want to mute the doorbell and reset it back when I want to activate it again.
However, I also wanted HA to keep a track of the mute/ unmute state and make sure it is always aligned to the actual state of the Sonoff (in case of power outage/ HA restarts/ etc.). To get around this I defined a dummy relay in Tasmota like this:
Relay 2 is a dummy relay that I am using the track the mute/ unmute state. I’ve defined two rules in Tasmota:
Rule1 On Power2#state=1 Do Switchmode1 15 Endon
Rule2 On Power2#state=0 Do Switchmode1 0 Endon
These rules detach the doorbell relay when the dummy relay2 is activated and reset it when the dummy relay is turned off.
That was it! I brought in the dummy relay in HA, named it ‘Quiet Mode’ and also attached a timer to reset it in an hour if we forget to turn if off. Added a few automations to listen to the MQTT button press events and notify our phones if the doorbell is pressed when quiet mode is on.
Now whenever the kid is asleep we push this button and get all the doorbell notifications on our phones instead! Really happy with how this has turned out!
(Away mode is a separate functionality)
Here are some relevant configurations:
MQTT sensor in HA to listen to bell press event when detached from the relay:
binary_sensor:
- platform: mqtt
name: "Doorbell virtual press"
state_topic: "tele/doorbell_switch/SENSOR"
value_template: "{{ value_json.Switch1 }}"
payload_on: "OFF"
payload_off: "ON"
Note that for some reason the MQTT messages are inverted so I had to use the ‘payload’ triggers to put them in the correct state.
Here’s the automation to send notification when the doorbell press is detected in quiet mode. It captures a picture from my Dahua video doorbell and creates the phone notification.
alias: Doorbell pressed (virtual) - send notification
description: ''
trigger:
- platform: state
entity_id: binary_sensor.doorbell_virtual_press
to: 'on'
condition: []
action:
- service: camera.snapshot
target:
entity_id: camera.door_camera_mjpeg
data:
filename: /config/www/doorcam.jpg
- service: notify.mobile_app_galaxy_phone
data:
message: Doorbell pressed
data:
image: https://url.com:port/local/doorcam.jpg
clickAction: /lovelace/door
ttl: 0
priority: high
actions:
- action: URI
title: Talk
uri: app://com.mm.android.direct.gdmssphone
- service: notify.mobile_app_galaxy_phone
data:
message: TTS
title: Ding Dong
mode: single
Happy to answer any questions if anyone wants to replicate this functionality.