Introduction: Zigbee Bed Presence Detector

For some time now i was looking for a way to detect when we are in bed. This for using this information into Homeassistant.

With this information i could make automations for turning off lights at night or for example activate a alarmsystem in my house.

I wanted it to be simple too make and without any powerwires or wifi modules.

So i got these Xiaomi aqara window/door sensors that i already used around the house for some detections.

They work with a reed contact and magnet. Since the reed contact is just like another switch, i could use other switches to activate the sensor.

And so get the info through zigbee into my homeassistant enviroment.


  • Aquara window/door sensor
  • tactile switches
  • wires
  • connector(male and female)
  • strips of some flexible material, i used forex (0.5cm thick)
  • strips of thin styreen
  • some thin foam
  • sticky tack
  • tape
  • Double sided thin tape
  • soldering iron and solder
  • 8mm drill

Step 1: Preparing the Aqara Sensor

First we will prepare the sensor so we can connect some switches to it.

Open up the sensor with a screwdriver (gently its plastic) and remove again with the screwdriver the inner plastic part. Watch out when you remove the sensor from his casing a little button will fall out.

Then solder 2 wires to where the red arrows point. Make the wires approx. 20cm long.

Drill 2 holes in the sensorcasing to passthrough the wires.

Now you can put the sensor back together.

Dont forget to put back the little button.

Step 2: Adding Connector to Sensor

Now you can solder the female part of your connector to the 2 wires.

I have used some XT60 connectors i had lying around, but you can use other types.

Step 3: Make Strips With the Switches in It

Now make some forex strips 3cm x "half the width of your bed minus 20cm" . see first picture. So the strips do not stick out from under your matras.

For me the length of the strips were 60cm. Bed is 1m60 wide.

Then drill 8mm holes in the center(width) of the strip. I used tactile switches that fit in the 8mm holes.

I used 9 switches and distributed them over the length of the strip ( approx 7cm apart).

Then i made a little tool (black strip with white hole) to help me allign the switches with the strip when putting them in.

Then gently push the switches in the holes and on the other side of the strip bent the legs of the switches

Step 4: Soldering Switches

Now we will solder the switches together in paralel so when either one of the switches is pressed the sensor will be activated.

When this is done solder at the middle switch 2 wires ( 30cm long).

Now make 2 of those strips.

And solder from each strip the 2 wires to the male connector.

Before going futher first test your swithes if they work with a multimeter.

Step 5: Finish Bottom of the Strips

Now we can finish the bottom off the strips.

I have put some sticky tack onto the bottom of the switches so they can not be pushed trough when lying on the bed.

Then i taped the wires so they can not come lose.

Step 6: Finish the Top Off the Strips

For the top off the strips i used 3mm foam and 2mm styreen to make a cover over the switches so they are just pushed when you lie on the bed.

Make some small pieces of foam and place them between the switches. Attach them to the forex with double sided tape.

Then place the styreen toplayer onto the foam with the same tape.

So now we are ready to install the sensors.

Step 7: Installing the Sensors

Put the sensors underneath your matras.

Put one strip where your upper body will be and the other where you lie your bottom down.

Sensor inbetween them.

Before installing dont forget to pair your sensor with your zigbee router and test it.

The reason for using the 2 strips per person is that with 1 strip i had false readings through the night because off moving in the bed. With the 2 strips placed at those locations i had the best results in my testing period.

Step 8: Onto Automations.....

So now you have installed your sensors and imported the data in your home assistant environment, you can create all sorts of automations with it.