Integrate "old fashioned" doorbell into HA with Xiaomi

Hi all,

Just completed a very simple and effective way to integrate my old style (ding-dong) doorbell with my HA, and wanted to share.

I work from home, have my office upstairs, sometimes when I am playing music, I do not hear my doorbell. So I have been looking into adding a second chime.

I have been using Xiaomi sensors through-out the house for temperature/humidity monitoring, as well as some wireless switches.

Old style doorbells use electro-magnets to pull the pistons in, a spring return plunges them into the tone bars. A door/window contact uses a reed contact, activated by a permanent magnet to indicate status.

The electro-magnet in a doorbell is strong enough to active this read-contact. So I purchased a Xiaomi wireless door sensor, that fitted snugly into my doorbell housing.

I use a Xiaomi gateway for the second chime. The gateway is integrated into HA, so with the status signal I also added an e-mail notification with camera snapshot.

I had to “debounce” the signal (it is activated twice), but all in all this was a very cheap and easy way to extend functionality, without any wiring/soldering.

If anyone is interested in any code, please let me know.


I did something very similar with the xiaomi button:

The doorbell circuit triggers a relay which triggers the slightly modified button.

Is your approach completely passive
(No soldering , fiddling with electricity, etc. )?


Hi Jochen,

I ordered a switch for the same reason as well. But to my surprise my solution worked great!

Yes, completely passive and reversible. Just inserted the unit (it fits perfectly) and added an automation to the Xiaomi app for my chime.

I might give this a try as well.
My button solution has the drawback that it sometimes gets triggered when someone turns the outside lights on or off. Guess the relay is a little too sensitive.

1 Like

Let me know how it works for you :slight_smile:

I’m interested in the code and config as well!

Just got the Xiaomi aquare gateway but got f*ed since its V2 so need to find how to mod it to work with HA. I also bought a mini wireless switch which I’m not a fan of since it uses batteries…


Not really any code to use. Just placed the wireless door sensor inside the bell unit and set up a chime in the Xiaomi Gateway.

The sensor itself will just show up in Home Assistant with all the other Xiaomi stuff.

ah i see, is it also running on batteries? The sensor inside the door bell housing?

Yes, just uses the battery it came with. I have had my sensors running for over two years without changing any batteries.

Oh nice! So managed to add my V2 gateway into HA. Will see if I like the look of the xiaomi mini switch as a doorbell (round a slightly bigger than my original doorbell). Was thinking of wiring it to a 3V transformer later on…

But might consider your setup if I don’t like how things go…

So you get two doorbells when someone rings the doorbell? One which is the actual doorbell and the other from the aqara gateway?

All you did is place one of the Xiaomi for sensors into the doorbell box using the chime plate to trigger it?

Yes that’s pretty much it. I use the signal in hass to send me an email notification with a screenshot. The second chime I can actually hear upstairs :).

The door sensor is actually triggered by the electro magnet in the plunger.

Thanks for your great suggestion, I had a spare xiaomi door sensor sitting around and now I have it affixed with blutack inside my front door bell. I took off the plastic casing to make it fit better, it turns out the sensors are really tiny.

My method of dealing with the ‘debounce’ is a bit hacky: I’ve an automation monitoring the sensor for state switches to ‘off’, which switches an input Boolean to ‘on’ for a few seconds (added a delay in the automation) and then switches it back to off. Then I setup a virtual binary sensor to monitor the state of the input Boolean in order to give me a ‘clean’ binary sensor for use in other automations…

At the moment I have automations to send me a snapshot from the driveway camera if I’m out of the house, and to send a snapshot to whichever android tvs are turned on in the house.

Do you mind sharing your code? I just ordered a door sensor so when I receive it I’ll start hacking my doorbell.

Sounds like we do the same :grinning:

My code below copied from reddit, sorry for formatting. Am on mobile.


So in my case, I use it for my door bell. I get several pulses when the doorbell is rang.

So automation is called, and does what it is supposed to do. After that it calls a script, that will block the automation from being called (5 seconds in my case).

First, the automation.

# Door Bell

- alias: Door Bell

initial_state: True


- platform: state

entity_id: binary_sensor.door_window_sensor_158d00022b3b7f

to: 'off'


- condition: state

entity_id: input_boolean.xiaomi_doorbell_pulse

state: 'off'


- service: homeassistant.turn_on


entity_id: script.timed_doorbell_off

- service: camera.snapshot


entity_id: camera.front

filename: '/opt/homeassistant/config/www/camera_snapshots/doorbell.jpg'

Then the script,


alias: "Turn Off Doorbell Pulse"


- service: input_boolean.turn_on

entity_id: input_boolean.xiaomi_doorbell_pulse

- delay: '00:00:05'

- service: input_boolean.turn_off

entity_id: input_boolean.xiaomi_doorbell_pulse

1 Like

Is this solution with a xiaomi door-sensor also possible with this type of doorbell?

I think so, looks like the shiny metal part is attracted by the electromagnet. Pretty sure it would influence the reed switch in the Xiaomi contact. It may be oscillating, if so you can expect multiple triggers, but that can be negated with the code posted earlier :slight_smile: .

Worth a try! Let us know how it goes.

Got mine today and no matter where i placed the xiaomi it doesn’t change from open, even when i trigger the doorbell.

That sucks, maybe the shielding is the problem? Any way of removing that? Or maybe try to take the unit from the wall to test if it works from the back?

I cut the metal and placed it at the top. When the doorbell rings it’s turns the state to off but it doesn’t set it back to on. I have to use the xiaomi magnet to reset it.