DYI Xiaomi Binary Contact Sensor

Moderator: leecollings

Post Reply
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

DYI Xiaomi Binary Contact Sensor

Post by ben53252642 »

My DYI Xiaomi Binary Contact Sensor using an off the shelf Xiaomi Aqara Door Sensor

Final product, when wires touch contact is reported as "true" by the sensor, when wires are not touching it reports "false".

Photos go over a few posts due to the attachments limit.

1) Open Case
20181030_204026.jpg
20181030_204026.jpg (310.34 KiB) Viewed 2880 times
2) Remove the sensor from case
20181030_204107.jpg
20181030_204107.jpg (331.12 KiB) Viewed 2880 times
3) Remove the magnet sensor from the board
20181030_204153.jpg
20181030_204153.jpg (328.67 KiB) Viewed 2880 times
Last edited by ben53252642 on Tuesday 30 October 2018 11:54, edited 3 times in total.
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: DYI Xiaomi Binary Contact Sensor

Post by ben53252642 »

4) Solder wires to each terminal the magnet sensor was attached to (remove the battery first for safety)
20181030_205838.jpg
20181030_205838.jpg (279.3 KiB) Viewed 2878 times
5) Drill holes for the wires on the side of the case
20181030_210825.jpg
20181030_210825.jpg (219.33 KiB) Viewed 2878 times
6) Re-assemble case and install the battery
20181030_211628.jpg
20181030_211628.jpg (245.48 KiB) Viewed 2878 times
Last edited by ben53252642 on Tuesday 30 October 2018 11:38, edited 2 times in total.
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: DYI Xiaomi Binary Contact Sensor

Post by ben53252642 »

7) Product re-assembled ready for use, looking very professional! 8-)
20181030_213617.jpg
20181030_213617.jpg (257.14 KiB) Viewed 2873 times
8) Connected it to a magnetic reed switch, working nicely
20181030_214641.jpg
20181030_214641.jpg (321.84 KiB) Viewed 2860 times
9) I'm using Zigbee2MQTT and Node-Red to use the sensor with Domoticz via MQTT, here is a screenshot of Node-Red output when I move the magnet to and away from the switch.
node-red zigbee2mqtt output.JPG
node-red zigbee2mqtt output.JPG (73.75 KiB) Viewed 2859 times

After some time (about an hour for me) sensor also start reporting battery level which is nice feature.

Code: Select all

payload: "{"contact":true,"linkquality":70,"battery":"100.00","voltage":3055}"
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
User avatar
Thuis
Posts: 281
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: DYI Xiaomi Binary Contact Sensor

Post by Thuis »

I'm curious, what is the purpose of doing this ? You take the functionality of the sensor put wires on it and have the same functionality.
If you can not handle a computer, you buy a Mac. If you can not handle domotica, you use Homeassistant!
User avatar
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: DYI Xiaomi Binary Contact Sensor

Post by LouiS22 »

Thuis wrote: Thursday 04 April 2019 13:26 I'm curious, what is the purpose of doing this ? You take the functionality of the sensor put wires on it and have the same functionality.
+1, really don't understand this :)
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: DYI Xiaomi Binary Contact Sensor

Post by ben53252642 »

My application has 6 binary sensors in a series circuit. If any of the 6 cupboard doors are opened the circuit breaks and the binary switch is triggered.

It just turns on a light in the cupboards so makes no sense to use 6 separate battery powered sensors.
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: DYI Xiaomi Binary Contact Sensor

Post by hoeby »

Maybe his example is not the best. To modify it and an other door sensor.

But this is a nice example how to make an input device which could be connected to do domiticz.
Maybe jou have a device with an output which couldn't be connected to domoticz. Using this modified door sensor, it could be possible
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest