Making your existing doorbell smart by repurposing an Aqara door sensor

Published by Oliver on

How do you add an existing doorbell to your smart home? I did it by connecting it to a modified Aqara door sensor. Now a ring will flash lights, send a message to my phone or do anything else I want it to – with all the power of Home Assistant behind it. Here is how it’s done.

Creating an adapter for a Ritto 7630 door bell

Before we can “smartify” anything about the doorbell we need some way of connecting it to the smart home. The doorbell is part of a bus system for the whole house where each tenant can talk to the person outside and open the door remotely. Of course it also rings.

I have seen people use Aqara vibration sensors on the doorbell phone to detect ringing but I wanted a more reliable (and less obvious) solution. You should be very careful when doing that (or better not do it at all) but the case of the doorbell/phone could be opened and you would see this inside:

PCB of the doorbell system

There is one main PCB the earpiece and the wires running through the house are connected to. Luckily this PCB comes with some additional headers. I found the pinout in this german blog post but basically the top header with the 3 pins provides a ground connection and a signal pin that is pulled high whenever the bell rings. Perfect! Usually the 3 pins are bare, on the photo you can see an adapter there, more on that in a second.

By the way, I only measured 7V in my case on the third pin but that might have been some error during measurement.

There is also a pin at the bottom (3rd from the left, 4th is GND) that would trigger the door opener but sensing is way easier than acting and I wanted to keep the (theoretical) interference with the system at a minimum. Therefore I decided to only listen to the bell signal on the top pin.

Now the next problem is connecting to that signal. As all of this hardware belongs to the landlord I could not damage it in any way. Therefore I could not solder anything directly onto the PCB. Instead I designed a clamping solution.

I measured the pin sizes and created a 3D model of a “shell” that I could push onto the PCB connector. It slides right onto the pins and has three notches inside that fit male dupont wires. Those wires are then pressed onto the contacts on the DCB. You can find that model here.

3 pin PCB connector

I 3D printed this connector on my Prusa Mini and after two iterations it fits perfectly. I took a 3 pin connector and soldered two wires to the GND and signal ports and pushed it into that new connector. Now I have wires securely connected to the DCB that can be removed at any time without any damage.

ritto doorbell PCB with custom 3D printed pin connector
Connecting wires to that DCB could look like this – they can be removed at any time

It looks like you can also by a cable with a matching connector but only as part of some extension kit that costs 20€+ instead of the cents of the 3D print.

Measuring the bell signal with an Aqara door sensor

Now the next problem is how to measure the bell signal on those wires and transmit it to my smart home system. Of course some micro controller like and ESP32/8266 could do that but those need a lot of power. Using power from the doorbell could impact the whole system and is therefore no option.

Finally I found a good solution for that problem on another German blog post. There is a cheap, low power wireless device made to react to binary signals: the Aqara door sensor. Instead of listening to the magnet it can be connected to the doorbell signal.

If you want to build a similar solution and support this blog consider buying your devices via these affiliate links:
Sonoff Zigbee 3.0 dongle plus
+ a USB extension to avoid interference
Sonoff Zbridge Wifi-Zigbe bridge (alternative)
Aqara door & window sensor
Aqara vibration sensor (alternative)

To do that you need to open such a sensor and desolder the reed switch used to detect the magnet. At the top of the sensor there is a small latch – a screwdriver can help opening the case here. Before you start it might be a good idea to pair the sensor to your smart home (I am using ZHA with a Sonoff Zigbee dongle) in case you damage the button somehow.

Next you can remove the battery and then start trying to open the next layer. That one was a bit more fiddly but I managed by using a small screwdriver as a lever. Just be careful here to only bend the plastic and not break it. Finally you can lift out the main PCB.

Reed switch on the Aqara door sensor

Next you need to desolder the reed switch on the PCB and replace it with something that can read the bell signal. I decided to again follow the advice from this blog post and use a transistor to bridge the former reed switch contacts if the bell signal goes high. This way there is an additional step of isolation between the sensor and the doorbell system. This is how that looks like:

Transistor circuit added to connect to the bell signal

Now you could use the PCB without a case but I decided to put it back into its original case. To make space for the new hardware soldered onto it I removed some material from the side and let those stick out. It is just enough to be able to close the case again.

Opened the case to include the new hardware

The wires I soldered to the sensor are the ones connected to the the piece that fits into the adapter on the doorbell PCB. To install everything I simply had to put the sensor into the doorbell case – it barely fits – and slide the connector onto the contacts of the PCB. That’s it!

A quick test. Pressing the doorbell button and … yes it works! Now onto the configuration in Home Assistant.

Doorbell detected!

Adding the doorbell to Home Assistant and creating an automation

First of course – if its not already been done – the sensor needs to be connected to Home Assistant. Using ZHA that can be done via Integrations – ZHA – configure – add device. After it has been found it will just work but be displayed as a openend/closed door by default. A click on the device and on the gear item can change that.

I selected “Sound” in the “Show as” field as it is a doorbell afterall. If the icon does not change on its own you can also select mdi:music-note. This along with the name makes it easier to recognize in the dashboard.

Doorbell sensor changed to “Sound”

Finally, now that it is available in Home Assistant, the doorbell can be used as a trigger for any automation. For now I am just using a simple automation that once it rings blinks certain lights and then resets them to their former state.

To do that I created a new automation with the doorbell as trigger using “doorbell started detecting sound”. The automation has no conditions currently and the basic action is simple: I used the “Light: Turn on” service and a flash set to short. I added this a second time to make it more noticeable.

Makes the lights flashing

I want to have multiple lights flashing (4 light bulbs overall) so I created a group to manage those. Simply go to helpers – “Create helper” and select group. Give the group a name and icon and add all the lights you want to have blinking.

Now you can just use this group id as a target for your service call in the automation. It will blink all the lights in the group. This will keep the lights on after the blinking animation though and override all existing state for them. To avoid that there is a second trick: scenes.

A scene basically stores the current status of certain devices and can restore them. Scenes can be created via a service call dynamically so we can use that to store the state of all lights and later restore them. Before the lights are told to start blinking I added a call to create a scene and provide an ID. This can be any (unused) id.

Creating a scene to store the light states

Then after the blinking animation I wait for a short time and activate the scene again to restore all the state. This has worked very well so far.

Wait for a bit, then restore the light state via the scene

Finally here is the full code for the animation. You need to replace the IDs with your own of course and might want to create a group too.

alias: Doorbell indicator
description: 'Blinks lights on ringing and restores them afterwards'
  - type: sound
    platform: device
    device_id: ed5e4a157b90ba09995a11becf1773b3
    entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_44e67804_on_off
    domain: binary_sensor
condition: []
  - service: scene.create
      snapshot_entities: light.doorbell_notification_lights
      scene_id: notification_lights_scene
  - service: light.turn_on
      flash: short
      entity_id: light.doorbell_notification_lights
  - service: light.turn_on
      flash: short
      entity_id: light.doorbell_notification_lights
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: scene.turn_on
    data: {}
      entity_id: scene.notification_lights_scene
mode: single

I really like this solution – non-invasive and it will run for a long time with this sensors battery. The automation can be very useful if I have headphones on and do not hear the sound of the bell. It could also be used for anything else like sending notifications to my phone if someone rings while I am not home. As always the possibilities are (nearly) endless here 🙂